From 64afd16338a19ff4030c9d4c56b387df0c5a5a29 Mon Sep 17 00:00:00 2001 From: object-Object Date: Fri, 22 Dec 2023 22:36:07 -0500 Subject: [PATCH] Fix version fetching to use importlib instead of hatch --- noxfile.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/noxfile.py b/noxfile.py index e8c61461..31c8bbd2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -4,6 +4,7 @@ import shutil import stat import sys +from importlib import metadata from pathlib import Path from typing import Any, Mapping @@ -92,7 +93,7 @@ def pdoc(session: nox.Session): # docs for the docs! session.install(".[pdoc]") - version = run_silent(session, "hatch", "--quiet", "version") + version = metadata.version("hexdoc") commit = run_silent_external(session, "git", "rev-parse", "--short", "HEAD") session.run( @@ -114,19 +115,14 @@ def pdoc(session: nox.Session): @nox.session def tag(session: nox.Session): - session.install("hatch", "packaging") + session.install("packaging") from packaging.version import Version message = "Automatic PEP 440 release tag" - # because hatch is dumb and thinks it's ok to log on stdout i guess? - # or maybe nox is capturing it - # i have no idea - run_silent(session, "hatch", "--quiet", "version") - # validate some assumptions to make this simpler - version = Version(run_silent(session, "hatch", "--quiet", "version")) + version = Version(metadata.version("hexdoc")) assert version.epoch != 0 assert len(version.release) == 3