hatch-zipped-directory


Namehatch-zipped-directory JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryA custom builder to build zipped directories
upload_time2023-12-13 00:24:25
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords hatch packaging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # hatch-zipped-directory

[![PyPI - Version](https://img.shields.io/pypi/v/hatch-zipped-directory.svg)](https://pypi.org/project/hatch-zipped-directory)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-zipped-directory.svg)](https://pypi.org/project/hatch-zipped-directory)
[![Tests](https://github.com/dairiki/hatch-zipped-directory/actions/workflows/tests.yml/badge.svg)](https://github.com/dairiki/hatch-zipped-directory/actions/workflows/tests.yml)
[![Trackgit Views](https://us-central1-trackgit-analytics.cloudfunctions.net/token/ping/lhautvz4zffrt8jawcpl)](https://trackgit.com)

-----

This is a [Hatch](https://hatch.pypa.io/latest/) 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](https://inkscape.org/) 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](https://hatch.pypa.io/latest/config/build/), 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](https://peps.python.org/pep-0566/#json-compatible-metadata))
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:
```toml
[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
```sh
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][reproducible
builds] 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.)

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.


## Author

Jeff Dairiki <dairiki@dairiki.org>

## License

`hatch-zipped-directory` is distributed under the terms of the
[MIT](https://spdx.org/licenses/MIT.html) license.

[reproducible builds]: https://hatch.pypa.io/latest/config/build/#reproducible-builds
[Build Configuration]: https://hatch.pypa.io/latest/config/build/


## Changes

### 0.1.0 (2023-12-12)

#### Bitrot

- Fix for hatchling 1.19 (hatch 1.8). `BuilderInterface.build`
  arguments are now all kw-only. ([hatch/6c252f8])

[hatch/6c252f8]: https://github.com/pypa/hatch/commit/6c252f8b8a65711846a6060c3d54f02936da2aa0)

### 0.1.0b4 (2023-09-10)

#### Features

- Add support for [reproducible builds] which are now enabled by
  default. When enabled, timestamps in the zip archive are set to a
  fixed value (configurable via the `SOURCE_DATE_EPOCH` environment
  variable) and the UNIX access modes of archive members are
  [normalized to either 0644 or 0755][mode-normalization] depending on
  whether the file is executable or not.

[reproducible builds]: https://hatch.pypa.io/latest/config/build/#reproducible-builds
[mode-normalization]: https://github.com/pypa/flit/pull/66

### 0.1.0b3 (2023-05-10)

#### Features

- Refactor JSON metadata code. Now we use `hatchling` to generate
  conventionall RFC 822-formatted distribution metadata, then convert
  that to JSON, explicitly following the steps outline in [PEP
  566](https://peps.python.org/pep-0566/#json-compatible-metadata).
  Among other things, this allows configuration of the
  *Metadata-Version* by setting
  `tool.hatch.build.targets.zipped-directory.core-metadata-version`.

#### Tests

- We now have 100% test coverage.

### 0.1.0b2 (2023-01-10)

#### Features

- The prefixing of file names under a top-level directory in the zip
  archive can now be disabled by setting `install-name = ""`.
  Thank you @gwerbin([#1][])

#### Bugs

- Use explicit encoding in hatch metadata hook (for Windows).

[#1]: https://github.com/dairiki/hatch-zipped-directory/issues/1

### 0.1.0b1 (2022-10-07)

Initial release.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "hatch-zipped-directory",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "hatch,packaging",
    "author": "",
    "author_email": "Jeff Dairiki <dairiki@dairiki.org>",
    "download_url": "https://files.pythonhosted.org/packages/51/00/fac2e8444fe692f255253b60bb17b954b57890e849d796d76f77b7e10a52/hatch_zipped_directory-0.1.0.tar.gz",
    "platform": null,
    "description": "# hatch-zipped-directory\n\n[![PyPI - Version](https://img.shields.io/pypi/v/hatch-zipped-directory.svg)](https://pypi.org/project/hatch-zipped-directory)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/hatch-zipped-directory.svg)](https://pypi.org/project/hatch-zipped-directory)\n[![Tests](https://github.com/dairiki/hatch-zipped-directory/actions/workflows/tests.yml/badge.svg)](https://github.com/dairiki/hatch-zipped-directory/actions/workflows/tests.yml)\n[![Trackgit Views](https://us-central1-trackgit-analytics.cloudfunctions.net/token/ping/lhautvz4zffrt8jawcpl)](https://trackgit.com)\n\n-----\n\nThis is a [Hatch](https://hatch.pypa.io/latest/) plugin that provides\na custom builder to support building zip archives for quasi-manual\ninstallation into various foreign package installation systems.\n(Specifically, I use this for packaging\n[Inkscape](https://inkscape.org/) extensions and symbols libraries,\nbut it may be useful in other contexts, such as deploying to cloud\ncompute platforms.)\n\nThe builder creates a zip archive.  All the contents of the zip\narchive will be included under a single specific top-level directory.\nThe default name of the top-level directory is a file-name-safe\nversion of the project name, however the name of the directory may be\nconfigured by setting the `install-name` key in the target-specific\nconfiguration section.\nThis behavior may be disabled by setting `install-name = ''`.\n\nIn addition to whatever files are selected for inclusion in the\narchive via Hatch\u2019s regular [build configuration\nsettings](https://hatch.pypa.io/latest/config/build/), any configured\nproject README and license files will be included in the top level of\nthe install directory within the zip archive.\n\nAs well, a `METADATA.json` file containing the project metadata in\nJSON format (as described in\n[PEP 566](https://peps.python.org/pep-0566/#json-compatible-metadata))\nwill be included in the top level of the install directory within the\nzip archive.\n\n\n## Example\n\nAssume a project source directory looking something like:\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 subdir\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u251c\u2500\u2500 data.txt\n\u2502\u00a0\u00a0 \u2502\u00a0\u00a0 \u2514\u2500\u2500 more-code.py\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 my-code.py\n\u2514\u2500\u2500 tests\n    \u2514\u2500\u2500 test_foo.py\n```\n\nWhere `pyproject.toml` looks like:\n```toml\n[build-system]\nrequires = [\n    \"hatchling\",\n    \"hatch-zipped-directory\",\n]\nbuild-backend = \"hatchling.build\"\n\n[project]\nname = \"test-project\"\nversion = \"0.42\"\n\n[tool.hatch.build.targets.zipped-directory]\ninstall-name = \"org.example.test\"\nsources = [\n    \"/src\",\n]\n```\n\nThen, running\n```sh\nhatch build --target zipped-directory\n```\n\nwill build a zip archive named `dist/test_project-0.42.zip` with the following\nstructure:\n```\n.\n\u2514\u2500\u2500 org.example.test\n    \u251c\u2500\u2500 LICENSE.txt\n    \u251c\u2500\u2500 METADATA.json\n    \u251c\u2500\u2500 README.md\n    \u251c\u2500\u2500 my-code.py\n    \u2514\u2500\u2500 subdir\n        \u251c\u2500\u2500 data.txt\n        \u2514\u2500\u2500 more-code.py\n```\n\n## Reproducible Builds\n\nBy default, this plugin attempts to build [reproducible][reproducible\nbuilds] archives by setting the timestamps of the zip entries to a\nfixed value. When building in reproducible mode, the UNIX file modes\nof the archive entries is also normalized (to either 0644 or 0755\ndepending on whether the file is executable.)\n\nThe timestamp used for reproducible builds may be configured by\nsetting the `SOURCE_DATE_EPOCH` environment variable.\n\nReproducible builds may be disabled by setting `reproducible = false`\nin an appropriate section of `pyproject.toml` or `hatch.toml`.  See\nHatch\u2019s documentation on [Build Configuration] for details.\n\n\n## Author\n\nJeff Dairiki <dairiki@dairiki.org>\n\n## License\n\n`hatch-zipped-directory` is distributed under the terms of the\n[MIT](https://spdx.org/licenses/MIT.html) license.\n\n[reproducible builds]: https://hatch.pypa.io/latest/config/build/#reproducible-builds\n[Build Configuration]: https://hatch.pypa.io/latest/config/build/\n\n\n## Changes\n\n### 0.1.0 (2023-12-12)\n\n#### Bitrot\n\n- Fix for hatchling 1.19 (hatch 1.8). `BuilderInterface.build`\n  arguments are now all kw-only. ([hatch/6c252f8])\n\n[hatch/6c252f8]: https://github.com/pypa/hatch/commit/6c252f8b8a65711846a6060c3d54f02936da2aa0)\n\n### 0.1.0b4 (2023-09-10)\n\n#### Features\n\n- Add support for [reproducible builds] which are now enabled by\n  default. When enabled, timestamps in the zip archive are set to a\n  fixed value (configurable via the `SOURCE_DATE_EPOCH` environment\n  variable) and the UNIX access modes of archive members are\n  [normalized to either 0644 or 0755][mode-normalization] depending on\n  whether the file is executable or not.\n\n[reproducible builds]: https://hatch.pypa.io/latest/config/build/#reproducible-builds\n[mode-normalization]: https://github.com/pypa/flit/pull/66\n\n### 0.1.0b3 (2023-05-10)\n\n#### Features\n\n- Refactor JSON metadata code. Now we use `hatchling` to generate\n  conventionall RFC 822-formatted distribution metadata, then convert\n  that to JSON, explicitly following the steps outline in [PEP\n  566](https://peps.python.org/pep-0566/#json-compatible-metadata).\n  Among other things, this allows configuration of the\n  *Metadata-Version* by setting\n  `tool.hatch.build.targets.zipped-directory.core-metadata-version`.\n\n#### Tests\n\n- We now have 100% test coverage.\n\n### 0.1.0b2 (2023-01-10)\n\n#### Features\n\n- The prefixing of file names under a top-level directory in the zip\n  archive can now be disabled by setting `install-name = \"\"`.\n  Thank you @gwerbin([#1][])\n\n#### Bugs\n\n- Use explicit encoding in hatch metadata hook (for Windows).\n\n[#1]: https://github.com/dairiki/hatch-zipped-directory/issues/1\n\n### 0.1.0b1 (2022-10-07)\n\nInitial release.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A custom builder to build zipped directories",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/dairiki/hatch-zipped-directory"
    },
    "split_keywords": [
        "hatch",
        "packaging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a8fe5dc75b2799993ab79d57ae4f74cf8d1c934b3821706f948a57973b005f84",
                "md5": "48b8921f70d1e7f44e9f1138b41fa747",
                "sha256": "0ba160dcd2b10d121605a5e6ca12777b61b3ae749a775c753f9d92abbdd44296"
            },
            "downloads": -1,
            "filename": "hatch_zipped_directory-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48b8921f70d1e7f44e9f1138b41fa747",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8807,
            "upload_time": "2023-12-13T00:24:23",
            "upload_time_iso_8601": "2023-12-13T00:24:23.585703Z",
            "url": "https://files.pythonhosted.org/packages/a8/fe/5dc75b2799993ab79d57ae4f74cf8d1c934b3821706f948a57973b005f84/hatch_zipped_directory-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5100fac2e8444fe692f255253b60bb17b954b57890e849d796d76f77b7e10a52",
                "md5": "abee175c2751faa196de04df393997b7",
                "sha256": "091f4c17a0966d4c6fdcc0002676e770c80ec18093740aa4582c8eb075e32cd3"
            },
            "downloads": -1,
            "filename": "hatch_zipped_directory-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "abee175c2751faa196de04df393997b7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 12262,
            "upload_time": "2023-12-13T00:24:25",
            "upload_time_iso_8601": "2023-12-13T00:24:25.277137Z",
            "url": "https://files.pythonhosted.org/packages/51/00/fac2e8444fe692f255253b60bb17b954b57890e849d796d76f77b7e10a52/hatch_zipped_directory-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-13 00:24:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dairiki",
    "github_project": "hatch-zipped-directory",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hatch-zipped-directory"
}
        
Elapsed time: 0.24584s