Python bytecode compiler and PyPI publishing toolkit for monorepos
Project description
sage-pypi-publisher
A tiny toolkit to compile Python packages to bytecode, build wheels, and publish to PyPI/TestPyPI. Extracted from SAGE's internal sage-dev tooling and made standalone.
Features
- Copy a package tree and compile
.py→.pyc(keeps__init__.pyand_version.py). - Auto-adjust
pyproject.toml/MANIFEST.into include compiled artifacts and binary extensions. - Build wheels with
python -m build. - Upload via
twine(with--dry-runby default). - Simple Typer-based CLI.
Installation
pip install .
# or
pip install sage-pypi-publisher
CLI
sage-pypi-publisher --help
# Compile only
sage-pypi-publisher compile /path/to/pkg -o /tmp/out
# Compile + build
sage-pypi-publisher build /path/to/pkg -o /tmp/out
# Compile + build + upload to TestPyPI
sage-pypi-publisher build /path/to/pkg -o /tmp/out -u -r testpypi --no-dry-run
# Upload an existing wheel
sage-pypi-publisher upload dist/yourpkg-0.1.0-py3-none-any.whl -r pypi --no-dry-run
Python API
from pathlib import Path
from pypi_publisher.compiler import BytecodeCompiler
compiler = BytecodeCompiler(Path("/path/to/pkg"))
compiled = compiler.compile_package()
wheel = compiler.build_wheel(compiled)
compiler.upload_wheel(wheel, repository="testpypi", dry_run=True)
Git Hooks
sage-pypi-publisher provides intelligent git hooks to simplify version management and PyPI publishing.
Installation
sage-pypi-publisher install-hooks .
Features
- Auto-detection: Detects version changes in
pyproject.tomlon push. - Interactive Update: Prompts to update version if forgotten.
- Auto-Publish: Builds and uploads to PyPI automatically upon confirmation.
- Smart Build: Detects C/C++ extensions for manylinux wheels.
Notes
- Requires
python -m buildandtwineavailable. - No backward compatibility with
sage-devCLI; PyPI commands have been removed from SAGE. - Designed to be monorepo-friendly but works with any package path that contains
pyproject.toml.
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 Distribution
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 isage_pypi_publisher-0.1.8.4.tar.gz.
File metadata
- Download URL: isage_pypi_publisher-0.1.8.4.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63f26575b572bae9ec7427d2dba454d1ea4ece25d7e63bba365efb70e5e9904c
|
|
| MD5 |
36a20c05d537dcd4c8b314152e70c9b4
|
|
| BLAKE2b-256 |
f8cb0685caefb621735f0424e576cb176074d71dc6ca1d006847d0c6da649d74
|
File details
Details for the file isage_pypi_publisher-0.1.8.4-py3-none-any.whl.
File metadata
- Download URL: isage_pypi_publisher-0.1.8.4-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbde8111c53b42b0791374f8c652e14ae1462e36f01c90169b70cea7f59d9511
|
|
| MD5 |
e594e8f9f9b07b28034664c71ad434f2
|
|
| BLAKE2b-256 |
cbbbb67721b8f75f1d53a7c6ab7846b6c2dbb256d02be8717691154eb52459c3
|