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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hatch_zipped_directory-0.3.0.tar.gz.
File metadata
- Download URL: hatch_zipped_directory-0.3.0.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a95e1fcf643f94a2ba2bcfbf05c7c36a9b5aa2b3ff0a610746985d3dd5e2ee9
|
|
| MD5 |
da4ac601aa71a99c2a7a1198069a9b34
|
|
| BLAKE2b-256 |
a520b99d2d1376cf218097cd74856899f4d445200a53d0802eadf8d3637a3462
|
Provenance
The following attestation bundles were made for hatch_zipped_directory-0.3.0.tar.gz:
Publisher:
ci.yml on dairiki/hatch-zipped-directory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hatch_zipped_directory-0.3.0.tar.gz -
Subject digest:
8a95e1fcf643f94a2ba2bcfbf05c7c36a9b5aa2b3ff0a610746985d3dd5e2ee9 - Sigstore transparency entry: 2568728807
- Sigstore integration time:
-
Permalink:
dairiki/hatch-zipped-directory@b6646db25aca1e797f5b1be1ab496f0442485c42 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/dairiki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@b6646db25aca1e797f5b1be1ab496f0442485c42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hatch_zipped_directory-0.3.0-py3-none-any.whl.
File metadata
- Download URL: hatch_zipped_directory-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7da723e94e264285de2ab22f6a9219e2407135c8029245aabba0068f33569301
|
|
| MD5 |
49e5fe368ca6dc8ff776e70ed99d2ddd
|
|
| BLAKE2b-256 |
960f7945eeab75b7d5cdbf7a24f7ef0c8fb0ee759ba591e65be7fd4768b1d9d0
|
Provenance
The following attestation bundles were made for hatch_zipped_directory-0.3.0-py3-none-any.whl:
Publisher:
ci.yml on dairiki/hatch-zipped-directory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hatch_zipped_directory-0.3.0-py3-none-any.whl -
Subject digest:
7da723e94e264285de2ab22f6a9219e2407135c8029245aabba0068f33569301 - Sigstore transparency entry: 2568728833
- Sigstore integration time:
-
Permalink:
dairiki/hatch-zipped-directory@b6646db25aca1e797f5b1be1ab496f0442485c42 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/dairiki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@b6646db25aca1e797f5b1be1ab496f0442485c42 -
Trigger Event:
push
-
Statement type: