hatch-zipped-directory
This is a Hatch plugin that provides a custom builder to support building zip archives for quasi-manual installation into various foreign package installation systems. (Specifically, I use this for packaging Inkscape extensions and symbols libraries, but it may be useful in other contexts, such as deploying to cloud compute platforms.)
The builder creates a zip archive. All the contents of the zip
archive will be included under a single specific top-level directory.
The default name of the top-level directory is a file-name-safe
version of the project name, however the name of the directory may be
configured by setting the install-name key in the target-specific
configuration section.
This behavior may be disabled by setting install-name = ''.
In addition to whatever files are selected for inclusion in the archive via Hatch’s regular build configuration settings, any configured project README and license files will be included in the top level of the install directory within the zip archive.
As well, a METADATA.json file containing the project metadata in
JSON format (as described in
PEP 566)
will be included in the top level of the install directory within the
zip archive.
Example
Assume a project source directory looking something like:
.
├── pyproject.toml
├── LICENSE.txt
├── README.md
├── src
│ ├── subdir
│ │ ├── data.txt
│ │ └── more-code.py
│ └── my-code.py
└── tests
└── test_foo.py
Where pyproject.toml looks like:
[build-system]
requires = [
"hatchling",
"hatch-zipped-directory",
]
build-backend = "hatchling.build"
[project]
name = "test-project"
version = "0.42"
[tool.hatch.build.targets.zipped-directory]
install-name = "org.example.test"
sources = [
"/src",
]
Then, running
hatch build --target zipped-directory
will build a zip archive named dist/test_project-0.42.zip with the following
structure:
.
└── org.example.test
├── LICENSE.txt
├── METADATA.json
├── README.md
├── my-code.py
└── subdir
├── data.txt
└── more-code.py
Reproducible Builds
By default, this plugin attempts to build reproducible archives by setting the timestamps of the zip entries to a fixed value. When building in reproducible mode, the UNIX file modes of the archive entries is also normalized (to either 0644 or 0755 depending on whether the file is executable). As well, in reproducible mode, the "create system" flag in the zip file headers are forced to Unix, even when running under Windows.
The timestamp used for reproducible builds may be configured by
setting the SOURCE_DATE_EPOCH environment variable.
Reproducible builds may be disabled by setting reproducible = false
in an appropriate section of pyproject.toml or hatch.toml. See
Hatch’s documentation on Build Configuration for details.
Change History
A change log is maintained in our GitHub repository.
Author
Jeff Dairiki dairiki@dairiki.org
License
hatch-zipped-directory is distributed under the terms of the
MIT license.
Metadata
Release files for hatch-zipped-directory 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hatch_zipped_directory-0.3.0.tar.gz | 12.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hatch_zipped_directory-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.7 kB
Release files / hatch_zipped_directory-0.3.0.tar.gz
| Download URL | hatch_zipped_directory-0.3.0.tar.gz |
|---|---|
| Size | 12.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a95e1fcf643f94a2ba2bcfbf05c7c36a9b5aa2b3ff0a610746985d3dd5e2ee9
|
|
BLAKE2b-256 checksum How to use checksums |
a520b99d2d1376cf218097cd74856899f4d445200a53d0802eadf8d3637a3462
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency logRelease files / hatch_zipped_directory-0.3.0-py3-none-any.whl
| Download URL | hatch_zipped_directory-0.3.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7da723e94e264285de2ab22f6a9219e2407135c8029245aabba0068f33569301
|
|
BLAKE2b-256 checksum How to use checksums |
960f7945eeab75b7d5cdbf7a24f7ef0c8fb0ee759ba591e65be7fd4768b1d9d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 23, 2026.
Transparency log