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.0a5.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.0a5-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hatch_project_name-1.0.0a5.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.0a5.tar.gz
Algorithm Hash digest
SHA256 854c146af5c0fb99d48871be8b2153da4eed9f66947ccbe10baea9154b849924
MD5 53780be36615410f23dbafc1610f1253
BLAKE2b-256 1402fdd78c16a6a77c3b3bdfab96d6e49f258a1983f5cf07728f302cb88186dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hatch_project_name-1.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 151ffa88bba7f2998de2410224d34165f93695244f6f8e61e3ed1ba04e6b4a04
MD5 6fc047b23aa4f34130d225b6925bbc50
BLAKE2b-256 786db63bf40f65e065a8820cb81c672ff175d4278bbcdda21fe886b509d13d3a

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