Skip to content

Commit

Permalink
Fix version fetching to use importlib instead of hatch
Browse files Browse the repository at this point in the history
  • Loading branch information
object-Object committed Dec 23, 2023
1 parent e89e5d7 commit 64afd16
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shutil
import stat
import sys
from importlib import metadata
from pathlib import Path
from typing import Any, Mapping

Expand Down Expand Up @@ -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(
Expand All @@ -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

Expand Down

0 comments on commit 64afd16

Please sign in to comment.