{"id":24918150,"url":"https://github.com/zabackary/python-combiner","last_synced_at":"2026-02-10T23:31:22.620Z","repository":{"id":219946964,"uuid":"750198873","full_name":"zabackary/python-combiner","owner":"zabackary","description":"Smoosh Python modules into one big one.","archived":false,"fork":false,"pushed_at":"2025-02-22T14:43:04.000Z","size":227,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-07T05:20:36.176Z","etag":null,"topics":["ast","bundler","cli","compiler","python3"],"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/zabackary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"zenodo":null}},"created_at":"2024-01-30T07:11:34.000Z","updated_at":"2025-02-22T14:43:08.000Z","dependencies_parsed_at":"2025-02-01T12:46:27.974Z","dependency_job_id":"0c320ae4-d4be-427c-8d9c-f84215c1cb87","html_url":"https://github.com/zabackary/python-combiner","commit_stats":null,"previous_names":["zabackary/python-compiler","zabackary/python-combiner"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/zabackary/python-combiner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabackary%2Fpython-combiner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabackary%2Fpython-combiner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabackary%2Fpython-combiner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabackary%2Fpython-combiner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zabackary","download_url":"https://codeload.github.com/zabackary/python-combiner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zabackary%2Fpython-combiner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29321332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-10T20:44:44.282Z","status":"ssl_error","status_checked_at":"2026-02-10T20:44:43.393Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ast","bundler","cli","compiler","python3"],"created_at":"2025-02-02T09:18:47.570Z","updated_at":"2026-02-10T23:31:22.402Z","avatar_url":"https://github.com/zabackary.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `python-combiner`\n\n\u003e A command-line tool to compile Python files into one ginormous one, with\n\u003e plugin support and more.\n\n## Command-line usage\n\nI think you can install it with `pip` since it's on PyPi, but no promises.\n\n```text\nusage: python-combiner [-h] -i INPUT [-o [OUTPUT]] [--ignore-imports IGNORE_IMPORTS [IGNORE_IMPORTS ...]] [--remove-imports REMOVE_IMPORTS [REMOVE_IMPORTS ...]] [-p PRELUDE]\n                       [-c DEFINE_CONSTANT DEFINE_CONSTANT] [-d DEFINE] [-m | --minify | --no-minify] [-j | --json | --no-json] [-t | --time | --no-time]\n                       [--docstring | --no-docstring] [--module-hash-length MODULE_HASH_LENGTH] [--export-dictionary-mode {dict,munch,class,class_instance}]\n                       [--export-names-mode {locals,static}]\n\nCompiles/merges Python files.\n\noptions:\n  -h, --help            show this help message and exit\n  -i INPUT, --input INPUT\n                        the input file, can be - for stdin\n  -o [OUTPUT], --output [OUTPUT]\n                        the output file. Defaults to stdout\n  --ignore-imports IGNORE_IMPORTS [IGNORE_IMPORTS ...]\n                        modules for which to ignore transforming imports for (i.e., leave them untouched)\n  --remove-imports REMOVE_IMPORTS [REMOVE_IMPORTS ...]\n                        modules for which to remove imports for\n  -p PRELUDE, --prelude PRELUDE\n                        some Python code to insert at the top of the file. must be well-formed parsable Python code\n  -c DEFINE_CONSTANT DEFINE_CONSTANT, --define-constant DEFINE_CONSTANT DEFINE_CONSTANT\n                        defines one compile-time constant as a string. use some name that you're sure won't collide with any in your code, i.e. __MY_CONSTANT__\n  -d DEFINE, --define DEFINE\n                        equivalent to defining a constant to be 1 using --define-constant.\n  -m, --minify, --no-minify\n                        minifies the result\n  -j, --json, --no-json\n                        outputs messages as json\n  -t, --time, --no-time\n                        puts the time at the top of the generated code. --no-time for deterministic builds (default: True)\n  --docstring, --no-docstring\n                        puts a generated docstring at the top of the module. added by default (default: True)\n  --module-hash-length MODULE_HASH_LENGTH\n                        the length of the hash used for making modules unique\n  --export-dictionary-mode {dict,munch,class,class_instance}\n                        the method that export dictionaries are converted to dot-accessible objects\n  --export-names-mode {locals,static}\n                        how module exports are determined. use 'locals' for compatibility with existing code. forced to 'static' if --export-dictionary-mode is set to 'class' or\n                        'class_instance'\n```\n\n## Library usage\n\n```python\nimport python_compiler\n\npython_compiler.Compiler(\n    source=input(),\n    path=\"/path/to/source/file\",\n    options=python_compiler.CompilerOptions(\n        # ... (see docstring)\n        plugins=[\n            # Plugins\n            python_compiler.plugins.MinifyPlugin()\n        ]\n    )\n)\n```\n\nFor more examples, see the [CLI source code](./src/python_combiner/cli.py) for\nexample usage. Note that `path` does not need to be a real path, but it's used\nfor import resolution. The library is mostly documented using docstrings, so\njust read the source code for more help.\n\n## Plugins\n\n### Built-in plugins\n\nBuilt-in plugins can be imported from the `python-compiler.plugins` module. See\nthe docstrings for usage information.\n\n#### MinifyPlugin\n\nUses `python-minifier` to minify the resulting code after bundling is performed.\nThis can reduce the size of the resulting code by a factor of 3 or more,\ndepending on the input.\n\n#### ConstantsPlugin\n\nDynamically replaces variable names with content at compile-time. Similar to\n`#DEFINE`s if you're using the C preprocessor.\n\n#### PreludePlugin\n\nAn easy way to add a snippet of code at the beginning of the output.\n\n### Plugin authoring\n\nPlugins must inherit from [the base `Plugin` class](./src/plugin/plugin.py). An\nexample plugin might go something like this:\n\n```python\nclass MyPlugin(python_compiler.plugin.Plugin):\n    def hook_module(self, path, module):\n        module = my_transformation(module)\n        return module\n```\n\nThere are a couple available hooks as of this writing:\n\n- `hook_module`  \n  A hook run before name translation is performed and modules are bundled\n- `hook_module_post_transform`  \n  A hook run after name translation is performed but before modules are bundled\n- `hook_import`  \n  A hook run on all imports a module imports\n- `hook_import_resolution`  \n  A hook run during the module resolution step. It can be used to define\n  \"virtual modules\".\n- `hook_output`  \n  A hook called just prior to the end of code generation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzabackary%2Fpython-combiner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzabackary%2Fpython-combiner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzabackary%2Fpython-combiner/lists"}