Skip to main content

hatch-zipped-directory

PyPI - Version PyPI - Python Version GitHub Actions Workflow Status GitHub stars


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

hatch_zipped_directory-0.3.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hatch_zipped_directory-0.3.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

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

Hashes for hatch_zipped_directory-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8a95e1fcf643f94a2ba2bcfbf05c7c36a9b5aa2b3ff0a610746985d3dd5e2ee9
MD5 da4ac601aa71a99c2a7a1198069a9b34
BLAKE2b-256 a520b99d2d1376cf218097cd74856899f4d445200a53d0802eadf8d3637a3462

See more details on using hashes here.

Provenance

The following attestation bundles were made for hatch_zipped_directory-0.3.0.tar.gz:

Publisher: ci.yml on dairiki/hatch-zipped-directory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hatch_zipped_directory-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hatch_zipped_directory-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7da723e94e264285de2ab22f6a9219e2407135c8029245aabba0068f33569301
MD5 49e5fe368ca6dc8ff776e70ed99d2ddd
BLAKE2b-256 960f7945eeab75b7d5cdbf7a24f7ef0c8fb0ee759ba591e65be7fd4768b1d9d0

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page