diff --git a/doc/conf.py b/doc/conf.py index 493064040fde918e6ac804e0131f22691d552026..4d9c3e553f98360b2b37600dbd043da7cef852b0 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -34,8 +34,11 @@ extensions = [ 'sphinx.ext.viewcode', 'sphinx.ext.mathjax', 'sphinx.ext.graphviz', + 'sphinx.ext.todo', ] +todo_include_todos = True + # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -57,9 +60,10 @@ copyright = u'2015, Paul McCarthy, FMRIB Centre' # built documents. # # The short X.Y version. -version = '' +import fsl +version = fsl.__version__ # The full version, including alpha/beta/rc tags. -release = '' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/doc/fsl.rst b/doc/fsl.rst index 378faff43e99542ddb72385ada3ace232bf32525..3a79585f82f99226210092b18ce20b57b7ac6c71 100644 --- a/doc/fsl.rst +++ b/doc/fsl.rst @@ -1,5 +1,5 @@ -fsl package -=========== +fslpy |version| +=============== .. automodule:: fsl :members: diff --git a/doc/fsl.version.rst b/doc/fsl.version.rst new file mode 100644 index 0000000000000000000000000000000000000000..0514d9588948f77be3a9cd9da401b7926e1d492a --- /dev/null +++ b/doc/fsl.version.rst @@ -0,0 +1,7 @@ +fsl.version module +================== + +.. automodule:: fsl.version + :members: + :undoc-members: + :show-inheritance: diff --git a/fsl/__init__.py b/fsl/__init__.py index 482c7f16bdac78bae7222fb9eb63aa9e6c2da54c..6a5e19befd2699afa81b0b82e4e1baa16d1d23d2 100644 --- a/fsl/__init__.py +++ b/fsl/__init__.py @@ -39,9 +39,12 @@ The conventional way to run ``fslpy`` is as follows:: ``logging`` level for tracking memory usage. The log level is attached to the ``logging`` module as ``logging.MEMORY``, and an associated log function is attached as ``logging.memory``. -""" +.. note:: The ``fslpy`` version number (currently |version|) is set in a + single place - the :mod:`fsl.version` module. +""" + import logging import pkgutil import warnings @@ -56,6 +59,14 @@ import subprocess import fsl.tools as tools import fsl.utils.settings as fslsettings +import fsl.version + + +__version__ = fsl.version.__version__ +"""The current ``fslpy`` version number. This information is stored in the +:mod:`fsl.version` module. +""" + def main(args=None): """``fslpy`` entry point. diff --git a/fsl/version.py b/fsl/version.py new file mode 100644 index 0000000000000000000000000000000000000000..5a716b7ffda64bab500bcc50d360455c85e832f7 --- /dev/null +++ b/fsl/version.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# +# version.py - fslpy version information. +# +# Author: Paul McCarthy <pauldmccarthy@gmail.com> +# +"""The sole purpose of this module is as a container for the ``fslpy`` +version number and information. + +.. autosummary:: + + __version__ + +.. todo:: Define a formal ``fslpy`` version number updating scheme. +""" + +__version__ = '0.1' +"""Current version number, as a string. """ diff --git a/setup.py b/setup.py index ae0c24edda03d4bcff84a61d8ee470e9a4806a33..d50084c83c41df11da065aa16a92a8f7187112e8 100644 --- a/setup.py +++ b/setup.py @@ -5,15 +5,29 @@ # Author: Paul McCarthy <pauldmccarthy@gmail.com> # +import os.path as op + from setuptools import setup from setuptools import find_packages +# The directory in whihc this setup.py file is contained. +basedir = op.dirname(__file__) + + +# Figure out the current fslpy version, as defined in fsl/version.py. We +# don't want to import the fsl package, as this may cause build problems. +# So we manually parse the contents of fsl/version.py to extract the +# version number. +version = {} +with open(op.join(basedir, "fsl", "version.py")) as f: + exec(f.read(), version) + setup( name='fslpy', - version='0.1', + version=version['__version__'], description='Front end to FSL tools',