Labels#

Organize your code and facilitate the development cycle—without affecting non-development users—by applying Anaconda.org labels to code that is in development, in testing, and in production. Using Anaconda Client, Package developers can create labels like labels/dev for development, labels/test for testing, or other labels that are found only if the user specifies the label in their search.

The following search examples use a Namespace of travis:

https://anaconda.org/travis/labels/main

Label searched by default

https://anaconda.org/travis

Same as default label with main implicit

https://anaconda.org/travis/labels/dev

Contains the packages in development

https://anaconda.org/travis/labels/test

Contains the packages ready to test

https://anaconda.org/travis/labels/any-custom-label

Any label you want to use

Using labels to make your packages private#

The following steps instruct you in the use of a test label, which allows you to upload files without affecting your production-quality packages. Without a --label option, the label defaults to main.

Use Anaconda Prompt (Terminal on macOS/Linux) to perform the following steps:

Building and uploading the package#

  1. Start with a conda package. In this example, we use a small public conda test package:

    git clone https://github.com/Anaconda-Platform/anaconda-client/
    cd anaconda-client/example-packages/conda/
    
  2. Open the meta.yaml file by running the following command:

    nano meta.yaml
    
  3. Change the version number to 2.0. To save and close the meta.yaml file, press ctrl + X, followed by Y.

  4. To build the package, turn off automatic Client uploading and then run the conda build command:

    conda config --set anaconda_upload no
    conda build .
    

    Tip

    You can check where the resulting file was placed by adding the --output option:

    conda build . --output
    
  5. Upload your test package to Anaconda.org using the Anaconda Client upload command.

    Add the --label option followed by your label (in this case, test), which tells Anaconda.org to make the upload visible only to users who specify that label:

    # Replace </PATH/TO/PACKAGE_NAME> with the correct file path and package name
    anaconda upload </PATH/TO/PACKAGE_NAME>.tar.bz2 --label test
    

Now you 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.

Testing the discoverability of the package#

  1. Add the --override argument, which tells conda not to use any channels in your ~/.condarc file. Without specifying the label and package name, the 2.0 version is not discoverable:

    # Replace <USERNAME> with your username
    conda search --override -c <USERNAME> conda-package
    

    Once the label and package are specified, the 2.0 can be found:

    # Replace <USERNAME> with your username
    conda search --override -c <USERNAME>/label/test conda-package
    
  2. You can give the label <USERNAME>/label/test to your testers, where <USERNAME> is your username.

  3. 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 at https://anaconda.org/USERNAME/conda-package, where <USERNAME> is your username.

    Your version 2.0 is now in main:

    # Replace <USERNAME> with your username
    conda search --override -c <USERNAME> conda-package
    

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

# Replace <OLD> with the old label
# Replace <NEW> with the new label
# Replace <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.
anaconda move --from-label <OLD> --to-label <NEW> <SPEC>