python-bundler


Namepython-bundler JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2025-01-23 17:52:40
maintainerNone
docs_urlNone
authorZach Taira
requires_python<4.0.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Bundler (experimental)

This repo creates executable zipfiles similar to
[zipapp](https://docs.python.org/3/library/zipapp.html),
[pex](https://docs.pex-tool.org/index.html),
and 
[shiv](https://github.com/linkedin/shiv).

It's useful when one:
- Wants to create compiled packages from a lockfile
- Wants to be able to debug the resulting environment without unzipping
- Doesn't mind an initial startup cost to create the virtualenv
- Wants to use mostly python tooling instead of rejiggering everything to e.g.
  Bazel

It does not solve some of the core problems with python and its packaging, such
as:
- Some python packages will not work on different python versions,
  architectures, etc
- Python takes up a lot of space relative to its functionality
- Python is duck-typed at runtime

## Alternatives:
| Package Name                                                                  | Is publicly supported                                    | Requires different directory structure | Installs all dependencies automatically                                                                         | Easy to debug                              |
| ---                                                                           | ---                                                      | ---                                    | ---                                                                                                             | ---                                        |
| [zipapp](https://docs.python.org/3/library/zipapp.html)                       | yes, included with python                                | Maybe, must have `__main__.py`         | No, they must be manually included via `pip install -r requirements.txt --target <directory>` before build time | No, must unzip the file to edit            |
| [pex](https://docs.pex-tool.org/index.html)                                   | yes, large project                                       | No, works on console scripts           | Can specify requirements.txt manually at build time                                                             | No, must unzip the file to edit            |
| [shiv](https://github.com/linkedin/shiv)                                      | yes, past 1.0.0, by linkedin                             | No, works on console scripts           | No, must specify the dependencies on the command line at build time                                             | No, must unzip the file to edit            |
| this repo                                                                     | no                                                       | No, works on console scripts           | Yes, uses poetry lockfile                                                                                       | Yes, can edit the installation venv        |
| [bazel](https://rules-python.readthedocs.io/en/latest/pypi-dependencies.html) | yes, but many modern-python conveniences have a time lag | Yes                                    | One can wire it up with requirements.txt                                                                        | No, but it can made to be with some effort |

## Rough Comparisons:
| Package Name                                                                  | Runtime                               | Command                                                                     | English definition                                                                                                      | Size |
| ---                                                                           | ---                                   | ---                                                                         | ---                                                                                                                     | ---  |
| [zipapp](https://docs.python.org/3/library/zipapp.html)                       | 1.9-2.5s                              | `pip install . --target python_bundler && python -m zipapp python_bundler/` | Install the current package to the target directory, then make a zipapp out of said directory                           | 48M  |
| [pex](https://docs.pex-tool.org/index.html)                                   | 5s for the first run, then 3.2-3.5s   | `pex '.' --console-script python_bundler --output project_bundle.pex`       | Make a pex env containing the current package, then make an executable pexfile out of the python_bundler console script | 21M  |
| [shiv](https://github.com/linkedin/shiv)                                      | 2.5s for the first run, then 0.6-0.8s | `shiv -c python_bundler -o python_bundler.shiv '.'`                         | Make a shiv file using python_bundler console script. Install the current directory.                                    | 20M  |
| this repo                                                                     | 11s for the first run, then 0.6-0.7s  | `python_bundler python_bundler`                                             | Use the current directory's lockfile to create an executable zipfile from the python_bundler console script             | 16M  |
| [bazel](https://rules-python.readthedocs.io/en/latest/pypi-dependencies.html) | n/a                                   | n/a                                                                         | n/a                                                                                                                     | n/a  |


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "python-bundler",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Zach Taira",
    "author_email": "zach.taira@gmail.com",
    "download_url": null,
    "platform": null,
    "description": "# Python Bundler (experimental)\n\nThis repo creates executable zipfiles similar to\n[zipapp](https://docs.python.org/3/library/zipapp.html),\n[pex](https://docs.pex-tool.org/index.html),\nand \n[shiv](https://github.com/linkedin/shiv).\n\nIt's useful when one:\n- Wants to create compiled packages from a lockfile\n- Wants to be able to debug the resulting environment without unzipping\n- Doesn't mind an initial startup cost to create the virtualenv\n- Wants to use mostly python tooling instead of rejiggering everything to e.g.\n  Bazel\n\nIt does not solve some of the core problems with python and its packaging, such\nas:\n- Some python packages will not work on different python versions,\n  architectures, etc\n- Python takes up a lot of space relative to its functionality\n- Python is duck-typed at runtime\n\n## Alternatives:\n| Package Name                                                                  | Is publicly supported                                    | Requires different directory structure | Installs all dependencies automatically                                                                         | Easy to debug                              |\n| ---                                                                           | ---                                                      | ---                                    | ---                                                                                                             | ---                                        |\n| [zipapp](https://docs.python.org/3/library/zipapp.html)                       | yes, included with python                                | Maybe, must have `__main__.py`         | No, they must be manually included via `pip install -r requirements.txt --target <directory>` before build time | No, must unzip the file to edit            |\n| [pex](https://docs.pex-tool.org/index.html)                                   | yes, large project                                       | No, works on console scripts           | Can specify requirements.txt manually at build time                                                             | No, must unzip the file to edit            |\n| [shiv](https://github.com/linkedin/shiv)                                      | yes, past 1.0.0, by linkedin                             | No, works on console scripts           | No, must specify the dependencies on the command line at build time                                             | No, must unzip the file to edit            |\n| this repo                                                                     | no                                                       | No, works on console scripts           | Yes, uses poetry lockfile                                                                                       | Yes, can edit the installation venv        |\n| [bazel](https://rules-python.readthedocs.io/en/latest/pypi-dependencies.html) | yes, but many modern-python conveniences have a time lag | Yes                                    | One can wire it up with requirements.txt                                                                        | No, but it can made to be with some effort |\n\n## Rough Comparisons:\n| Package Name                                                                  | Runtime                               | Command                                                                     | English definition                                                                                                      | Size |\n| ---                                                                           | ---                                   | ---                                                                         | ---                                                                                                                     | ---  |\n| [zipapp](https://docs.python.org/3/library/zipapp.html)                       | 1.9-2.5s                              | `pip install . --target python_bundler && python -m zipapp python_bundler/` | Install the current package to the target directory, then make a zipapp out of said directory                           | 48M  |\n| [pex](https://docs.pex-tool.org/index.html)                                   | 5s for the first run, then 3.2-3.5s   | `pex '.' --console-script python_bundler --output project_bundle.pex`       | Make a pex env containing the current package, then make an executable pexfile out of the python_bundler console script | 21M  |\n| [shiv](https://github.com/linkedin/shiv)                                      | 2.5s for the first run, then 0.6-0.8s | `shiv -c python_bundler -o python_bundler.shiv '.'`                         | Make a shiv file using python_bundler console script. Install the current directory.                                    | 20M  |\n| this repo                                                                     | 11s for the first run, then 0.6-0.7s  | `python_bundler python_bundler`                                             | Use the current directory's lockfile to create an executable zipfile from the python_bundler console script             | 16M  |\n| [bazel](https://rules-python.readthedocs.io/en/latest/pypi-dependencies.html) | n/a                                   | n/a                                                                         | n/a                                                                                                                     | n/a  |\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.3.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a52151adf54a33c5a653b97da7b73e91d0563a27ba364b7cf13d1e3502336847",
                "md5": "6815459812e0f22f930867a0f6ee2d19",
                "sha256": "af18dfd038658711b2ef6e870f23200315e042d11273f84906e13b7e0e0dc52f"
            },
            "downloads": -1,
            "filename": "python_bundler-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6815459812e0f22f930867a0f6ee2d19",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.9",
            "size": 19944,
            "upload_time": "2025-01-23T17:52:40",
            "upload_time_iso_8601": "2025-01-23T17:52:40.867556Z",
            "url": "https://files.pythonhosted.org/packages/a5/21/51adf54a33c5a653b97da7b73e91d0563a27ba364b7cf13d1e3502336847/python_bundler-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-23 17:52:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "python-bundler"
}
        
Elapsed time: 1.16392s