Tutorials#

Using labels in the development cycle#

Anaconda Enterprise 4 Repository labels can be used to facilitate a development cycle and organize the code that is in development, in testing and in production, without affecting non-development users.

In this tutorial, we show how to use a “test” label, so that you can upload files without affecting your production-quality packages. Without a --label argument the default label is “main.”

  1. You need to begin with a conda package. If you do not have one, use our example conda package. Before you build the package, edit the version in the meta.yaml file in anaconda-client/example-packages/conda/ to be 2.0:

    git clone https://github.com/anaconda-platform/anaconda-client
    cd anaconda-client/example-packages/conda/
    nano meta.yaml # Bump version to 2.0
    conda config --set anaconda_upload no
    conda build .
    
  2. Upload your test package to Repository using the Client upload command. Adding the --label option tells Repository to make the upload visible only to users who specify that label:

    anaconda upload /path/to/conda-package-2.0.tar.bz2 --label test
    

    NOTE: Replace /path/to/ with the path to where you stored the package.

  3. You now can see that even when you search conda “main,” you do not see the 2.0 version of the test package. This is because you need to tell conda to look for your new “test” label.

  4. The --override argument tells conda not to use any channels in your ~/.condarc file.

    The following command produces no 2.0 results:

    conda search --override -c USERNAME conda-package
    

    NOTE: Replace USERNAME with your username.

    Your 2.0 package is here:

    conda search --override -c USERNAME/label/test conda-package
    

    NOTE: Replace USERNAME with your username.

  5. You can give the label USERNAME/label/test to your testers.

    NOTE: Replace USERNAME with your username.

  6. Once they finish testing, you may then want to copy the test packages back to your “main” label:

    anaconda label --copy test main
    

    Your version 2.0 is now in main:

    conda search --override -c USERNAME conda-package
    

    NOTE: Replace USERNAME with your username.

You can also manage your package labels from your dashboard: https://<your-anaconda-repo>/USERNAME/conda-package.

NOTE: Replace <your-anaconda-repo> with the name of your local Repository, and USERNAME with your username.

If you use anaconda-client 1.7 or higher, you can use anaconda move to move packages from one label to another:

anaconda move --from-label OLD --to-label NEW SPEC

Replace OLD with the old label, NEW with the new label, and SPEC with the package to move. SPEC can be either “user/package/version/file”, or “user/package/version” in which case it moves all files in that version.

Working with other file types#

In addition to uploading or downloading packages, you can also upload or download other file types to/from Anaconda Enterprise 4 Repository.

Uploading other file types#

You can upload any type of file with Anaconda Client command line interface (CLI) by using the steps below.

PyPI package files, conda package files and notebook files are automatically detected. There is no auto-detect for other types of files, so you must explicitly specify the package, package-type and version fields.

In the following example, we upload a spreadsheet named baby-names in comma separated value (CSV) format.

  1. Create a new package, which creates a Namespace that can hold multiple files:

    anaconda login
    anaconda package --create jsmith/baby-names
    
  2. Upload the file to the new namespace:

    anaconda upload --user jsmith --package baby-names --package-type file --version 1 baby-names1.csv
    

NOTE: In this example:

  • The user or organization name is “jsmith.”

  • The package name is “baby-names.”

  • The package type is “file.”

  • The version is “1.”

  • The full filename is baby-names1.csv.

Downloading other file types#

Files, such as the one created above, are available at:

https://<your-anaconda-repo>/USERNAME/PACKAGE

Anyone can download these files using Client:

anaconda download USERNAME/PACKAGE

NOTE: Replace <your-anaconda-repo> with the name of your local Repository, USERNAME with the desired username and PACKAGE with the desired package name.

If the repository has multiple files with the same name and different extensions, anaconda download will download all of them by default. If you use anaconda-client 1.7 or higher, you can use anaconda download with the option --package-type or -t to specify only one of these files. This option can work with the values pypi, conda, ipynb, and env.