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 plugin for Hatch that uses your preferred version control system (like Git) to determine project versions.

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-app"
    
    [tool.hatch.build.hooks.project-name]
    name-file = "_name.py"
    
  • hatch.toml

    [project]
    name = "my-app"
    
    [build.hooks.project-name]
    name-file = "_name.py"
    

Building the project will generate the file

  • _name.py

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

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.0a2.tar.gz (4.1 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.0a2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for hatch_project_name-1.0.0a2.tar.gz
Algorithm Hash digest
SHA256 509eb735f3e5dd0d6b70bebefdddbb1517a7926547abce1bfd3109f90c7258cc
MD5 daebc3562e6e4acb458db577767b7443
BLAKE2b-256 e65241b52f18838e5203bc83c4e8eeee9e1a078f62062617d7c0559ea899a042

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hatch_project_name-1.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 d38bf060894ba7aecb96d1ae00eb464c97e9d77c50cc775eaba4d30378ac2400
MD5 6944b0d3119eb87c44529d68921ed230
BLAKE2b-256 b80c47a04166c3a717975497bb87aaa53409398f3da226a09d2ffdaeb9c3b33e

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