Name | hatch-pyz JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | Hatch plugin for building python zip applications |
upload_time | 2024-10-25 17:26:01 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | None |
keywords |
hatch
plugin
pyz
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Hatch PYZ Plugin
This [Hatch](https://hatch.pypa.io/latest/) plugin provides a custom builder for creating
Python [zip applications](https://docs.python.org/3/library/zipapp.html) (zipapps). This is useful for distributing
Python applications as single-file executables, simplifying deployment and distribution.
The plugin generates a zipapp with all the contents bundled into a single executable file. By default, the generated
zipapp includes all necessary dependencies and can be configured to run a specified entry point.
## Features
- **Single-file Executable**: Combines your application and dependencies into a single zip file.
- **Customizable Entry Point**: Specify the main module or script to be executed.
- **Bundled Dependencies**: Include all necessary Python dependencies within your zipapp
## Example
Here’s an example project directory:
```
.
├── pyproject.toml
├── LICENSE.txt
├── README.md
├── src
│ ├── my_module
│ │ ├── __init__.py
│ │ └── main.py
└── tests
└── test_main.py
```
And a `pyproject.toml` file that looks like this:
```toml
[build-system]
requires = [
"hatchling",
"hatch-pyz",
]
build-backend = "hatchling.build"
[project]
name = "my-python-app"
version = "1.0.0"
[tool.hatch.build.targets.pyz]
interpreter = "/usr/bin/env python3"
main = "my_module.main:main"
compressed = true
```
To build the zipapp, run:
```sh
hatch build --target pyz
```
This command will create an executable zipapp named `dist/my_python_app-1.0.0.pyz`.
## Usage
You can run the generated zipapp directly:
```sh
python dist/my_python_app-1.0.0.pyz
```
## Options
| Option | Type | Requirement | Default | Description |
|-----------------------|--------|-------------|------------------------|--------------------------------------------------------------------------------------------------|
| `main` | `str` | Required | | Zipapp entry-point in the format "pkg.mod:func" |
| `interpreter` | `str` | Optional | `/usr/bin/env python3` | Sets the python interpreter shebang for the archive |
| `compressed` | `bool` | Optional | `true` | If true, files are compressed with the deflate method; otherwise, files are stored uncompressed. |
| `bundle-dependencies` | `bool` | Optional | `true` | if true, pure-python dependencies are bundled in the zipapp archive |
## Reproducible Builds
The plugin supports reproducible builds by ensuring consistent metadata and timestamps within the zipapp. This is useful
for verifying that builds produced in different environments are identical. You can control the timestamp used for
reproducible builds via the `SOURCE_DATE_EPOCH` environment variable.
For more details, refer to Hatch’s [Build Configuration](https://hatch.pypa.io/latest/config/build/) documentation.
Raw data
{
"_id": null,
"home_page": null,
"name": "hatch-pyz",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "hatch, plugin, pyz",
"author": null,
"author_email": "Daniel Copley <djcopley@proton.me>",
"download_url": "https://files.pythonhosted.org/packages/d1/d9/991cef22204a85de51225f0422acb10b86ada93601a483c9bd44d17e8239/hatch_pyz-0.3.0.tar.gz",
"platform": null,
"description": "# Hatch PYZ Plugin\n\nThis [Hatch](https://hatch.pypa.io/latest/) plugin provides a custom builder for creating\nPython [zip applications](https://docs.python.org/3/library/zipapp.html) (zipapps). This is useful for distributing\nPython applications as single-file executables, simplifying deployment and distribution.\n\nThe plugin generates a zipapp with all the contents bundled into a single executable file. By default, the generated\nzipapp includes all necessary dependencies and can be configured to run a specified entry point.\n\n## Features\n\n- **Single-file Executable**: Combines your application and dependencies into a single zip file.\n- **Customizable Entry Point**: Specify the main module or script to be executed.\n- **Bundled Dependencies**: Include all necessary Python dependencies within your zipapp\n\n## Example\n\nHere\u2019s an example project directory:\n\n```\n.\n\u251c\u2500\u2500 pyproject.toml\n\u251c\u2500\u2500 LICENSE.txt\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 src\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 my_module\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 main.py\n\u2514\u2500\u2500 tests\n \u2514\u2500\u2500 test_main.py\n```\n\nAnd a `pyproject.toml` file that looks like this:\n\n```toml\n[build-system]\nrequires = [\n \"hatchling\",\n \"hatch-pyz\",\n]\nbuild-backend = \"hatchling.build\"\n\n[project]\nname = \"my-python-app\"\nversion = \"1.0.0\"\n\n[tool.hatch.build.targets.pyz]\ninterpreter = \"/usr/bin/env python3\"\nmain = \"my_module.main:main\"\ncompressed = true\n```\n\nTo build the zipapp, run:\n\n```sh\nhatch build --target pyz\n```\n\nThis command will create an executable zipapp named `dist/my_python_app-1.0.0.pyz`.\n\n## Usage\n\nYou can run the generated zipapp directly:\n\n```sh\npython dist/my_python_app-1.0.0.pyz\n```\n\n## Options\n\n| Option | Type | Requirement | Default | Description |\n|-----------------------|--------|-------------|------------------------|--------------------------------------------------------------------------------------------------|\n| `main` | `str` | Required | | Zipapp entry-point in the format \"pkg.mod:func\" |\n| `interpreter` | `str` | Optional | `/usr/bin/env python3` | Sets the python interpreter shebang for the archive |\n| `compressed` | `bool` | Optional | `true` | If true, files are compressed with the deflate method; otherwise, files are stored uncompressed. |\n| `bundle-dependencies` | `bool` | Optional | `true` | if true, pure-python dependencies are bundled in the zipapp archive |\n\n## Reproducible Builds\n\nThe plugin supports reproducible builds by ensuring consistent metadata and timestamps within the zipapp. This is useful\nfor verifying that builds produced in different environments are identical. You can control the timestamp used for\nreproducible builds via the `SOURCE_DATE_EPOCH` environment variable.\n\nFor more details, refer to Hatch\u2019s [Build Configuration](https://hatch.pypa.io/latest/config/build/) documentation.",
"bugtrack_url": null,
"license": null,
"summary": "Hatch plugin for building python zip applications",
"version": "0.3.0",
"project_urls": {
"Homepage": "https://github.com/djcopley/hatch-pyz",
"Issues": "https://github.com/djcopley/hatch-pyz/issues",
"Repository": "https://github.com/djcopley/hatch-pyz.git"
},
"split_keywords": [
"hatch",
" plugin",
" pyz"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "19b0366ed48bcd1df680ffa6414d7a14738eea986165616869d187b02474cba1",
"md5": "c452898e38c9ebad150a328924dba947",
"sha256": "6a941a54777a5dbbf6af3169e0076373bc219322be457ee395d765edf7df45e5"
},
"downloads": -1,
"filename": "hatch_pyz-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c452898e38c9ebad150a328924dba947",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 19609,
"upload_time": "2024-10-25T17:26:00",
"upload_time_iso_8601": "2024-10-25T17:26:00.818718Z",
"url": "https://files.pythonhosted.org/packages/19/b0/366ed48bcd1df680ffa6414d7a14738eea986165616869d187b02474cba1/hatch_pyz-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d1d9991cef22204a85de51225f0422acb10b86ada93601a483c9bd44d17e8239",
"md5": "28212164a461771253a8080a26030701",
"sha256": "1d85eb8dd1767651b9a581d4d66a83b928894597db1a04423058186ca0fabb4a"
},
"downloads": -1,
"filename": "hatch_pyz-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "28212164a461771253a8080a26030701",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 21735,
"upload_time": "2024-10-25T17:26:01",
"upload_time_iso_8601": "2024-10-25T17:26:01.801513Z",
"url": "https://files.pythonhosted.org/packages/d1/d9/991cef22204a85de51225f0422acb10b86ada93601a483c9bd44d17e8239/hatch_pyz-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-25 17:26:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "djcopley",
"github_project": "hatch-pyz",
"github_not_found": true,
"lcname": "hatch-pyz"
}