标签#
通过将 Anaconda.org 标签应用于开发、测试和生产中的代码,组织您的代码并促进开发周期,而不会影响非开发用户。使用 Anaconda Client,Package 开发人员可以创建如下标签labels/dev
对于发展,labels/test
进行测试,或者仅当用户在搜索中指定标签时才能找到的其他标签。
以下搜索示例使用 Namespacetravis
:
Label searched by default |
|
Same as default label with |
|
Contains the packages in development |
|
Contains the packages ready to test |
|
Any label you want to use |
使用标签将包设为私有#
以下步骤将指导您使用test
标签,它允许您在不影响生产质量包的情况下上传文件。如果没有--label
选项,则标签默认为main
.
使用 Anaconda Prompt(macOS/Linux 上的终端)执行以下步骤:
构建和上传包#
从 conda 包开始。在此示例中,我们使用一个小型公共 conda 测试包:
git clone https://github.com/Anaconda-Platform/anaconda-client/ cd anaconda-client/example-packages/conda/
打开
meta.yaml
file 中:nano meta.yaml
将版本号更改为
2.0
.要保存并关闭meta.yaml
文件中,按 Ctrl+X,然后按 Y。要构建包,请关闭自动客户端上传,然后运行
conda build
命令:conda config --set anaconda_upload no conda build .
提示
您可以通过添加
--output
选择:conda build . --output
使用 Anaconda Client upload 命令将测试包上传到 Anaconda.org。
添加
--label
选项后跟您的标签(在本例中为test
),该标签会告知 Anaconda.org 仅对指定该标签的用户可以看到上传:# Replace </PATH/TO/PACKAGE_NAME> with the correct file path and package name anaconda upload </PATH/TO/PACKAGE_NAME>.tar.bz2 --label test
现在,即使您搜索 conda 也可以看到这一点main
,则不会看到2.0
版本。这是因为您需要告诉 conda 寻找您的新test
标签。
测试包的可发现性#
添加
--override
参数,该参数指示 Conda 不要使用~/.condarc
文件。在不指定标签和软件包名称的情况下,2.0
版本不可发现:# Replace <USERNAME> with your username conda search --override --channel <USERNAME> conda-package
指定标签和包后,
2.0
可以找到:# Replace <USERNAME> with your username conda search --override --channel <USERNAME>/label/test conda-package
您可以指定标签
<USERNAME>/label/test
发送给您的测试人员,其中<USERNAME>
是您的用户名。一旦他们完成测试,您可能希望将
test
软件包返回到您的main
标签:anaconda label --copy test main
您还可以从控制面板管理您的包裹标签,网址为
https://anaconda.org/USERNAME/conda-package
哪里<USERNAME>
是您的用户名。您的版本
2.0
现在在main
:# Replace <USERNAME> with your username conda search --override --channel <USERNAME> conda-package
如果您使用anaconda-client
1.7 或更高版本,您可以使用anaconda move
要将包从一个标签移动到另一个标签:
# 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>