Tutorial

Using labels in the development cycle

Anaconda Cloud 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. With labels you can upload a file to a specific label, so only users who put that label in the URL they search are able to find it.

Using Anaconda Client, package developers can create additional labels such as development labels/dev, test labels/test or other labels that are searched only if the user specifies the label. The following search examples use a namespace of travis:

In this example, we show you 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.

Use the Terminal window or an Anaconda Prompt to perform the following steps:

  1. Let us start 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 Cloud using the Client upload command.

    Adding the --label option tells Cloud 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 actual path 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.

    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
    

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

    Your version 2.0 is now in main:

    conda search --override -c USERNAME conda-package
    

    NOTE: Replace USERNAME with your username.