Skip to content
Snippets Groups Projects
Commit edeb480c authored by Alexandru Fikl's avatar Alexandru Fikl Committed by Andreas Klöckner
Browse files

version: use importlib

parent a14ed48e
No related branches found
No related tags found
No related merge requests found
VERSION = (2021, 1)
VERSION_TEXT = ".".join(str(i) for i in VERSION)
from importlib import metadata
from typing import Tuple
def _parse_version(version: str) -> Tuple[Tuple[int, ...], str]:
import re
m = re.match("^([0-9.]+)([a-z0-9]*?)$", VERSION_TEXT)
assert m is not None
return tuple([int(nr) for nr in m.group(1).split(".")]), m.group(2)
VERSION_TEXT = metadata.version("arraycontext")
VERSION, VERSION_STATUS = _parse_version(VERSION_TEXT)
from importlib import metadata
from urllib.request import urlopen
......@@ -8,12 +9,8 @@ with urlopen(_conf_url) as _inf:
copyright = "2021, University of Illinois Board of Trustees"
author = "Arraycontext Contributors"
ver_dic = {}
exec(compile(open("../arraycontext/version.py").read(), "../arraycontext/version.py",
"exec"), ver_dic)
version = ".".join(str(x) for x in ver_dic["VERSION"])
release = ver_dic["VERSION_TEXT"]
release = metadata.version("arraycontext")
version = ".".join(release.split(".")[:2])
intersphinx_mapping = {
"jax": ("https://jax.readthedocs.io/en/latest/", None),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment