Tutorial

Using labels in the development cycle

Anaconda.org 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 Anaconda.org using the Client upload command.

    Adding the --label option tells Anaconda.org 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.

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.