pymini
pymini minifies Python source code by simplifying syntax, shortening identifiers, and stripping unnecessary whitespace. Its primary multi-file workflow preserves package structure; one-file bundling is available as an explicit opt-in.
Status
This project is maintained as an AST-based minifier for Python 3.9+ code. It is best suited to scripts and small module graphs that use straightforward imports such as from module import name.
Installation
python3 -m pip install pymini
CLI
Package mode is the default and preserves the package tree:
pymini package src -o out
Legacy invocation without an explicit mode still defaults to package:
pymini src -o out
By default, pymini preserves module paths and public globals. When possible, it keeps the public surface stable by emitting aliases while still shortening internal names. To trade API stability for more aggressive compression:
pymini package src --rename-global-variables -o out
Bundle mode emits a single file and is better suited to app-style graphs than libraries:
pymini bundle src -o out/bundle.py
The legacy --single-file flag is still accepted as a compatibility alias for bundle mode.
Python API
from pymini import minify
sources, modules = minify(
[
"def square(x):\n return x ** 2\n",
"from main import square\nprint(square(3))\n",
],
["main", "side"],
)
Development
Install development dependencies and run the test suite:
python3 -m pip install -e ".[dev]"
python3 -m pytest
Metadata
Release files for pymini 0.1.2
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 |
|---|---|---|---|---|
| pymini-0.1.2.tar.gz | 18.9 kB | Without provenance | Details for pymini-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pymini-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for pymini-0.1.2-py3-none-any.whl |
Total release size: 35.7 kB
Release files / pymini-0.1.2.tar.gz
| Download URL | pymini-0.1.2.tar.gz |
|---|---|
| Size | 18.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e79f3a7ca563353151120b28e86cfa57e7ec2b9ab53b2e43564b86b681d1432
|
|
BLAKE2b-256 checksum How to use checksums |
bcb73da87214a60ace803988876bf9c5205861912c3a89b6cc3977c4edd8efaf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Release files / pymini-0.1.2-py3-none-any.whl
| Download URL | pymini-0.1.2-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f712cce605e0143dbf91895e95a7bd16eb55a7fda20121d7337819ab739ffb1
|
|
BLAKE2b-256 checksum How to use checksums |
2a2310bb8c0c2a7e26461558d095f442e507c6e0709b53151745385b67a21605
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.3
|
Security for pymini 0.1.2
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.