Skip to main content

Hatch build hook plugin that writes the project name to a file

Project description

hatch-project-name

CI/CD CI - Test CD - Build
Package PyPI - Version PyPI - Python Version
Meta Hatch project uv Ruff types - Mypy License - MIT

This provides a build hook plugin for Hatch that writes the project name defined in pyproject.toml to a file.

Table of Contents

Rationale

TODO

Configuration

The build hook plugin name is project-name.

  • pyproject.toml

    [project]
    name = "my-package"
    
    [tool.hatch.build.hooks.project-name]
    dependencies = ["hatch-project-name"]
    name-file = "src/my_package/_name.py"
    
  • hatch.toml

    [project]
    name = "my-package"
    
    [build.hooks.project-name]
    dependencies = ["hatch-project-name"]
    name-file = "src/my_package/_name.py"
    

Building the project will generate the file

  • _name.py

    project_name = __project_name__ = distribution_name = __distribution_name__ = "my-package"
    

Build hook options

Option Type Default Description
name-file str REQUIRED The relative path to the file that gets updated with the project name.

Editable installs

The name file is only updated upon install or build. Thus the name in an editable install (Hatch's dev mode) will be incorrect if the name is changed in pyproject.toml and the project is not rebuilt.

License

hatch-project-name is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hatch_project_name-1.0.0a6.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

hatch_project_name-1.0.0a6-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file hatch_project_name-1.0.0a6.tar.gz.

File metadata

  • Download URL: hatch_project_name-1.0.0a6.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for hatch_project_name-1.0.0a6.tar.gz
Algorithm Hash digest
SHA256 aefc7a57e96c373418f376a8acbd1a101d56c9f35e9a68d2e9333d3b4fd4f699
MD5 94301e574bf41143e1f47f3fcba8a561
BLAKE2b-256 9d6e2ce42aeaea34d25d28f1dcb6c92bc652bd38568437d8d77988da3881b54e

See more details on using hashes here.

File details

Details for the file hatch_project_name-1.0.0a6-py3-none-any.whl.

File metadata

File hashes

Hashes for hatch_project_name-1.0.0a6-py3-none-any.whl
Algorithm Hash digest
SHA256 673909fbe3f901beef2b2016d9723bfa773670ad9215fbd27d24ff3ad1b87f63
MD5 1fabfe42b6686d01b4ad881356e533d4
BLAKE2b-256 63328f3f54027ca3c7af67c225a2a127ed19c8442c6c41b5e2eedf93f32674d5

See more details on using hashes here.

Supported by

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