{"id":15441088,"url":"https://github.com/15r10nk/pysource-minimize","last_synced_at":"2025-04-13T05:35:02.262Z","repository":{"id":65732523,"uuid":"571794703","full_name":"15r10nk/pysource-minimize","owner":"15r10nk","description":"minimize python source code to find bugs more easily ","archived":false,"fork":false,"pushed_at":"2024-10-15T04:18:09.000Z","size":820,"stargazers_count":30,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-20T12:35:07.713Z","etag":null,"topics":["code-generation","codegenerator","python","testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/15r10nk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"15r10nk"}},"created_at":"2022-11-28T22:36:12.000Z","updated_at":"2024-10-20T04:43:18.000Z","dependencies_parsed_at":"2023-11-12T17:52:51.397Z","dependency_job_id":"533bfe04-3875-4c6a-8b7b-d9fb9ea82785","html_url":"https://github.com/15r10nk/pysource-minimize","commit_stats":{"total_commits":74,"total_committers":4,"mean_commits":18.5,"dds":0.09459459459459463,"last_synced_commit":"7a619a26ebcea4d068d6b7daefb93e2e2c8d97dc"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/15r10nk%2Fpysource-minimize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/15r10nk%2Fpysource-minimize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/15r10nk%2Fpysource-minimize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/15r10nk%2Fpysource-minimize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/15r10nk","download_url":"https://codeload.github.com/15r10nk/pysource-minimize/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248670513,"owners_count":21142896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generation","codegenerator","python","testing"],"created_at":"2024-10-01T19:16:31.614Z","updated_at":"2025-04-13T05:35:02.231Z","avatar_url":"https://github.com/15r10nk.png","language":"Python","funding_links":["https://github.com/sponsors/15r10nk"],"categories":[],"sub_categories":[],"readme":"[![pypi version](https://img.shields.io/pypi/v/pysource-minimize.svg)](https://pypi.org/project/pysource-minimize/)\n![Python Versions](https://img.shields.io/pypi/pyversions/pysource-minimize)\n![PyPI - Downloads](https://img.shields.io/pypi/dw/pysource-minimize)\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/15r10nk)](https://github.com/sponsors/15r10nk)\n\n# pysource-minimize\n\nIf 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.\n\n`pysource_minimize` is able to remove everything from the python source which is not related to the problem.\n\n## CLI\n\nYou can use `pysource-minimize` from the command line like follow:\n\n```bash\npysource-minimize --file bug.py --track \"Assertion\" -- python bug.py\n```\n\nThis will run `python bug.py` and try to find the string \"Assertion\" in the output.\nThe `--file bug.py` gets minimized as long as \"Assertion\" is part of the output of the command.\n\n\u003e [!WARNING]\n\u003e Be careful when you execute code which gets minimized.\n\u003e It might be that some combination of the code you minimize erases your hard drive\n\u003e or does other unintended things.\n\n![example](example.gif)\n\n\n\n## API\nExample:\n``` pycon\n\u003e\u003e\u003e from pysource_minimize import minimize\n\n\u003e\u003e\u003e source = \"\"\"\n... def f():\n...     print(\"bug\"+\"other string\")\n...     return 1+1\n... f()\n... \"\"\"\n\n\u003e\u003e\u003e print(minimize(source, lambda new_source: \"bug\" in new_source))\n\"\"\"bug\"\"\"\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F15r10nk%2Fpysource-minimize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F15r10nk%2Fpysource-minimize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F15r10nk%2Fpysource-minimize/lists"}