Skip to main content

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__.py and _version.py).
  • Auto-adjust pyproject.toml / MANIFEST.in to include compiled artifacts and binary extensions.
  • Build wheels with python -m build.
  • Upload via twine (with --dry-run by 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.toml on 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 build and twine available.
  • No backward compatibility with sage-dev CLI; PyPI commands have been removed from SAGE.
  • Designed to be monorepo-friendly but works with any package path that contains pyproject.toml.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isage_pypi_publisher-0.1.8.2.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

isage_pypi_publisher-0.1.8.2-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file isage_pypi_publisher-0.1.8.2.tar.gz.

File metadata

  • Download URL: isage_pypi_publisher-0.1.8.2.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for isage_pypi_publisher-0.1.8.2.tar.gz
Algorithm Hash digest
SHA256 28d4c78adedc9189d0b562357bb72cb81cf8d09eb06df03360601ea719b061e7
MD5 927c69d7c1a1a73cda469b04e447aa08
BLAKE2b-256 81c0b2e390df584f14048433b46cfe5e31d88e64f6b4374d246396663f973227

See more details on using hashes here.

File details

Details for the file isage_pypi_publisher-0.1.8.2-py3-none-any.whl.

File metadata

File hashes

Hashes for isage_pypi_publisher-0.1.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 91708dfa62f5802cef011dea6c66a2b22e3db19e2c6da81a2d9a4ec04007622f
MD5 f51fd6346119ce387b9b0c975a4aa265
BLAKE2b-256 d85a7c4bf4b86f252aca1a8b11b63bbb1767d8bd70617d8728bbdc8303e4be94

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page