Skip to content

Commit 3eaa5d6

Browse files
committed
Read doc version from bigml.__version__
1 parent ed64a54 commit 3eaa5d6

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

docs/conf.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import sys, os
14+
import os
15+
import re
16+
import sys
17+
18+
# Path to this project
19+
project_path = os.path.join(os.path.dirname(__file__), '..')
1520

1621
# If extensions (or modules to document with autodoc) are in another directory,
1722
# add these directories to sys.path here. If the directory is relative to the
1823
# documentation root, use os.path.abspath to make it absolute, like shown here.
19-
#sys.path.insert(0, os.path.abspath('.'))
24+
sys.path.insert(0, project_path)
2025

2126
# -- General configuration -----------------------------------------------------
2227

@@ -48,9 +53,14 @@
4853
# built documents.
4954
#
5055
# The short X.Y version.
51-
version = 'TODO'
56+
# Read the version from bigml.__version__ without importing the package
57+
# (and thus attempting to import packages it depends on that may not be
58+
# installed yet).
59+
init_py_path = os.path.join(project_path, 'bigml', '__init__.py')
60+
version = re.search("__version__ = '([^']+)'",
61+
open(init_py_path).read()).group(1)
5262
# The full version, including alpha/beta/rc tags.
53-
release = 'TODO'
63+
release = version
5464

5565
# The language for content autogenerated by Sphinx. Refer to documentation
5666
# for a list of supported languages.

0 commit comments

Comments
 (0)