Skip to content

Commit

Permalink
Read the documentation version from VERSION.
Browse files Browse the repository at this point in the history
  • Loading branch information
hodgestar committed May 24, 2021
1 parent fc531da commit 5c0d0b5
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import pathlib
import sys
sys.path.insert(0, os.path.abspath('.'))

Expand All @@ -21,8 +22,24 @@
copyright = '2021, QuTiP Community'
author = 'QuTiP Community'

# The full version, including alpha/beta/rc tags
release = '0.1.0dev'

def qutip_qip_version():
""" Retrieve the qutip-qip version from ``../../VERSION``.
"""
src_folder_root = pathlib.Path(__file__).absolute().parent.parent.parent
version = src_folder_root.joinpath(
"VERSION"
).read_text().strip()
return version


# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
# The full version, including alpha/beta/rc tags.
release = qutip_qip_version()
# The short X.Y version.
version = ".".join(release.split(".")[:2])


# -- General configuration ---------------------------------------------------
Expand Down

0 comments on commit 5c0d0b5

Please sign in to comment.