CLI tool to publish Python packages and documentation with external configuration
Project description
cal-publish-python
CLI tool to publish Python packages and documentation with external configuration.
Overview
cal-publish-python is designed to keep sensitive configuration (tokens, registry URLs, SSH keys) outside of build jobs. The project being published defines the "what" (name, version), while the publishing configuration defines the "where" (registry, documentation platform).
Installation
pip install cal-publish-python
Or with uv:
uv pip install cal-publish-python
Usage
Publishing to PyPI
cal-publish-python pypi --output-dir output/
Or specify a wheel directly:
cal-publish-python pypi --wheel output/my-package-1.0.0-py3-none-any.whl
Publishing Documentation
GitLab Pages Mode
cal-publish-python docs --project my-project --doc-version 1.0.0 --html html/
With options:
cal-publish-python docs -p my-project -V 1.0.0 -H html/ --set-latest --force
SSH Mode
Configure SSH mode in your config file, then:
cal-publish-python docs -p my-project -V 1.0.0 --output-dir output/
Configuration
Config File
Create a JSON configuration file:
{
"pypi": {
"token": "pypi-xxxxxxxxxxxx",
"repository_url": "https://upload.pypi.org/legacy/"
},
"docs": {
"mode": "gitlab-pages",
"gitlab_pages": {
"token": "glpat-xxxxxxxxxxxx",
"url": "https://gitlab.com",
"group": "docs"
},
"ssh": {
"host": "docs.example.com",
"base_path": "/var/www/docs",
"ssh_key": "~/.ssh/id_rsa",
"user": "deploy",
"port": 22
}
}
}
Set the config file path via environment variable:
export CAL_PUBLISH_CONFIG=/path/to/config.json
Or pass it directly:
cal-publish-python -c config.json pypi --output-dir output/
Environment Variables
All configuration values can be overridden by environment variables:
| Variable | Description |
|---|---|
CAL_PUBLISH_CONFIG |
Path to JSON config file |
CAL_PUBLISH_PYPI_TOKEN |
PyPI API token |
CAL_PUBLISH_PYPI_REPOSITORY_URL |
PyPI repository URL |
CAL_PUBLISH_DOCS_MODE |
Documentation mode (gitlab-pages or ssh) |
CAL_PUBLISH_GITLAB_TOKEN |
GitLab personal access token |
CAL_PUBLISH_GITLAB_URL |
GitLab instance URL |
CAL_PUBLISH_GITLAB_GROUP |
GitLab group for docs |
CAL_PUBLISH_SSH_HOST |
SSH host |
CAL_PUBLISH_SSH_BASE_PATH |
Base path on remote server |
CAL_PUBLISH_SSH_KEY |
Path to SSH private key |
CAL_PUBLISH_SSH_USER |
SSH user |
CAL_PUBLISH_SSH_PORT |
SSH port |
Integration with Makefile
Add a publish target to your project's Makefile:
.PHONY: publish
publish: build
cal-publish-python pypi --output-dir output/
cal-publish-python docs -p $(PROJECT_NAME) -V $(VERSION_STR) --output-dir output/ --set-latest
Development
# Clone the repository
git clone <repo-url>
cd cal-publish-python
# Set up development environment
make dev
# Run checks
make check
# Build
make build
Licence
MIT License — Copyright (c) 2026 Cyber Assessment Labs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cal_publish_python-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cal_publish_python-0.2.0-py3-none-any.whl
- Upload date:
- Size: 28.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
563c449640b28f061e8428dd69c4ada28fb41bcfae27e47f76e1e7024cf6659b
|
|
| MD5 |
42b56c070a7645dbc93e8a8a0d796ff5
|
|
| BLAKE2b-256 |
a59a823c767d19fe2b80dfc64bdd2bbc0c51267cd6529224cf9eb0f8baf07c0d
|