=================
Command reference
=================

Anaconda Client is the command line interface (CLI) to Anaconda Enterprise 4
Repository. You can use it to log in, log out, manage your
account, upload files, generate access tokens, view tokens and
other tasks.

The full Client command reference is shown below. You can also
view this command reference in a terminal window with the
command ``anaconda --help`` or ``anaconda -h``.

.. _repo-cli-anaconda:

anaconda
========


::

    usage: anaconda [-h] [--disable-ssl-warnings] [--show-traceback] [-v] [-q]
                    [-V] [-t TOKEN] [-s SITE]
                    ...

    Anaconda Repository command line manager

    optional arguments:
      -h, --help            show this help message and exit
      -V, --version         show program's version number and exit

    output:
      --disable-ssl-warnings
                            Disable SSL warnings (default: False)
      --show-traceback      Show the full traceback for chalmers user errors
                            (default: False)
      -v, --verbose         print debug information to the console
      -q, --quiet           Only show warnings or errors the console

    anaconda-client options:
      -t TOKEN, --token TOKEN
                            Authentication token to use. May be a token or a path
                            to a file containing a token
      -s SITE, --site SITE  select the anaconda-client site to use

    Commands:

        auth                Manage Authorization Tokens
        label               Manage your Anaconda Repository labels
        channel             [DEPRECATED in favor of label] Manage your Anaconda
                            Repository channels
        config              Anaconda client configuration
        copy                Copy packages from one account to another
        download            Download notebooks from Anaconda Repository
        groups              Manage Groups
        login               Authenticate a user
        logout              Log out from Anaconda Repository
        notebook            [DEPRECATED in favor of upload/download] Interact
                            with notebooks in anaconda.org
        package             Package utils
        remove              Remove an object from Anaconda Repository. Must refer to
                            the formal package name as it appears in the URL of
                            the package. Also use anaconda show <USERNAME> to see
                            list of package names. Example: anaconda remove
                            continuumio/empty-example-notebook
        search              Search Anaconda Repository
        show                Show information about an object
        upload              Upload packages to Anaconda Repository
        whoami              Print the information of the current user
        build               Anaconda build client for continuous integration,
                            testing and building packages
        worker              Anaconda build client for continuous integration,
                            testing and building packages

Authentication
==============

auth
----


::

    usage: anaconda auth [-h] [-n NAME] [-o ORGANIZATION]
                         [--strength {strong,weak}] [--strong] [-w] [--url URL]
                         [--max-age MAX_AGE] [-s SCOPES] [--out OUT]
                         (-x | -l | -r NAME [NAME ...] | -c | -i)

    Manage Authorization Tokens

    optional arguments:
      -h, --help            show this help message and exit
      -n NAME, --name NAME  A unique name so you can identify this token later.
                            View your tokens at anaconda.org/settings/access
      -o ORGANIZATION, --org ORGANIZATION, --organization ORGANIZATION
                            Set the token owner (must be an organization)

    token creation arguments:
      These arguments are only valid with the `--create` action

      --strength {strong,weak}
      --strong              Create a longer token (default)
      -w, --weak            Create a shorter token
      --url URL             The url of the application that will use this token
      --max-age MAX_AGE     The maximum age in seconds that this token will be
                            valid for
      -s SCOPES, --scopes SCOPES
                            Scopes for token. For example if you want to limit
                            this token to conda downloads only you would use
                            --scopes "repo conda:download"
      --out OUT

    actions:
      -x, --list-scopes     list all authentication scopes
      -l, --list            list all user authentication tokens
      -r NAME [NAME ...], --remove NAME [NAME ...]
                            remove authentication tokens
      -c, --create          Create an authentication token
      -i, --info, --current-info
                            Show information about the current authentication
                            token

    Manage Authentication tokens

For more information, see the :ref:`glossary-token` glossary entry.


login
-----

::

    usage: anaconda login [-h] [--hostname HOSTNAME] [--username LOGIN_USERNAME]
                          [--password LOGIN_PASSWORD]

    Authenticate a user

    optional arguments:
      -h, --help            show this help message and exit
      --hostname HOSTNAME   Specify the host name of this login, this should be
                            unique (default: hq-phone-114.corp.continuum.io)
      --username LOGIN_USERNAME
                            Specify your username. If this is not given, you will
                            be prompted
      --password LOGIN_PASSWORD
                            Specify your password. If this is not given, you will
                            be prompted

logout
------

::

    usage: anaconda logout [-h]

    Log out from Anaconda Repository

    optional arguments:
      -h, --help  show this help message and exit

whoami
------

::

    usage: anaconda whoami [-h]

    Print the information of the current user

    optional arguments:
      -h, --help  show this help message and exit

Informational
=============

show
----

::

    usage: anaconda show [-h] spec

    Show information about an object

    positional arguments:
      spec        Package written as USER[/PACKAGE[/VERSION[/FILE]]]

    optional arguments:
      -h, --help  show this help message and exit

    Show information about an object

