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

    [project]
    name = "my-app"
    
    [build.hooks.project-name]
    dependencies = ["hatch-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.0a3.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.0a3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hatch_project_name-1.0.0a3.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.0a3.tar.gz
Algorithm Hash digest
SHA256 e5048829ec5442b41a785c8f67f6f1b4dccd4fa92b75510ebd85991aa009bbd5
MD5 7f2895b684442ae010cf396cc42a81ce
BLAKE2b-256 1f88624280eaf96bb8154a35c8bdb10cc84be2c850a958352947a398d480f7c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hatch_project_name-1.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 da42de9d1076e9a06ed4f37429070a15f4c628be997b3878fb025ebf651cb861
MD5 53e34876640020af3fd5ffedda545680
BLAKE2b-256 b1845a1128ca4d3887f5ac01312b48c7771703079448257da3b14e0e7fa7c4eb

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