Skip to main content

Shimify

Shimify is a source-level Python dependency reducer. It aims to explain what an application imports and produce an auditable source directory containing the implementation needed by its supported import graph.

Version 0.3 adds bounded cross-module callable and whole-class extraction, explicit package text resources and version queries, and opt-in runtime import evidence. Lexical reports, same-module extraction and unchanged-module bundles remain available. Native slicing and automatic resource discovery remain later work.

Requires Python 3.14 or newer. There are no runtime dependencies.

The 0.3.0 release is experimental and uses the MIT license:

python -m pip install shimify==0.3.0
shimify --help

See release notes for supported behavior and limitations. For development and the acceptance pilot, use a checkout:

uv sync --locked
uv run shimify --help
uv run shimify --version
uv run shimify explain path/to/app.py
uv run shimify explain path/to/app.py --json --search-path path/to/src
uv run shimify modules path/to/app.py --output path/outside/source/roots
uv run shimify symbols examples/checksums.py:checksum --json
uv run shimify extract examples/checksums.py:checksum --output build/checksum
uv run shimify runtime examples/version_info.py --json
python -I -S path/outside/source/roots/run.py
uv run python -m unittest discover -s tests -v
uv build

See the forward implementation plan for smaller application-specific bundles and the coordinated compiler/interpreter roadmap. The 0.2 plan retains the released extraction contract. The GitHub Project and its linked issues track scope, acceptance criteria, and current work.

Published GitHub releases use tags such as v0.1.0; the tag must match package metadata before the pypi environment can upload the tested distributions.

explain reads sources without importing the target application or its packages. It includes all static imports, even those in conditional branches. JSON output contains module paths and hashes, import edges with inclusion reasons, and stable diagnostic codes. Exit status is 0 for a supported static graph, 1 for analysis diagnostics, and 2 for invalid input. A supported graph is not proof that arbitrary runtime reflection or resource use has been discovered.

modules emits unchanged reachable sources under _sources/, run.py, LICENSES/, and SHIMIFY-MANIFEST.json. Run the launcher with -I -S to exclude environment paths and site packages. Target code is never executed by analysis or generation. Output must be a new directory outside all included import roots; existing files and overlapping sources are refused. Bundling refusals return 1, and invalid inputs or filesystem errors return 2.

Sources in the interpreter's ordinary installed-package directories require distribution file records. Sources supplied through --search-path are treated as application code unless matching distribution records identify their owner. The manifest preserves source hashes, import reasons, distribution metadata, and available license/notice files. Missing declared third-party license files or an installation with no license text block output. Local application notices are copied when found in the included roots/package directories. Review the original licensing obligations before redistributing an artifact.

Recognized dynamic imports, package resources, runtime metadata, native extensions, namespace packages, wildcard imports, import-path mutations, and file-relative behavior are unsupported. Conditional and type-checking imports remain included. Sources shadowing standard library module names are rejected by bundling because the launcher uses standard library modules itself.

Real-package example

The acceptance pilot uses the pinned pure-Python packaging==25.0 wheel. Install it into an explicit build-only directory, explain the example, and bundle it:

uv pip install --python 3.14 --target build/pilot --no-deps --only-binary :all: --require-hashes -r tests/pilot-requirements.txt
uv run shimify explain examples/version_info.py --search-path build/pilot
uv run shimify modules examples/version_info.py --search-path build/pilot --output build/version-info
python -I -S build/version-info/run.py 1.0rc1 1.0 invalid

This use case includes 3 of the dependency's 16 Python modules: 18,601 of 221,406 source bytes. The bundle also contains the application script, launcher, manifest, raw distribution metadata, and all three upstream license files. These counts describe this pinned fixture's module reachability, not arbitrary function-level reduction or total artifact size.

Run its differential acceptance test locally with:

SHIMIFY_PILOT_PATH=build/pilot uv run python -m unittest discover -s tests -v
uv build
uv run python scripts/check_wheel.py

On PowerShell, set $env:SHIMIFY_PILOT_PATH = "build/pilot" before running tests. Without this explicit fixture path, the real-package test is skipped; synthetic tests remain available offline. CI always installs the hashed fixture and runs the complete suite and isolated wheel smoke test on Linux, macOS, and Windows.

Development source measurements compare the text_metrics callable and pinned packaging pilot with complete artifact overhead, cold/warm execution and separately measured memory.

The opt-in class extraction profile keeps whole plain class units and approved builtin method descriptors. Custom inheritance and method elimination remain separately gated.

Metadata

Release files for shimify 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shimify 0.3.0
File Size Uploaded Provenance Actions
shimify-0.3.0.tar.gz 29.1 kB With provenance Details for shimify-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shimify 0.3.0
File Interpreter ABI Platform Actions
shimify-0.3.0-py3-none-any.whl Python 3 none any Details for shimify-0.3.0-py3-none-any.whl

Total release size: 67.7 kB

Release files / shimify-0.3.0.tar.gz

Download URL shimify-0.3.0.tar.gz
Size 29.1 kB
Tags Source
SHA-256 checksum
How to use checksums
db86a499cfdbd1fc9003b71f9119a05c587464bdf8152d859945a54b35e205ed
BLAKE2b-256 checksum
How to use checksums
d20954cc44cad8d33f0eebc26c80c66b7f8f7b895f65e4a50e0553b52ddcc1ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / shimify-0.3.0-py3-none-any.whl

Download URL shimify-0.3.0-py3-none-any.whl
Size 38.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1b6dd014e85e885f792ccf4b6da4d93226622a577783632c65631a048ab19da
BLAKE2b-256 checksum
How to use checksums
9e40e1195e82d6594c5c84db19e6e5bf0dc8f6bfc6f3aaab9574da733c5ef6f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for shimify 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for shimify-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page