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.
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
File details
Details for the file pysource_minimize-0.4.0.tar.gz
.
File metadata
- Download URL: pysource_minimize-0.4.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.0 Linux/5.10.0-25-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd3eac0c3594174c34f0917071a564c074c017cbfc0138cda637efc6b79951f3 |
|
MD5 | 3de60150ac6885b37092e69217590381 |
|
BLAKE2b-256 | 90806b136195def49db4d8738d6a1ec5802e1fde737a8b14cf1fe7f503668e30 |
File details
Details for the file pysource_minimize-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: pysource_minimize-0.4.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.11.0 Linux/5.10.0-25-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2d3ae2803ed87c9664098956b97a431f54cdd5b584a6589b532fe2fa8be8f8f |
|
MD5 | b5f9d92f6c5e96ddacd0c72c99fa3d41 |
|
BLAKE2b-256 | a539cf29d05bae0fdd06d0cc95306b5b016222ceb58afb6ebe2a99b514d7cd73 |