Using the PyDist CLI
The PyDist CLI lets you publish and install packages from
PyDist with minimal configuration. Install it with
pip install pydist-cli and then run
pydist publish from the root directory of your package to publish it, or
pydist install <package> to install a package.
You can set an API key using the environment variable
the command-line flag
--api-key, or by setting
api_key in a
file, either in the root of your project or your home folder. If you do not provide an API key, you will be
prompted for one at runtime, which will be saved in a
Note that the CLI only supports Python 3.5 and higher.
Installing from PyDist
Instead of using the CLI, you can install packages through PyDist using standard python tools like
pipenv with a single configuration option.
pip, use the
pip install --index-url https://[tag]:[API Key]@index.pydist.com/simple/ [package_name]
pip install --index-url https://[tag]:[API Key]@index.pydist.com/simple/ -r requirements.txt
Alternatively, you can configure
pip with a
pip.conf file in any of:
- Your virtual environment directory (e.g.
- Your user config directory's
- Your global config directory
Which directory you choose determines how broadly the configuration will apply—just within that
virtual environment, for the user, or for the entire system. The
pip.conf file should contain:
[global] index-url = https://[tag]:[API Key]@index.pydist.com/simple/
poetry, add a
[[tool.poetry.source]] section to your
[[tool.poetry.source]] name = 'pydist' url = 'https://[tag]:[API Key]@index.pydist.com/simple/'
pipenv, replace the
[[source]] section at the top of
[[source]] url = 'https://[tag]:[API Key]@index.pydist.com/simple/' verify_ssl = true name = 'pydist'
Note that the URL includes a tag as a username, which can be anything, and your API Key as a password.
Uploading to PyDist
The process of uploading a package to PyDist is almost identical to uploading a package to PyPI.
Before you can upload a python package, you need to create one or more distributions
of that package. Per Python's
Packaging User Guide,
you first want to make sure the packages
wheel are installed,
python setup.py sdist bdist_wheel, which will build source
and binary wheel distributions of your package in the
After building distributions in your
dist/ directory, you can upload them using
twine upload --repository-url https://index.pydist.com/ dist/*
You will be prompted for a username and a password. The username can be blank; provide an
API Key as a password. Alternatively, you can supply the flags
--username "" and
--password [API Key], or you can configure
.pypirc file in your home directory. The file should look like:
[distutils] index-servers = pydist [pydist] repository: https://index.pydist.com/ username: [tag] password: [API Key]
Then you only need to supply the name of the repository in your
.pypirc to upload to:
twine upload --repository pydist dist/*
You should delete the
dist/ directory afterwards to avoid re-uploading distributions
after subsequent builds.
If you use
poetry publish to upload your package, you will need to do some
poetry config repositories.pydist https://index.pydist.com/ poetry config http-basic.pydist [tag] [API Key]
You can then upload packages with
poetry publish --repository pydist.
You can find the packages you've uploading on the Packages tab.
PyDist lets you create unlimited API keys with varying privileges, which allows you to distribute your code while maintaining strict access controls. You can create read-only API keys through the keys management interface. These can be used to distribute code to your servers while mitigating the risk of malicious package uploads in the event that the key is compromised, or to distribute code to third-parties.
You can further restrict read-only keys to a whitelist of specific packages you have uploaded. These keys can only be used to download those packages, or packages mirrored from PyPI.
Forking PyPI Packages
PyDist lets you switch from a PyPI package to an internal fork of that package without changing any code or requirements in your applications. Simply upload your fork to PyDist under the same name as the original package. Since your organization's packages always take precedence over PyPI packages by the same name, all of your applications will install the fork instead of the original package.
Even if you make no changes to the package code, forking allows you to upload additional distributions for each release. This can be useful if the package you would like to use does not offer binary wheels for the platform or python version your applications run on, but you would like to avoid having to build the packages from source every time you build your application.
It is hard to keep perfect track of every package you install, especially as your dependencies introduce new dependencies of their own. The Insights tab gives you visibility, listing which packages you have installed. You can also see where they are installed, either by using a different API Key for each machine or service installing packages, or by using tags.
Tags are be added before the API Key in the PyDist index URL, e.g.