* feat: migrate from pylint/black to ruff Linked Epic: overhangio/tutor#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 * test: python package distribution build when running make test Pushing to pypi would occasionally fail because of breaking distribution build. We verify the build in the github CI now so that we can mitigate those errors later on. * fix: install ruff instead of pylint/black as optional dev dependency
23 lines
606 B
Python
23 lines
606 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, "tutorandroid", "__about__.py"), "rt", encoding="utf-8"
|
|
) as f:
|
|
exec(f.read(), about)
|
|
return about
|