Skip to content

Commit

Permalink
Bump docs for CLI handling for clones
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Kanzer authored and Aaron Kanzer committed Nov 27, 2024
1 parent 887bb46 commit fce80c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 45 deletions.
36 changes: 0 additions & 36 deletions docs/60_initialize_vendors.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ Deploys production frontend build, as well as s staging previews to assist with

Provides observability and monitoring for API events

**PyPI**

Serves as a public registry for the `dandi-cli` tool

Some services are not yet integrated within the main infrastructure:

https://github.com/dandi/backups2datalad - to populate/update https://github.com/dandi/dandisets, https://github.com/dandisets, and https://github.com/dandizarrs/
Expand Down Expand Up @@ -442,38 +438,6 @@ alt="retrieve"
style="width: 60%; height: auto; display: block; margin-left: auto; margin-right: auto;"/>
<br/><br/>

## PyPI

A common way that users interact with the DANDI ecosystem is via its CLI and Python client tool: [dandi-cli](https://pypi.org/project/dandi/)

##### Create a PyPI Account

Versions of this tool are hosted, versioned and managed by PyPI -- therefore, you will need to create an account.

##### Retrieve an API Token

After creating an account, you'll want to create your own API key -- first go to `Account settings`

<br/><br/>
<img
src="../img/pypi_account.png"
alt="retrieve"
style="width: 60%; height: auto; display: block; margin-left: auto; margin-right: auto;"/>
<br/><br/>

Scroll down to `API tokens` and create a value -- keep track of this value for now. We will use it later

<br/><br/>
<img
src="../img/pypi_api_token.png"
alt="retrieve"
style="width: 60%; height: auto; display: block; margin-left: auto; margin-right: auto;"/>
<br/><br/>

In terms of creating and publishing your first project, go to the [documentation for setting up a CLI and Python Client](.
./62_dandi_cli)


## datalad (TBD)

## git-annex (TBD)
27 changes: 18 additions & 9 deletions docs/62_dandi_cli.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
For data management (predominately `upload`, `download` and `validation` of data
to/from DANDI), a local CLI (command line interface) is used.

**Note: please make sure [you have set up your PyPI account](..60_initialize_vendors/##pypi).**

## Referencing your API

To reference your DANDI-clone API, [update the URLs reference per each CLI action](https://github.com/dandi/dandi-cli/blob/15196a93310618f8897c7b43444e216bbb094549/dandi/consts.py#L119-L135)
To reference your DANDI-clone API, [update the URLs reference per each CLI action](https://github.com/dandi/dandi-cli/blob/15196a93310618f8897c7b43444e216bbb094549/dandi/consts.py#L119-L135) and push a PR to the [dandi-cli GitHub repository](https://github.com/dandi/dandi-cli).

Here is an example PR of another clone adding to the available instances of `DandiInstance` objects in `dandi-cli`: [see here](https://github.com/dandi/dandi-cli/pull/1527)

For example:

```python
known_instances = {
"dandi": DandiInstance( # Your own "dandi""
"dandi", # Your own "dandi"
"https://<your-domain>.org", # UI URL
"https://api.<your-domain>.org/api", # API URL
"dandi": DandiInstance(
"dandi",
"https://dandiarchive.org",
"https://api.dandiarchive.org/api",
),
"dandi-staging": DandiInstance(
"dandi-staging",
Expand All @@ -26,13 +26,22 @@ known_instances = {
f"http://{instancehost}:8085",
f"http://{instancehost}:8000/api",
),
"<your-dandi-clone>": DandiInstance( # Your own "dandi""
"<your-dandi-clone>", # Your own "dandi"
"https://<your-dandi-clone-domain>.org",
"https://api.<your-dandi-clone-domain>.org/api",
),
}
```

Of note, you'll need to think about how you manage API access via the CLI -- `dandi` relies of the presence of a `DANDI_API_KEY`
Once your DANDI clone is added to list of available `DandiInstance` objects, you should be able to perform operations via the `-i` flag -- for example:

`dandi upload -i <your-dandi-clone>`

**Note**: Users will be prompted for a `DANDI_API_KEY`
env. var [see here for code reference](https://github.com/dandi/dandi-cli/blob/6aa414c4db47394970f586cc4fb9758a634aef87/dandi/dandiapi.py#L492-L499)

Dependent on the structure of your project, you might want to reflect a specific, unique environment variable value.
You do not need to create a unique value here -- a user can just reference the `DANDI_API_KEY` their API issues in their respective clone.

## Handling Versioning

Expand Down

0 comments on commit fce80c7

Please sign in to comment.