Commit 3431971e authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'v1.0' into 'v1.0'

Version 1.0.1 ready for release

See merge request !20
parents 515205ed 0498270d
Pipeline #535 failed with stage
in 0 seconds
...@@ -2,5 +2,7 @@ include LICENSE ...@@ -2,5 +2,7 @@ include LICENSE
include COPYRIGHT include COPYRIGHT
include README.md include README.md
include requirements.txt include requirements.txt
recursive-include doc * include pytest.ini
recursive-include tests * recursive-include doc *
recursive-exclude doc/html *
recursive-include tests *
...@@ -20,8 +20,7 @@ Documentation ...@@ -20,8 +20,7 @@ Documentation
------------- -------------
`fslpy` is documented using [sphinx](http://http://sphinx-doc.org/). You can `fslpy` is documented using [sphinx](http://http://sphinx-doc.org/). You can
build the API documentation by installing `sphinx` and `sphinx-rtd-theme`, and build the API documentation by running:
running:
python setup.py doc python setup.py doc
...@@ -35,8 +34,7 @@ guide](doc/contributing.rst). ...@@ -35,8 +34,7 @@ guide](doc/contributing.rst).
Tests Tests
----- -----
To run the tests, install `mock`, `pytest`, `pytest-runner`, `pytest-html`, Run the test suite via:
and `pytest-cov`, and then run:
python setup.py test python setup.py test
......
...@@ -24,27 +24,11 @@ Development model ...@@ -24,27 +24,11 @@ Development model
- Coding conventions are adhered to (unless there is good reason not to). - Coding conventions are adhered to (unless there is good reason not to).
Releases
--------
A separate branch is created for each release. The name of the branch is
``v[release]``, where ``[release]`` is the version number (see below). For
example, the branch name for release ``1.0.0`` would be ``v1.0.0``. Hotfixes
may be added to these release branches. Hotfixes should be merged into the
master branch, and then cherry-picked onto the release branch(es).
Every release (including hotfixes) is also tagged with its version number.
For example, the first commit in the ``v1.0.0`` branch would also be tagged
with ``1.0.0``.
Version number Version number
-------------- --------------
The ``fslpy`` version number follows `semantic versioning The ``fslpy`` version number roughly follows `semantic versioning
<http://semver.org/>`_ rules, so that dependant projects are able to perform <http://semver.org/>`_ rules, so that dependant projects are able to perform
compatibility testing. The full version number string consists of three compatibility testing. The full version number string consists of three
numbers:: numbers::
...@@ -60,8 +44,27 @@ numbers:: ...@@ -60,8 +44,27 @@ numbers::
- The ``major`` number is incremented on major feature additions, and - The ``major`` number is incremented on major feature additions, and
backwards-incompatible changes. backwards-incompatible changes.
Additionally, a single letter (``a``, ``b``, ``c``, etc) may be appended
to the version number, indicating a hotfix release. Releases
--------
A separate branch is created for each **minor** release. The name of the
branch is ``v[major.minor]``, where ``[major.minor]`` is the first two
components of the release version number (see above). For example, the branch
name for minor release ``1.0`` would be ``v1.0``.
Patches and bugfixes may be added to these release branches as ``point``
releases. These changes should be made on the master branch like any other
change (i.e. via merge requests), and then cherry-picked onto the relevant
release branch(es).
Every release commit is also tagged with its full version number. For
example, the first release off the ``v1.0`` branch would be tagged with
``1.0.0``. Point releases to the ``v1.0`` branch would be tagged with
``1.0.1``, ``1.0.2``, etc.
Testing Testing
......
...@@ -4,13 +4,90 @@ ...@@ -4,13 +4,90 @@
# #
# Author: Paul McCarthy <pauldmccarthy@gmail.com> # Author: Paul McCarthy <pauldmccarthy@gmail.com>
# #
"""The sole purpose of this module is as a container for the ``fslpy`` """The primary purpose of this module is as a container for the ``fslpy``
version number and information. version number. A couple of conveniense functions for comparing version
numbers are also defined here.
.. autosummary:: .. autosummary::
:nosignatures:
__version__ __version__
parseVersionString
compareVersions
The ``fslpy`` version number consists of three numbers, separated by a period,
which roughly obeys the Semantic Versioning conventions (http://semver.org/):
1. The major release number. This gets updated for major/external releases.
2. The minor release number. This gets updated for minor/internal releases,
which involve new features, bug-fixes, and other updates.
3. The point release number. This gets updated for minor/internal releases,
which primarily involve bug-fixes and minor changes.
""" """
__version__ = '1.0.0'
import string
__version__ = '1.0.1'
"""Current version number, as a string. """ """Current version number, as a string. """
def parseVersionString(versionString):
"""Parses the given version string, and returns a tuple containing
the individual components of the version number (see the description
of the :attr:`__version__` attribute).
An error is raised if the ``versionString`` is invalid.
"""
if versionString == 'dev':
return 9999, 9999, 9999
components = versionString.split('.')
# Major, minor, and point
# version are always numeric
major, minor, point = [c for c in components]
# Early versions of FSLeyes
# used a letter at the end
# to denote a hotfix release.
# Don't break if we get one
# of these old version numbers.
point = point.strip(string.ascii_letters)
return [int(c) for c in [major, minor, point]]
def compareVersions(v1, v2, ignorePoint=False):
"""Compares the given ``fslpy`` version numbers.
:arg v1: Version number to compare
:arg v2: Version number to compare
:arg ignorePoint: Defaults to ``False``. If ``True``, the point release
numbers are ignored in the comparison.
:returns: One of the following:
- -1 if ``v1`` < ``v2`` (i.e. ``v1`` is older than ``v2``)
- 0 if ``v1`` == ``v2``
- 0 if ``v1`` > ``v2``
"""
v1 = parseVersionString(v1)
v2 = parseVersionString(v2)
if ignorePoint:
v1 = v1[:2]
v2 = v2[:2]
for p1, p2 in zip(v1, v2):
if p1 > p2: return 1
if p1 < p2: return -1
return 0
[aliases] [aliases]
test=pytest test=pytest
[bdist_wheel]
universal=1
\ No newline at end of file
...@@ -8,11 +8,8 @@ ...@@ -8,11 +8,8 @@
from __future__ import print_function from __future__ import print_function
import os import os.path as op
import os.path as op import shutil
import subprocess as sp
import shutil
import pkgutil
from setuptools import setup from setuptools import setup
from setuptools import find_packages from setuptools import find_packages
...@@ -38,6 +35,7 @@ with open(op.join(basedir, "fsl", "version.py")) as f: ...@@ -38,6 +35,7 @@ with open(op.join(basedir, "fsl", "version.py")) as f:
if line.startswith('__version__'): if line.startswith('__version__'):
exec(line, version) exec(line, version)
break break
version = version['__version__']
with open(op.join(basedir, 'README.md'), 'rt') as f: with open(op.join(basedir, 'README.md'), 'rt') as f:
readme = f.read() readme = f.read()
...@@ -62,34 +60,37 @@ class doc(Command): ...@@ -62,34 +60,37 @@ class doc(Command):
if op.exists(destdir): if op.exists(destdir):
shutil.rmtree(destdir) shutil.rmtree(destdir)
env = dict(os.environ) print('Building documentation [{}]'.format(destdir))
dirname = pkgutil.get_loader('fsl').get_filename()
dirname = op.dirname(dirname)
dirname = op.abspath(op.join(dirname, '..'))
ppath = [dirname]
env['PYTHONPATH'] = op.pathsep.join(ppath) import sphinx
print('Building documentation [{}]'.format(destdir)) try:
import unittest.mock as mock
except:
import mock
sp.call(['sphinx-build', docdir, destdir], env=env) mockedModules = [
'nibabel',
'nibabel.fileslice',
'numpy',
'numpy.linalg']
mockobj = mock.MagicMock()
mockedModules = { m : mockobj for m in mockedModules}
setup( with mock.patch.dict('sys.modules', **mockedModules):
sphinx.main(['sphinx-build', docdir, destdir])
name='fslpy',
version=version['__version__'], setup(
name='fslpy',
version=version,
description='FSL Python library', description='FSL Python library',
long_description=readme, long_description=readme,
url='https://git.fmrib.ox.ac.uk/fsl/fslpy', url='https://git.fmrib.ox.ac.uk/fsl/fslpy',
author='Paul McCarthy', author='Paul McCarthy',
author_email='pauldmccarthy@gmail.com', author_email='pauldmccarthy@gmail.com',
license='Apache License Version 2.0', license='Apache License Version 2.0',
classifiers=[ classifiers=[
...@@ -101,10 +102,9 @@ setup( ...@@ -101,10 +102,9 @@ setup(
'Topic :: Software Development :: Libraries :: Python Modules'], 'Topic :: Software Development :: Libraries :: Python Modules'],
packages=packages, packages=packages,
install_requires=install_requires, install_requires=install_requires,
setup_requires=['pytest-runner', 'sphinx', 'sphinx-rtd-theme', 'mock'],
setup_requires=['pytest-runner'],
tests_require=['mock', tests_require=['mock',
'pytest-cov', 'pytest-cov',
'pytest-html', 'pytest-html',
...@@ -113,11 +113,4 @@ setup( ...@@ -113,11 +113,4 @@ setup(
test_suite='tests', test_suite='tests',
cmdclass={'doc' : doc}, cmdclass={'doc' : doc},
entry_points={
'console_scripts' : [
'fslpy_imcp = fsl.scripts.imcp:main',
'fslpy_immv = fsl.scripts.immv:main'
]
}
) )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment