minimize python source code
Project description
pysource-minimize
If you build a linter, formatter or any other tool which has to analyse python source code you might end up searching bugs in pretty large input files.
pysource_minimize is able to remove everything from the python source which is not related to the problem.
CLI
You can use pysource-minimize from the command line like follow:
pysource-minimize --file bug.py --track "Assertion" -- python bug.py
This will run python bug.py and try to find the string "Assertion" in the output.
The --file bug.py gets minimized as long as "Assertion" is part of the output of the command.
[!WARNING] Be careful when you execute code which gets minimized. It might be that some combination of the code you minimize erases your hard drive or does other unintended things.
API
Example:
>>> from pysource_minimize import minimize
>>> source = """
... def f():
... print("bug"+"other string")
... return 1+1
... f()
... """
>>> print(minimize(source, lambda new_source: "bug" in new_source))
"""bug"""
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 pysource_minimize-0.8.0.tar.gz.
File metadata
- Download URL: pysource_minimize-0.8.0.tar.gz
- Upload date:
- Size: 715.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9a88c68717891dc7dc74beab769ef4c2e397599e1620b2046b89783fb500652
|
|
| MD5 |
4ca1a8d3a5de5c8a6d7da7cae21de012
|
|
| BLAKE2b-256 |
90d36786a52121987875b2e9d273399504e2bdb868e7b80b603ecb29c900846f
|
Provenance
The following attestation bundles were made for pysource_minimize-0.8.0.tar.gz:
Publisher:
ci.yml on 15r10nk/pysource-minimize
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysource_minimize-0.8.0.tar.gz -
Subject digest:
e9a88c68717891dc7dc74beab769ef4c2e397599e1620b2046b89783fb500652 - Sigstore transparency entry: 197924477
- Sigstore integration time:
-
Permalink:
15r10nk/pysource-minimize@508d428e44ca8bdc47f1e4762dc727db6e773638 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/15r10nk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@508d428e44ca8bdc47f1e4762dc727db6e773638 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pysource_minimize-0.8.0-py3-none-any.whl.
File metadata
- Download URL: pysource_minimize-0.8.0-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edee433c24a2e8f81701aa7e01ba4c1e63f481f683dd3a561610762bc03ed6c3
|
|
| MD5 |
a0f8fc3e0429a730befb6ecd99308615
|
|
| BLAKE2b-256 |
4a7d4e9ed2a376bb7372d74fdec557f35f70c2bf5373f2c67e05535555d0a6d4
|
Provenance
The following attestation bundles were made for pysource_minimize-0.8.0-py3-none-any.whl:
Publisher:
ci.yml on 15r10nk/pysource-minimize
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pysource_minimize-0.8.0-py3-none-any.whl -
Subject digest:
edee433c24a2e8f81701aa7e01ba4c1e63f481f683dd3a561610762bc03ed6c3 - Sigstore transparency entry: 197924483
- Sigstore integration time:
-
Permalink:
15r10nk/pysource-minimize@508d428e44ca8bdc47f1e4762dc727db6e773638 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/15r10nk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@508d428e44ca8bdc47f1e4762dc727db6e773638 -
Trigger Event:
push
-
Statement type: