Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RKVST observes the [CNCF Community Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md), reproduced below for emphasis.
DATATRAILS observes the [CNCF Community Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md), reproduced below for emphasis.

### Contributor Code of Conduct

Expand Down Expand Up @@ -32,7 +32,7 @@ Conduct may be permanently removed from the project team.
This code of conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a RKVST administrator on <support@rkvst.com>.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting a DATATRAILS administrator on <support@datatrails.ai>.

This Code of Conduct is adapted from the Contributor Covenant
(http://contributor-covenant.org), version 1.2.0, available at
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Contributing to rkvst-archivist #
# Contributing to datatrails-archivist #

Thanks for taking the time to contribute to rkvst-archivist!
Thanks for taking the time to contribute to datatrails-archivist!

Contributing is not limited to writing code and submitting a PR. Feel free to submit an
[issue](https://github.com/rkvst/rkvst-python/issues/new/choose) or comment on an existing one
[issue](https://github.com/datatrails/datatrails-python/issues/new/choose) or comment on an existing one
to report a bug, provide feedback, or suggest a new feature.

Of course, contributing code is more than welcome! To keep things simple, if you're fixing a small issue,
Expand Down Expand Up @@ -81,7 +81,7 @@ Once a PR has the necessary approvals, it can be merged.
Here’s how the merge should be handled:
- Once approved the author will be asked to squash all fixup commits generated by the review process.
- Commits and their messages should be consistent - each commit in the PR should form a logical unit with working code.
- The first change requested by an RKVST reviewer will be to reorganise the commits into a clean logical structure.
- The first change requested by an DATATRAILS reviewer will be to reorganise the commits into a clean logical structure.
- The smaller a PR the more likely and more easily that the change will be approved.
- Any changes requested by a reviewer should be committed as a 'fixup' commit against the original commit in the PR.
- Once approval is granted any 'fixup' commits should be merged into their respective commits using 'git rebase -i --autosquash'.
Expand Down
44 changes: 22 additions & 22 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ Host *
```
> i.e. 'githubUserHandle' viz:
>
> git clone ssh-githubUserHandle:githubUserHandle/rkvst-python.git
> git clone ssh-githubUserHandle:githubUserHandle/datatrails-python.git
>


```bash
mkdir githubUserHandle
cd githubUserHandle
git clone ssh-githubUserHandle:githubUserHandle/rkvst-python.git
git clone ssh-githubUserHandle:githubUserHandle/datatrails-python.git
```

Enter the new cloned fork and add the original upstream repo as a remote:

```bash
cd rkvst-python
git remote add upstream ssh-githubUserHandle:rkvst/rkvst-python.git
cd datatrails-python
git remote add upstream ssh-githubUserHandle:datatrails/datatrails-python.git
git remote -v
```

Expand Down Expand Up @@ -121,48 +121,48 @@ they be run in a production environment.
Set 2 environment variables and execute:

```bash
export RKVST_URL="https://app.rkvst.io"
export RKVST_AUTHTOKEN_FILENAME=credentials/authtoken
export DATATRAILS_URL="https://app.datatrails.ai"
export DATATRAILS_AUTHTOKEN_FILENAME=credentials/authtoken
task functests
```

NOTE: For the access policy functional tests, two separate tenancy tokens are needed for successful test execution.
Therefore add a another env variable for the second tenancy's auth token:

```
export RKVST_AUTHTOKEN_FILENAME_2=credentials/authtoken_tenant_2
export DATATRAILS_AUTHTOKEN_FILENAME_2=credentials/authtoken_tenant_2
```

Alternatively one can use a direct environment variable for the authtoken:
```bash
export RKVST_AUTHTOKEN_FILENAME=
export RKVST_AUTHTOKEN="ey.....==="
export DATATRAILS_AUTHTOKEN_FILENAME=
export DATATRAILS_AUTHTOKEN="ey.....==="
task functests
```

Alternatively one can use a client id and secret obtained from the appregistrations endpoint:
```bash
export RKVST_AUTHTOKEN_FILENAME=
export RKVST_AUTHTOKEN=
export RKVST_APPREG_CLIENT=c5db8230-6e1c-4b80-9481-d70e647c0429
export RKVST_APPREG_SECRET_FILENAME=credentials/client_secret
export DATATRAILS_AUTHTOKEN_FILENAME=
export DATATRAILS_AUTHTOKEN=
export DATATRAILS_APPREG_CLIENT=c5db8230-6e1c-4b80-9481-d70e647c0429
export DATATRAILS_APPREG_SECRET_FILENAME=credentials/client_secret
task functests
```

Additionally one set the appregistration directly in the environment:

```bash
export RKVST_AUTHTOKEN_FILENAME=
export RKVST_AUTHTOKEN=
export RKVST_APPREG_CLIENT=c5db8230-6e1c-4b80-9481-d70e647c0429
export RKVST_APPREG_SECRET_FILENAME=
export RKVST_APPREG_SECRET="ey.....................ab=="
export DATATRAILS_AUTHTOKEN_FILENAME=
export DATATRAILS_AUTHTOKEN=
export DATATRAILS_APPREG_CLIENT=c5db8230-6e1c-4b80-9481-d70e647c0429
export DATATRAILS_APPREG_SECRET_FILENAME=
export DATATRAILS_APPREG_SECRET="ey.....................ab=="
task functests
```
When running the runner tests one can specify a namespace to isolate instances of assets in differnt
runs:
```bash
export RKVST_UNIQUE_ID=${RANDOM}
export DATATRAILS_UNIQUE_ID=${RANDOM}
FUNCTEST=execrunner task functests
```

Expand All @@ -171,14 +171,14 @@ Additional environment variables:
For testing sharing via an access policy requires a second auth token:

```bash
RKVST_AUTHTOKEN_FILENAME_2=
DATATRAILS_AUTHTOKEN_FILENAME_2=
```

Testing of the client token refresh logic can take 10 to 20 minutes to complete.
To enable this test set:

```bash
RKVST_REFRESH_TOKEN=anything
DATATRAILS_REFRESH_TOKEN=anything
```

#### Testing Other Python Versions
Expand Down Expand Up @@ -305,7 +305,7 @@ Push the changes upstream(the set-upstream option is only required the first tim
git push --set-upstream origin dev/githubUserHandle/some-proposed-fix
```

Enter the github ui at https://github.com/rkvst/rkvst-python and
Enter the github ui at https://github.com/datatrails/datatrails-python and
generate a pull request.

Reviewers will be notified when a PR is generated and you will receive feedback.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

MIT License

Copyright (c) 2022 RKVST
Copyright (c) 2022 DATATRAILS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
44 changes: 22 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

.. _readme:

RKVST Python Client
DATATRAILS Python Client
=========================

The standard RKVST Python Client.
The standard DATATRAILS Python Client.

Please note that the canonical API for RKVST is always the REST API
documented at https://docs.rkvst.com
Please note that the canonical API for DATATRAILS is always the REST API
documented at https://docs.datatrails.ai

Support
=======
Expand All @@ -28,14 +28,14 @@ Use standard python pip utility:

.. code:: bash

python3 -m pip install rkvst-archivist
python3 -m pip install datatrails-archivist

If your version of python3 is too old an error of this type or similar will be emitted:

.. note::

ERROR: Could not find a version that satisfies the requirement rkvst-archivist (from versions: none)
ERROR: No matching distribution found for rkvst-archivist
ERROR: Could not find a version that satisfies the requirement datatrails-archivist (from versions: none)
ERROR: No matching distribution found for datatrails-archivist

Example
=============
Expand All @@ -44,7 +44,7 @@ You can then use the examples code to create assets (see examples directory):

.. code:: python

"""Create an asset in RKVST with User Token.
"""Create an asset in DATATRAILS with User Token.

The module contains two functions: main and create_asset. Main function parses in
a url to the Archivist and credentials, which is a user authorization.
Expand Down Expand Up @@ -125,8 +125,8 @@ You can then use the examples code to create assets (see examples directory):
# client id is an environment variable. client_secret is stored in a file in a
# directory that has 0700 permissions. The location of this file is set in
# the client_secret_filename environment variable.
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
client_id = getenv("DATATRAILS_APPREG_CLIENT")
client_secret_file = getenv("DATATRAILS_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

Expand All @@ -135,7 +135,7 @@ You can then use the examples code to create assets (see examples directory):
# specify a different value here particularly when creating assets on SIMPLE_HASH
# as confirmation times are much shorter in this case.
with arch = Archivist(
"https://app.rkvst.io",
"https://app.datatrails.ai",
(client_id, client_secret),
max_time=300,
) as arch:
Expand All @@ -152,10 +152,10 @@ Notebooks
=================

Some jupyter notebooks are available to exercise the examples code.
These examples can be downloaded from python.rkvst.com and run in a local install
These examples can be downloaded from python.datatrails.ai and run in a local install
of jupyter notebook such as jupyterLabDesktop.

Please consult https://python.rkvst.com/notebooks.html for details.
Please consult https://python.datatrails.ai/notebooks.html for details.


File Story Runner
Expand All @@ -182,7 +182,7 @@ Python

def run(arch: Archivist, args):

LOGGER.info("Using version %s of rkvst-archivist", about.__version__)
LOGGER.info("Using version %s of datatrails-archivist", about.__version__)
LOGGER.info("Namespace %s", args.namespace)

with open(args.yamlfile, "r", encoding="utf-8") as y:
Expand All @@ -209,7 +209,7 @@ Python
Command Line
------------

This functionality is also available with the CLI tool :code:`archivist_runner`, which is bundled with version v0.10 onwards of the :code:`rkvst-archivist`.
This functionality is also available with the CLI tool :code:`archivist_runner`, which is bundled with version v0.10 onwards of the :code:`datatrails-archivist`.

You can verify the installation by running the following:

Expand All @@ -223,16 +223,16 @@ To use the :code:`archivist_runner` command you will need the following:

- A Client ID and Client Secret by creating an `App Registration`_
- The YAML file with the operations you wish to run
- The URL of your RKVST instance, this is typically `https://app.rkvst.io`
- The URL of your DATATRAILS instance, this is typically `https://app.datatrails.ai`

.. _App Registration: https://docs.rkvst.com/developers/developer-patterns/getting-access-tokens-using-app-registrations/
.. _App Registration: https://docs.datatrails.ai/developers/developer-patterns/getting-access-tokens-using-app-registrations/

Example usage:

.. code-block:: shell

archivist_runner \
-u https://app.rkvst.io \
-u https://app.datatrails.ai \
--client-id <your-client-id> \
--client-secret <your-client-secret> \
functests/test_resources/richness_story.yaml
Expand Down Expand Up @@ -354,18 +354,18 @@ which should be called before anything else:
from archivist.archivist import Archivist

set_logger("DEBUG")
client_id = getenv("RKVST_APPREG_CLIENT")
client_secret_file = getenv("RKVST_APPREG_SECRET_FILENAME")
client_id = getenv("DATATRAILS_APPREG_CLIENT")
client_secret_file = getenv("DATATRAILS_APPREG_SECRET_FILENAME")
with open(client_secret_file, mode="r", encoding="utf-8") as tokenfile:
client_secret = tokenfile.read().strip()

arch = Archivist(
"https://app.rkvst.io",
"https://app.datatrails.ai",
(client_id, client_secret),
max_time=300,
)

Development
===========

For instructions on contributing to the RKVST SDK see DEVELOPMENT.md.
For instructions on contributing to the DATATRAILS SDK see DEVELOPMENT.md.
2 changes: 1 addition & 1 deletion archivist/access_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Initialize connection to Archivist
arch = Archivist(
"https://app.rkvst.io",
"https://app.datatrails.ai",
authtoken,
)
access_policy = arch.access_policies.create(...)
Expand Down
2 changes: 1 addition & 1 deletion archivist/appidp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Initialize connection to Archivist
arch = Archivist(
"https://app.rkvst.io",
"https://app.datatrails.ai",
authtoken,
)
appidp = arch.appidp.token(...)
Expand Down
2 changes: 1 addition & 1 deletion archivist/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# Initialize connection to Archivist
arch = Archivist(
"https://app.rkvst.io",
"https://app.datatrails.ai",
authtoken,
)
application = arch.applications.create(...)
Expand Down
4 changes: 2 additions & 2 deletions archivist/archivist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Archivist connection interface

This module contains the base Archivist class which manages
the connection parameters to a RKVST instance and
the connection parameters to a DATATRAILS instance and
the basic REST verbs to GET, POST, PATCH and DELETE entities..

The REST methods in this class should only be used directly when
Expand All @@ -20,7 +20,7 @@

# Initialize connection to Archivist
arch = Archivist(
"https://app.rkvst.io",
"https://app.datatrails.ai",
authtoken,
max_time=300.0,
)
Expand Down
10 changes: 5 additions & 5 deletions archivist/archivistpublic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""Public connection interface

This module contains the base Archivist class which manages
the public connection to an RKVST instance and
the public connection to an DATATRAILS instance and
the basic REST verbs to GET, POST, PATCH and DELETE entities..

The REST methods in this class should only be used directly when
Expand Down Expand Up @@ -186,7 +186,7 @@ def get(
"""GET method (REST)

Args:
url (str): e.g. https://app.rkvst.io/archivist/v2/publicassets/xxxxxxxxxxxxxxxxxxxxxx
url (str): e.g. https://app.datatrails.ai/archivist/v2/publicassets/xxxxxxxxxxxxxxxxxx
headers (dict): optional REST headers
params (dict): optional params strings

Expand Down Expand Up @@ -313,7 +313,7 @@ def get_by_signature(
being found.

Args:
url (str): e.g. https://app.rkvst.io/archivist/v2/assets
url (str): e.g. https://app.datatrails.ai/archivist/v2/assets
field (str): name of collection of entities e.g assets
params (dict): selector e.g. {"attributes": {"arc_display_name":"container no. 1"}}
headers (dict): optional REST headers
Expand Down Expand Up @@ -356,7 +356,7 @@ def count(self, url: str, *, params: "dict[str, Any]|None" = None) -> int:
Returns the count of objects that match params

Args:
url (str): e.g. https://app.rkvst.io/archivist/v2/assets
url (str): e.g. https://app.datatrails.ai/archivist/v2/assets
params (dict): selector e.g. {"attributes":{"arc_display_name":"container no. 1"}}

Returns:
Expand Down Expand Up @@ -401,7 +401,7 @@ def list(
(different for each endpoint)

Args:
url (str): e.g. https://app.rkvst.io/archivist/v2/assets
url (str): e.g. https://app.datatrails.ai/archivist/v2/assets
field (str): name of collection of entities e.g assets
page_size (int): optional number of items per request e.g. 500
params (dict): selector e.g. {"confirmation_status": "CONFIRMED", }
Expand Down
Loading