Skip to content

Commit

Permalink
docs: obtain version of nutils via import
Browse files Browse the repository at this point in the history
This patches replaces the parsing of the Nutils version number from
`__init__.py` with importing `nutils` and obtaining module attribute `version`.
There are two motivations for this change: Sphinx is going to import `nutils`
anyhow, and in a follow-up commit the line in `__init__.py` defining the
version will be changed, which would necessitate a corresponding change to
`docs/conf.py` without this patch.
  • Loading branch information
joostvanzwieten committed Nov 30, 2022
1 parent e4a96e1 commit aa34d3d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
with open(os.path.join('..', 'nutils', '__init__.py'), encoding='utf-8') as f:
nutils_version = next(filter(None, map(re.compile("^version = '([a-zA-Z0-9.]+)'$").match, f))).group(1)
from nutils import version as nutils_version
# The short X.Y version.
version = re.search('^[0-9]+\\.[0-9]+', nutils_version).group(0)
# The full version, including alpha/beta/rc tags.
Expand Down

0 comments on commit aa34d3d

Please sign in to comment.