EXAMPLE::

    anaconda show anaconda
    anaconda show anaconda/python
    anaconda show anaconda/python/2.7.5
    anaconda show anaconda/python/2.7.5/linux-64/python-2.7.5-0.tar.bz2

search
------

::

    usage: anaconda search [-h] [-t {conda,pypi}]
                           [-p {osx-32,osx-64,win-32,win-64,linux-32,linux-64,linux-armv6l,linux-armv7l,linux-ppc64le,noarch}]
                           name

    Search Anaconda Repository

    positional arguments:
      name                  Search string

    optional arguments:
      -h, --help            show this help message and exit
      -t {conda,pypi}, --package-type {conda,pypi}
                            only search for packages of this type
      -p {osx-32,osx-64,win-32,win-64,linux-32,linux-64,linux-armv6l,linux-armv7l,linux-ppc64le,noarch}, --platform {osx-32,osx-64,win-32,win-64,linux-32,linux-64,linux-armv6l,linux-armv7l,linux-ppc64le,noarch}
                            only search for packages of the chosen platform

    Search Anaconda Repository for packages

config
------

::

    usage: anaconda config [-h] [--type TYPE] [--set name value] [--get name]
                           [--remove REMOVE] [--show] [-f] [--show-sources] [-u]
                           [-s]

    Anaconda client configuration

    optional arguments:
      -h, --help            show this help message and exit
      --type TYPE           The type of the values in the set commands

    actions:
      --set name value      sets a new variable: name value
      --get name            get value: name
      --remove REMOVE       removes a variable
      --show                show all variables
      -f, --files           show the config file names
      --show-sources        Display all identified config sources

    location:
      -u, --user            set a variable for this user
      -s, --system, --site  set a variable for all users on this machine

    anaconda-client configuration

    Get, Set, Remove or Show the anaconda-client configuration.

    ###### anaconda-client sites

    anaconda-client sites are a mechanism to allow users to quickly switch
    between Anaconda Repository instances. This can be used with the on-site Anaconda
    Enterprise.

      * Invoke the anaconda command with the `-s/--site` option like this:

            anaconda -s site_name whoami

      * Set a site as the default:

            anaconda config --set default_site site_name
            anaconda whoami

    ###### Add an anaconda-client site

    After installing Anaconda Enterprise
    you can add a site named **site_name** like this:

        anaconda config --set sites.site_name.url "http://<anaconda-enterprise-ip>:<port>/api"
        anaconda config --set default_site site_name

    ###### Site Options VS Global Options

    All options can be set as global options that affect all sites
    or site options that affect only one site.

    By default, options are set globally:

        anaconda config --set OPTION VALUE

    If you want the option to be limited to a single site,
    prefix the option with `sites.site_name`:

        anaconda config --set sites.site_name.OPTION VALUE

    ###### Common anaconda-client configuration options

      * `url`: Set the anaconda api url (default: https://api.anaconda.org)
      * `ssl_verify`: Perform ssl validation on the https requests.
        ssl_verify may be `True`, `False` or a path to a root CA pem file.

    ###### Toggle auto_register when doing anaconda upload

    The default is yes, automatically create a new package when uploading.
    If no, then an upload will fail if the package name does not already exist on the server.

        anaconda config --set auto_register yes|no

Package management
==================

package
-------

::

    usage: anaconda package [-h]
                            (--add-collaborator user | --list-collaborators | --create)
                            [--summary SUMMARY] [--license LICENSE]
                            [--license-url LICENSE_URL] [--personal | --private]
                            USER/PACKAGE

    Anaconda Repository package utilities

    positional arguments:
      USER/PACKAGE          Package to operate on

    optional arguments:
      -h, --help            show this help message and exit

    actions:
      --add-collaborator user
                            username of the collaborator you want to add
      --list-collaborators  list all of the collaborators in a package
      --create              Create a package

    metadata arguments:
      --summary SUMMARY     Set the package short summary
      --license LICENSE     Set the package license
      --license-url LICENSE_URL
                            Set the package license url

    privacy:
      --personal            Set the package access to personal This package will
                            be available only on your personal registries
      --private             Set the package access to private This package will
                            require authorized and authenticated access to install

.. _repo-cli-upload:

upload
------

::

    usage: anaconda upload [-h] [-c CHANNELS] [-l LABELS] [--no-progress]
                           [-u USER] [--all] [-p PACKAGE] [-v VERSION]
                           [-s SUMMARY] [-t PACKAGE_TYPE] [-d DESCRIPTION]
                           [--thumbnail THUMBNAIL] [--private]
                           [--no-register | --register] [--build-id BUILD_ID]
                           [-i | -f | --force]
                           files [files ...]

    Upload packages to Anaconda Repository

    positional arguments:
      files                 Distributions to upload

    optional arguments:
      -h, --help            show this help message and exit
      -c CHANNELS, --channel CHANNELS
                            [DEPRECATED] Add this file to a specific channel.
                            Warning: if the file channels do not include "main",
                            the file will not show up in your user channel
      -l LABELS, --label LABELS
                            Add this file to a specific label. Warning: if the
                            file labels do not include "main", the file will not
                            show up in your user label
      --no-progress         Don't show upload progress
      -u USER, --user USER  User account or Organization, defaults to the current
                            user
      --all                 Use conda convert to generate packages for all
                            platforms and upload them
      --no-register         Don't create a new package namespace if it does not
                            exist
      --register            Create a new package namespace if it does not exist
      --build-id BUILD_ID   Anaconda Repository Build ID (internal only)
      -i, --interactive     Run an interactive prompt if any packages are missing
      -f, --fail            Fail if a package or release does not exist (default)
      --force               Force a package upload regardless of errors

    metadata options:
      -p PACKAGE, --package PACKAGE
                            Defaults to the package name in the uploaded file
      -v VERSION, --version VERSION
                            Defaults to the package version in the uploaded file
      -s SUMMARY, --summary SUMMARY
                            Set the summary of the package
      -t PACKAGE_TYPE, --package-type PACKAGE_TYPE
                            Set the package type [ipynb, env]. Defaults to
                            autodetect
      -d DESCRIPTION, --description DESCRIPTION
                            description of the file(s)
      --thumbnail THUMBNAIL
                            Notebook's thumbnail image
      --private             Create the package with private access

        anaconda upload CONDA_PACKAGE_1.bz2
        anaconda upload notebook.ipynb
        anaconda upload environment.yml

See also:

* :ref:`repo-uploading-conda-packages`.
* :ref:`repo-uploading-pypi-packages`.

download
--------

::

    usage: anaconda download [-h] [-f] [-o OUTPUT] handle

    Download packages from Anaconda Repository

    positional arguments:
      handle                user/notebook

    optional arguments:
      -h, --help            show this help message and exit
      -f, --force           Overwrite
      -o OUTPUT, --output OUTPUT
                            Download as

    Usage:
        anaconda download notebook
        anaconda download user/notebook

remove
------

::

    usage: anaconda remove [-h] [-f] specs [specs ...]

    Remove an object from Anaconda Repository

    example::

        anaconda remove sean/meta/1.2.0/meta.tar.gz

    positional arguments:
      specs        Package written as <user>[/<package>[/<version>[/<filename>]]]

    optional arguments:
      -h, --help   show this help message and exit
      -f, --force  Do not prompt removal

groups
------

::

    usage: anaconda groups [-h] [--perms {read,write,admin}]
                           {add,show,members,add_member,remove_member,packages,add_package,remove_package}
                           spec

    positional arguments:
      {add,show,members,add_member,remove_member,packages,add_package,remove_package}
                            The group management command to execute
      spec                  <organization>/<group_name>/<member>

    optional arguments:
      -h, --help            show this help message and exit
      --perms {read,write,admin}
                            The permission the group should provide

label
-----


::

    usage: anaconda label [-h] [-o ORGANIZATION]
                          (--copy LABEL LABEL | --list | --show LABEL | --lock LABEL | --unlock LABEL | --remove LABEL)

    Manage your Anaconda Repository channels

    optional arguments:
      -h, --help            show this help message and exit
      -o ORGANIZATION, --organization ORGANIZATION
                            Manage an organizations labels
      --copy LABEL LABEL
      --list                list all labels for a user
      --show LABEL          Show all of the files in a label
      --lock LABEL          Lock a label
      --unlock LABEL        Unlock a label
      --remove LABEL        Remove a label

copy
----

::

    usage: anaconda copy [-h] [--to-owner TO_OWNER] [--from-label FROM_LABEL]
                         [--to-label TO_LABEL] [--replace | --update]
                         spec

    Copy packages from one account to another

    positional arguments:
      spec                  Package - written as user/package/version[/filename]
                            If filename is not given, copy all files in the
                            version

    optional arguments:
      -h, --help            show this help message and exit
      --to-owner TO_OWNER   User account to copy package to (default: your
                            account)
      --from-label FROM_LABEL
                            Label to copy packages from
      --to-label TO_LABEL   Label to put all packages into
      --replace             Overwrite destination package metadata
      --update              Update missing data in destination package metadata

move
----

::

    usage: anaconda move [-h] [--from-label FROM_LABEL] [--to-label TO_LABEL] spec

    Move packages between labels.

    positional arguments:
      spec                  Package - written as user/package/version[/filename]
                            If filename is not given, move all files in the
                            version

    optional arguments:
      -h, --help            show this help message and exit
      --from-label FROM_LABEL
                            Label to move packages from
      --to-label TO_LABEL   Label to move packages to
