Linked Epic: https://github.com/overhangio/tutor/issues/1251 Some new rules that have been added are: I: sort imports N: check for pep8-naming standards W292: check for missing extra line at EOF Some of our lines, particularly in config, break the 88 character line length limit. For that, we add a # noqa: E501 to let ruff know to ignore the rule for that line
23 lines
604 B
Python
23 lines
604 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, "tutorcairn", "__about__.py"), "rt", encoding="utf-8"
|
|
) as f:
|
|
exec(f.read(), about)
|
|
return about
|