tutor-notes/.hatch_build.py
Jhony Avella 8540aef9b8
feat: migrate from setup.py to pyproject.toml (#46)
* feat: migrate from setup.py to pyproject.toml

* chore: fixes

* chore: addressing PR comments

* chore: addressing more comments
2025-03-11 13:09:00 -05:00

22 lines
620 B
Python

# https://hatch.pypa.io/latest/how-to/config/dynamic-metadata/
import os
import typing as t
from hatchling.metadata.plugin.interface import MetadataHookInterface
HERE = os.path.dirname(__file__)
class MetaDataHook(MetadataHookInterface):
def update(self, metadata: dict[str, t.Any]) -> None:
about = load_about()
metadata["version"] = about["__version__"]
def load_about() -> dict[str, str]:
about: dict[str, str] = {}
with open(os.path.join(HERE, "tutornotes", "__about__.py"), "rt", encoding="utf-8") as f:
exec(f.read(), about) # pylint: disable=exec-used
return about