PyUploader
A CLI tool to automate uploading Python packages to PyPI.
Features
- Build and upload Python packages to PyPI or TestPyPI with a single command
- Support for API tokens and username/password authentication
- Option to clean build directories before building
- Option to skip existing distributions when uploading
- Simple and intuitive command-line interface
Installation
You can install PyUploader using pip:
pip install pyuploader
Or, if you're installing from source:
pip install .
Usage
PyUploader provides several commands to help you manage your package uploading workflow:
Available Commands
Commands:
upload Build and upload a Python package (default command)
init Initialize PyUploader configuration
edit Edit package information in pyproject.toml
fix Fix format errors in pyproject.toml
pypirc_config Automatically configure ~/.pypirc file
Default Command (upload)
The default command (when no specific command is provided) builds and uploads a package to PyPI:
pyuploader
Command-line Options
Options:
-d, --package-dir TEXT Directory of the package to upload [default: .]
-r, --repository TEXT PyPI repository to upload to (pypi or testpypi)
[default: pypi]
-u, --username TEXT Username for PyPI authentication
-p, --password TEXT Password or API token for PyPI authentication
--dist-dir TEXT Directory containing the distribution files
[default: dist]
--build / --no-build Whether to build the package before uploading
[default: build]
--clean / --no-clean Whether to clean the build directories before
building [default: clean]
--skip-existing Skip uploading if the distribution already exists
--help Show this message and exit.
Examples
Upload to TestPyPI:
pyuploader --repository testpypi
Upload with authentication:
pyuploader --username __token__ --password YOUR_API_TOKEN_HERE
Skip building (upload existing distributions):
pyuploader --no-build
Authentication
For PyPI authentication, you can:
- Provide your username and password/API token directly via command-line options
- Use a
~/.pypircconfiguration file - Let Twine prompt you for credentials during upload
Using a .pypirc Configuration File
The ~/.pypirc file allows you to store your PyPI credentials so you don't have to enter them every time you upload a package.
You can either create this file manually or use the pypirc_config command to automatically configure it.
Using the pypirc_config Command
The pypirc_config command provides an interactive interface to automatically configure your ~/.pypirc file:
pyuploader pypirc_config
This command will:
- guide you through setting up credentials for PyPI, TestPyPI, and pyuploader repositories
- Set appropriate file permissions (600) to keep your credentials secure
- Create all necessary configuration sections
Options:
--force, -f: Force overwrite of an existing.pypircfile
Basic Configuration Format
[distutils]
index-servers =
pypi
testpypi
pypiuploader
[pypi]
repository = https://upload.pypi.org/legacy/
username = __token__
password = your-pypi-api-token-here
[testpypi]
repository = https://test.pypi.org/legacy/
username = __token__
password = your-testpypi-api-token-here
[pypiuploader]
repository = https://upload.pypi.org/legacy/
username = __token__
password = your-pypi-api-token-here
Important Notes:
- For API tokens, use
__token__as the username - Set appropriate file permissions:
chmod 600 ~/.pypircto keep your credentials secure - The
pyuploadersection is specifically for this tool's default repository name
Using API Tokens
API tokens are the recommended authentication method for PyPI. When using an API token:
- Use
__token__as the username - Use the entire token string (including the
pypi-prefix) as the password
Troubleshooting
Common Errors
Missing 'pypiuploader' section from ~/.pypirc
If you see an error like:
ERROR InvalidConfiguration: Missing 'pypiuploader' section from ~/.pypirc.
This means your ~/.pypirc file does not have a configuration section named 'pyuploader'. To fix this:
- Create or edit your
~/.pypircfile - Add the 'pyuploader' section as shown in the configuration example above
- Set appropriate permissions with
chmod 600 ~/.pypirc
An example configuration file is provided in this repository as .pypirc.uploader.example.
Requirements
- Python 3.7 or higher
- Twine 4.0.0 or higher
- Click 8.0.0 or higher
License
This project is licensed under the MIT License.
Metadata
Release files for pyuploader-cx 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyuploader_cx-0.1.0.tar.gz | 13.7 kB | Without provenance | Details for pyuploader_cx-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyuploader_cx-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyuploader_cx-0.1.0-py3-none-any.whl |
Total release size: 25.8 kB
Release files / pyuploader_cx-0.1.0.tar.gz
| Download URL | pyuploader_cx-0.1.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f99b31f936cd492936f2b964f68ca63adbd743375a3b30159dfc34396925a48
|
|
BLAKE2b-256 checksum How to use checksums |
854451115396d00c72569c18847ff657d4bb2ff5d2fa66bf0194c3a450bb2d1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / pyuploader_cx-0.1.0-py3-none-any.whl
| Download URL | pyuploader_cx-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b1424883291b9b7ba3377c39d3ca2a66a6739471d8b1001bfa60ad7e3f809d6
|
|
BLAKE2b-256 checksum How to use checksums |
0d6ba7d6034990be1fa6f12736c3eaa19b428ff2e806bd73c98557a19fa8396a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Security for pyuploader-cx 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.