diff --git a/README.md b/README.md index d15a852a4bb5c96ac18ead0f59aa5fc7e0c98b44..6fbc679e43528bfd1ee066ba393f839c79c05450 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,35 @@ fslpy The `fslpy` project is a [FSL](http://fsl.fmrib.ox.ac.uk/fsl/fslwiki/) programming library written in Python. It is used by -[FSLeyes](https://git.fmrib.ox.ac.uk/paulmc/fsleyes/). +[FSLeyes](https://git.fmrib.ox.ac.uk/paulmc/fsleyes/). + + +Dependencies +------------ + + +All of the dependencies of `fslpy` are listed in the +[requirements.txt](requirements.txt) file. Some `fslpy` modules require +[wxPython](http://www.wxpython.org) 3.0.2.0. Documentation ------------- +`fslpy` is documented using [sphinx](http://http://sphinx-doc.org/). You can +build the API documentation by installing `sphinx` and `sphinx-rtd-theme`, and +running: + + python setup.py doc + +The HTML documentation will be generated and saved in the `doc/html/` directory. + + +Tests +----- + +To run the tests, install `pytest` and `coverage`, and then run: + + python setup.py test --addopts="-v --niters=50 --cov=fsl --cov-report=html" -Take a look at the [Documentation for -developers](http://users.fmrib.ox.ac.uk/~paulmc/fslpy/index.html), and the -[requirements.txt file](requirements.txt) for details on -``fslpy`` dependencies, if you want to program with `fslpy`. +A code coverage report will be generated in `htmlcov/`. diff --git a/doc/conf.py b/doc/conf.py index 94e3adae9345561abf4f6a9c4e797adc679ca29f..a7fb2b4d202b8f8256f827ccad8cf34c42860d32 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -55,7 +55,7 @@ master_doc = 'index' # General information about the project. project = u'fslpy' -copyright = u'{}, Paul McCarthy, FMRIB Centre, University of Oxford'.format( +copyright = u'{}, Paul McCarthy, University of Oxford, Oxford, UK'.format( date.year) # Links to other things diff --git a/requirements.txt b/requirements.txt index a3a37761aec3a4129560a4f44798707fd14d5460..f7781906448fd4b0630bfd75a88ebbf3f5e5bb79 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,6 @@ -cython>=0.24 -six>=1.10.0 -numpy>=1.11.1 -matplotlib>=1.5.1 -nibabel>=2.1 -sphinx>=1.4.1 -sphinx-rtd-theme>=0.1.9 -indexed_gzip>=0.3.1 +six>=1.10.0,<2.0 +numpy>=1.11.1,<2.0 +matplotlib>=1.5.1,<=2.0.0 +nibabel>=2.1,<3.0 +indexed_gzip>=0.3.1,<0.4 +wxPython==3.0.2.0 diff --git a/setup.py b/setup.py index e8d2bb2acaa6d3ddb075c35ddf5f2866988b5e0c..0d5ba189db431976c1e52c6a18d003fa4f92c735 100644 --- a/setup.py +++ b/setup.py @@ -5,15 +5,28 @@ # Author: Paul McCarthy <pauldmccarthy@gmail.com> # -import os.path as op + +from __future__ import print_function + +import os +import os.path as op +import subprocess as sp +import shutil +import pkgutil from setuptools import setup from setuptools import find_packages +from setuptools import Command # The directory in which this setup.py file is contained. basedir = op.dirname(__file__) +# Dependencies are listed in requirements.txt +install_requires = open(op.join(basedir, 'requirements.txt'), 'rt').readlines() + +packages = find_packages( + exclude=('doc', 'tests', 'dist', 'build', 'fslpy.egg-info')) # 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. @@ -26,10 +39,35 @@ with open(op.join(basedir, "fsl", "version.py")) as f: exec(line, version) break -install_requires = open(op.join(basedir, 'requirements.txt'), 'rt').readlines() -dependency_links = [i for i in install_requires if i.startswith('git')] -install_requires = [i for i in install_requires if not i.startswith('git')] +class doc(Command): + """Build the API documentation. """ + + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + + docdir = op.join(basedir, 'doc') + destdir = op.join(docdir, 'html') + + if op.exists(destdir): + shutil.rmtree(destdir) + + env = dict(os.environ) + ppath = [op.join(pkgutil.get_loader('fsl').filename, '..')] + + env['PYTHONPATH'] = op.pathsep.join(ppath) + + print('Building documentation [{}]'.format(destdir)) + + sp.call(['sphinx-build', docdir, destdir], env=env) + setup( @@ -52,17 +90,19 @@ setup( 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3.5', 'Topic :: Software Development :: Libraries :: Python Modules'], - packages=find_packages(exclude=('doc', 'tests')), + packages=packages, install_requires=install_requires, - dependency_links=dependency_links, setup_requires=['pytest-runner'], tests_require=['pytest', 'pytest-runner'], test_suite='tests', + cmdclass={'doc' : doc}, + entry_points={ 'console_scripts' : [ 'fslpy_imcp = fsl.scripts.imcp:main',