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
:
- https://anaconda.org/travis/labels/main – the 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 packages ready to test.
- https://anaconda.org/travis/labels/any-custom-label – any label you want to use.
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:
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 inanaconda-client/example-packages/conda/
to be2.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 .
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.You now can see that even when you search conda
main
, you do not see the2.0
version of the test package. This is because you need to tell conda to look for your newtest
label.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.You can give the label
USERNAME/label/test
to your testers.NOTE: Replace
USERNAME
with your username.Once they finish testing, you may then want to copy the
test
packages back to yourmain
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 inmain
: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.