- 28 Aug 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
pypi Packages
- Updated on 28 Aug 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
Getting Started
Log in with the Crowdbotics CLI:
cb login
Set up your pypi config files:
cat > ~/.pypirc << EOF [distutils] index-servers = crowdbotics [crowdbotics] repository = https://pkg.crowdbotics.com/pypi/packages/stable/+simple username = packages password = $(npx node-jq -r ".token" ~/.crowdbotics/auth.json) EOF
cat > ~/.config/pip/pip.conf << 'EOF' [global] index-url = "https://packages:${PKG_PASSWORD}@pkg.crowdbotics.com/pypi/packages/stable/+simple" EOF
Set up your environment variables:
zsh users (default on MacOS)
cat >> ~/.zshrc << EOF # Crowdbotics Packages config export PKG_PASSWORD=$(npx node-jq -r ".token" ~/.crowdbotics/auth.json) EOF cat >> ~/.zshrc << 'EOF' export TWINE_REPOSITORY_URL="https://packages:[email protected]/pypi/packages/stable" EOF
bash users
cat >> ~/.bashrc << EOF # Crowdbotics Packages config export PKG_PASSWORD=$(npx node-jq -r ".token" ~/.crowdbotics/auth.json) EOF cat >> ~/.bashrc << 'EOF' export TWINE_REPOSITORY_URL="https://packages:[email protected]/pypi/packages/stable" EOF
Publishing packages
Publishing packages with pypi
is very straightforward.
Create a
pyproject.toml
file based on this example.Name your package
pkg-<your-package-name-here>
.Build your project with
python -m build
and publish withtwine upload
.
A full example is available at:
https://github.com/crowdbotics/pkg-pypi-packaging-tutorial
Package visibility
In the current version of the system, all published packages are available to all users in your organization; only the package author or the organization owner can publish new versions.
Fine-grained access control settings will be available in a future release.
Existing projects
On existing projects update your
Pipfile
sources section to look like this:[[source]] url = "https://packages:${PKG_PASSWORD}@pkg.crowdbotics.com/pypi/packages/stable/+simple" verify_ssl = true name = "pip_conf_index_global"
Then run
pipenv lock
to update thePipfile.lock
file.