The Cloudsmith Developer Hub

Welcome to the Cloudsmith Developer Hub. You'll find comprehensive guides and documentation to help you start working with Cloudsmith as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Command-Line Interface

Latest Version @ CloudsmithLatest Version @ Cloudsmith Python VersionsPython Versions PyPI VersionPyPI Version CircleCICircleCI Codacy BadgeCodacy Badge MaintainabilityMaintainability Code style: blackCode style: black

The Cloudsmith Command Line Interface (CLI) is a Py2/Py3 text-based interface to the API. This allows users, machines and other services to access and integrate smoothly with Cloudsmith without requiring explicit plugins or tools.
Open source

The Cloudsmith CLI is built as open source allowing the community to contribute.

Source Code available on GitHub

Installation

You can install the latest CLI application from:

The easiest way is to use pip, such as:

pip install --upgrade cloudsmith-cli

Or you can get the latest pre-release version from Cloudsmith:

pip install --upgrade cloudsmith-cli --extra-index-url=https://dl.cloudsmith.io/public/cloudsmith/cli/python/index/

Getting your API Key

You'll need to provide authentication to Cloudsmith for any CLI actions that result in accessing private data or making changes to resources (such as pushing a new package to a repository). There are two ways to retrieve your API Key

1. Via the Cloudsmith Website UI

Go to the API Key page in your user settings to view the API Key.

2. via the Cloudsmith CLI
With the CLI this is simple to do. You can retrieve your API key using the cloudsmith login command:

cloudsmith login
Login: [email protected]
Password: PASSWORD
Repeat for confirmation: PASSWORD

NOTE: Please ensure you use your email for the 'Login' prompt and not your user slug/identifier.

The resulting output looks something like:

Retrieving API token for '[email protected]' ... OK
Your API token is: 1234567890abcdef1234567890abcdef

Once you have your API key you can then put this into your credentials.ini file, use it as an environment variable export CLOUDSMITH_API_KEY=<YOUR_API_KEY> or pass it to the CLI using the -k <YOUR_API_KEY> flag.

For convenience, the CLI will ask you if you want to install the default configuration files, complete with your API key if they don't already exist. Enter y or yes to create the configuration files.

If the configuration files already exist, you'll have to manually put the API key into the configuration files, but the CLI will print out their locations.


Configuration / Setup

There are two configuration files used by the CLI:

  • config.ini: For non-credentials configuration.
  • credentials.ini: For credentials (authentication) configuration.

By default, the CLI will look for these in the following locations:

  • The current working directory.
  • A directory called cloudsmith in the OS-defined application directory. For example:

Linux

  • $HOME/.config/cloudsmith
  • $HOME/.cloudsmith

Mac OS

  • $HOME/Library/Application Support/cloudsmith
  • $HOME/.cloudsmith

Windows

  • C:\Users\<user>\AppData\Local\cloudsmith (Win7+, not roaming)
  • C:\Users\<user>\AppData\Roaming\cloudsmith (Win7+, roaming)
  • C:\Documents and Settings\<user>\Application Data\cloudsmith (WinXP, not roaming)
  • C:\Documents and Settings\<user>\Local Settings\Application Data\cloudsmith (WinXP, roaming)

config.ini

You can specify the following configuration options:

api_host: The API host to connect to.
api_proxy: The API proxy to connect through.
api_ssl_verify: Whether or not to use SSL verification for requests.
api_user_agent: The user agent to use for requests.

The default config is:

# Default configuration
[default]
# The API host to connect to (default: api.cloudsmith.io).
api_host=

# The API proxy to connect through (default: None).
api_proxy=

# Whether to verify SSL connection to the API (default: True)
api_ssl_verify=true

# The user agent to use for requests (default: calculated).
api_user_agent=


# Profile-based configuration
# You can set as many additional profiles as you need to provide
# for different configuration environments (e.g. prod vs staging).
# Add your overrides in the sections and then specify one of:
#  * -P your-profile-name (as an argument)
#  * --profile your-profile-name (an an argument)
#  * CLOUDSMITH_PROFILE=your-profile-name (as an env variable)
[profile:your-profile-name]

credentials.ini

You can specify the following configuration options:

api_key: The API key for authenticating with the API.

# Default configuration
[default]
# The API key for authenticating with the API.
api_key=<YOUR_API_KEY>


# Profile-based configuration
# You can set as many additional profiles as you need to provide
# for different configuration environments (e.g. prod vs staging).
# Add your overrides in the sections and then specify one of:
#  * -P your-profile-name (as an argument)
#  * --profile your-profile-name (an an argument)
#  * CLOUDSMITH_PROFILE=your-profile-name (as an env variable)
[profile:your-profile-name]

Troubleshooting

When upgrading the Cloudsmith CLI, you may also need to update the Cloudsmith API using:

pip install --upgrade cloudsmith-api

Updated 2 months ago



Command-Line Interface


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.