diff --git a/continuous_integration/conda_min_version.sh b/.ci/conda_min_version.sh similarity index 100% rename from continuous_integration/conda_min_version.sh rename to .ci/conda_min_version.sh diff --git a/continuous_integration/test_notebooks.sh b/.ci/test_notebooks.sh similarity index 100% rename from continuous_integration/test_notebooks.sh rename to .ci/test_notebooks.sh diff --git a/.travis.yml b/.travis.yml index 9a3f1b68..ad9127ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,8 @@ cache: directories: # Cache files downloaded by pip - $HOME/.cache/pip + # Cache our miniconda download. + - $HOME/Downloads ############################################################################### # version numbers @@ -31,30 +33,33 @@ python: # environment variables env: - TEST_NOTEBOOKS="false" - USE_OLDEST_DEPENDENCIES="false" + USE_OLDEST_DEPS="false" - TEST_NOTEBOOKS="false" - USE_OLDEST_DEPENDENCIES="true" + USE_OLDEST_DEPS="true" - TEST_NOTEBOOKS="true" - USE_OLDEST_DEPENDENCIES="false" + USE_OLDEST_DEPS="false" - TEST_NOTEBOOKS="true" - USE_OLDEST_DEPENDENCIES="true" + USE_OLDEST_DEPS="true" matrix: exclude: # Currently, SIMA cannot be installed on Python 3.7 - python: "3.7" - env: TEST_NOTEBOOKS="true" USE_OLDEST_DEPENDENCIES="false" + env: TEST_NOTEBOOKS="true" USE_OLDEST_DEPS="false" - python: "3.7" - env: TEST_NOTEBOOKS="true" USE_OLDEST_DEPENDENCIES="true" + env: TEST_NOTEBOOKS="true" USE_OLDEST_DEPS="true" # Currently, can't use our conda min numpy/scipy version detector on Travis # with weird Python 3.7 - python: "3.7" - env: TEST_NOTEBOOKS="false" USE_OLDEST_DEPENDENCIES="true" + env: TEST_NOTEBOOKS="false" USE_OLDEST_DEPS="true" allow_failures: - - env: TEST_NOTEBOOKS="true" USE_OLDEST_DEPENDENCIES="true" + - env: TEST_NOTEBOOKS="true" USE_OLDEST_DEPS="true" # Currently, 'SIMA example.ipynb' is failing with Python 2.7. - python: "2.7" - env: TEST_NOTEBOOKS="true" USE_OLDEST_DEPENDENCIES="false" + env: TEST_NOTEBOOKS="true" USE_OLDEST_DEPS="false" + # Mark as failure as soon as a required job fails. Otherwise, mark as success + # as soon the only remaining jobs are allowed to fail. + fast_finish: true ############################################################################### # Setup the environment before installing @@ -68,11 +73,11 @@ before_install: # Check which versions of numpy and scipy we are using, then remove these # lines from requirements.txt - if [ -f requirements.txt ]; then - NUMPY_REQUIREMENT="$(grep '^numpy\([<>=!]\|$\)' requirements.txt)"; + NUMPY_REQUIREMENT="$(grep '^numpy\([!<>=~ ]\|$\)' requirements.txt)"; echo "NumPy requirement is '$NUMPY_REQUIREMENT'"; - SCIPY_REQUIREMENT="$(grep '^scipy\([<>=!]\|$\)' requirements.txt)"; + SCIPY_REQUIREMENT="$(grep '^scipy\([!<>=~ ]\|$\)' requirements.txt)"; echo "SciPy requirement is '$SCIPY_REQUIREMENT'"; - sed '/^\(num\|sci\)py\([<>=!]\|$\)/d' requirements.txt > + sed '/^\(num\|sci\)py\([!<>=~ ]\|$\)/d' requirements.txt > requirements.txt.tmp && mv requirements.txt.tmp requirements.txt; fi; @@ -88,20 +93,21 @@ before_install: # --------------------------------------------------------------------------- # If we want to run the tests using the oldest set of dependencies we # support, modify any *requirements*.txt files every '>=' becomes '=='. - - if [[ "$USE_OLDEST_DEPENDENCIES" == "true" ]]; then + # Undo swapping any requirements which say version>=, since they are for + # our environment markers. + - if [[ "$USE_OLDEST_DEPS" == "true" ]]; then for FILE in *requirements*.txt; do sed -e 's/>=/~=/g' $FILE > $FILE.tmp && mv $FILE.tmp $FILE; + sed -e 's/version\s*~=/version>=/g' $FILE > $FILE.tmp && mv $FILE.tmp $FILE; done; fi; # --------------------------------------------------------------------------- # The following is based on Minicoda's how-to Travis page # http://conda.pydata.org/docs/travis.html # --------------------------------------------------------------------------- - # Download miniconda. Only do this if the cached file isn't present. + # Download miniconda. No need to redownload if we already have the latest version cached. - mkdir -p $HOME/Downloads; - if [ ! -f $HOME/Downloads/miniconda.sh ]; then - travis_retry wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O "$HOME/Downloads/miniconda.sh"; - fi; + travis_retry wget -c https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O "$HOME/Downloads/miniconda.sh"; # Install miniconda to the home directory, if it isn't there already. - if [ ! -d "$HOME/miniconda/bin" ]; then if [ -d "$HOME/miniconda" ]; then rm -r "$HOME/miniconda"; fi; @@ -127,15 +133,21 @@ before_install: # possible requirement when scipy is being installed. The version of numpy # we end up must still satisfy the original requirement.txt setting, and # be from around the time of the oldest supported scipy release. - - if [[ "$USE_OLDEST_DEPENDENCIES" == "true" ]]; then + - if [[ "$USE_OLDEST_DEPS" == "true" ]]; then if [[ "$SCIPY_REQUIREMENT" != "" ]]; then - SCIPY_REQUIREMENT="scipy==$(bash - ./continuous_integration/conda_min_version.sh + SCIPY_VERSION="$(bash + ./.ci/conda_min_version.sh "$SCIPY_REQUIREMENT" "$TRAVIS_PYTHON_VERSION")"; + if [[ "$SCIPY_VERSION" != "" ]]; then + SCIPY_REQUIREMENT="scipy==$SCIPY_VERSION"; + fi; elif [[ "$NUMPY_REQUIREMENT" != "" ]]; then - NUMPY_REQUIREMENT="numpy==$(bash - ./continuous_integration/conda_min_version.sh + NUMPY_VERSION="$(bash + ./.ci/conda_min_version.sh "$NUMPY_REQUIREMENT" "$TRAVIS_PYTHON_VERSION")"; + if [[ "$NUMPY_VERSION" != "" ]]; then + NUMPY_REQUIREMENT="numpy==$NUMPY_VERSION"; + fi; fi; fi; # Create the conda environment with pip, numpy and scipy installed (if they @@ -152,7 +164,7 @@ before_install: # # This is because you have constrained the numpy version in requirements.txt # to a more recent set of values (e.g. numpy>=1.9.0) than the scipy - # constraint (e.g. scipy>=0.12.0). The USE_OLDEST_DEPENDENCIES code has + # constraint (e.g. scipy>=0.12.0). The USE_OLDEST_DEPS code has # looked up the oldest compatible version available on conda (scipy==0.12.0) # but there is no numpy version for this which matches your constraint. # @@ -240,7 +252,7 @@ script: fi; # Test the notebooks - if [[ "$TEST_NOTEBOOKS" == "true" ]]; then - ./continuous_integration/test_notebooks.sh -i ./examples; + ./.ci/test_notebooks.sh -i ./examples; fi; ############################################################################### diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 0b7de201..484c0ac7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,31 @@ Categories for changes are: Added, Changed, Deprecated, Removed, Fixed, Security. +Version `0.6.2 `__ +--------------------------------------------------------------------- + +Release date: 2020-03-11. +Full commit changelog +`on github `__. + +Fixed +~~~~~ + +- Specify a maximum version for tifffile dependency on Python <3.6, which + allows us to continue supporting Python 2.7 and 3.5, which otherwise + fail to import dependencies correctly. + (`#87 `__) +- Documentation fixes and updates. + (`#64 `__, + `#65 `__, + `#67 `__, + `#76 `__, + `#77 `__, + `#78 `__, + `#79 `__, + `#92 `__) + + Version `0.6.1 `__ --------------------------------------------------------------------- diff --git a/HOWTO_RELEASE.md b/HOWTO_RELEASE.md index 2913c158..592b66d5 100644 --- a/HOWTO_RELEASE.md +++ b/HOWTO_RELEASE.md @@ -146,7 +146,7 @@ Follow the instructions in the [PyPI tutorial](https://packaging.python.org/tuto rm -rf dist python -m pip install --upgrade setuptools wheel python -m pip install --upgrade twine -python setup.py sdist bdist_wheel +python setup.py sdist bdist_wheel --universal ``` ## 6. Test the submission diff --git a/LICENSE b/LICENSE index 9cecc1d4..f288702d 100755 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - {one line to give the program's name and a brief idea of what it does.} - Copyright (C) {year} {name of author} + + Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -645,14 +645,14 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - {project} Copyright (C) {year} {fullname} + Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. +. diff --git a/README.rst b/README.rst index 290b1bf5..d7b93a06 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -|Gitter| |Travis| |Documentation| |Codecov| |Coveralls| +|Gitter| |PyPI badge| |Travis| |Documentation| |Codecov| |Coveralls| FISSA @@ -12,7 +12,9 @@ importing files stored in other formats. For details of the algorithm, please see our `companion paper `__ published in -Scientific Reports. +Scientific Reports. For the code used to generate the simulated data +in the companion paper, see the +`SimCalc repository `__. FISSA is compatible with both Python 2.7 and Python 3.5+. Using Python 3 is strongly encouraged, as Python 2 will no longer be `maintained @@ -181,11 +183,18 @@ interactive python session with the ``exit()`` command, or CTRL+D. Folder Structure ---------------- -continuous_integration/ -~~~~~~~~~~~~~~~~~~~~~~~ +A clone of this repository will contain directories detailed below. -Contains files necessary for deploying tests on continuous integration -servers. Users should ignore this directory. +docs/ +~~~~~ + +Contains the source for the documentation, which is available online at +``_. +You can build a local copy of the documentation by running the command + +:: + + make -C docs html examples/ ~~~~~~~~~ @@ -213,6 +222,12 @@ fissa/tests/ Contains tests for the toolbox, which are run to ensure it will work as expected. +.ci/ +~~~~ + +Contains files necessary for deploying tests on continuous integration +servers. Users should ignore this directory. + Citing FISSA ------------ @@ -223,7 +238,7 @@ S. W. Keemink, S. C. Lowe, J. M. P. Pakan, E. Dylda, M. C. W. van Rossum, and N. L. Rochefort. FISSA: A neuropil decontamination toolbox for calcium imaging signals, *Scientific Reports*, **8**\ (1):3493, 2018. -`DOI:10.1038/s41598-018-21640-2 `__. +`doi: 10.1038/s41598-018-21640-2 `__. For your convenience, the FISSA package ships with a copy of this citation in bibtex format, available at @@ -238,7 +253,7 @@ reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2 of the License, or (at your +Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but @@ -252,6 +267,9 @@ with this program. If not, see http://www.gnu.org/licenses/. .. |Gitter| image:: https://badges.gitter.im/Join%20Chat.svg :target: https://gitter.im/rochefort-lab/fissa :alt: Join the FISSA chat +.. |PyPI badge| image:: https://badge.fury.io/py/fissa.svg + :target: https://badge.fury.io/py/fissa + :alt: Latest PyPI release .. |Travis| image:: https://travis-ci.org/rochefort-lab/fissa.svg?branch=master :target: https://travis-ci.org/rochefort-lab/fissa :alt: Travis Build Status diff --git a/citation.bib b/citation.bib index 1082bac6..ef4c34f7 100644 --- a/citation.bib +++ b/citation.bib @@ -5,7 +5,7 @@ @article{fissa and Dylda, Evelyn and van Rossum, Mark C. W. and Rochefort, Nathalie L.}, - title={{FISSA}: A neuropil decontamination toolbox for calcium imaging signals}, + title={{FISSA}: {A} neuropil decontamination toolbox for calcium imaging signals}, journal={Scientific Reports}, year={2018}, volume={8}, diff --git a/docs/conf.py b/docs/conf.py index 5c2d4c7f..dfd29490 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,20 +12,22 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # +import datetime import os import sys sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath('../')) -from fissa import __meta__ as meta + +from fissa import __meta__ as meta # noqa: E402 # -- Project information ----------------------------------------------------- -import datetime now = datetime.datetime.now() project = meta.name.upper() +project_path = meta.path author = meta.author copyright = '{}, {}'.format(now.year, author) @@ -40,7 +42,7 @@ def run_apidoc(_): ignore_paths = [ - os.path.join('..', project.lower(), 'tests'), + os.path.join('..', project_path, 'tests'), ] argv = [ @@ -49,7 +51,7 @@ def run_apidoc(_): "--separate", # Put each module file in its own page "--module-first", # Put module documentation before submodule "-o", "source/packages", # Output path - os.path.join("..", project.lower()), + os.path.join("..", project_path), ] + ignore_paths try: @@ -62,13 +64,16 @@ def run_apidoc(_): argv.insert(0, apidoc.__file__) apidoc.main(argv) + def retitle_modules(_): pth = 'source/packages/modules.rst' lines = open(pth).read().splitlines() - lines[0] = 'API' - lines[1] = '===' + # Overwrite the junk in the first two lines with a better title + lines[0] = 'API Reference' + lines[1] = '=============' open(pth, 'w').write('\n'.join(lines)) + def setup(app): app.connect('builder-inited', run_apidoc) app.connect('builder-inited', retitle_modules) diff --git a/fissa/__meta__.py b/fissa/__meta__.py index 2964be88..2350d362 100644 --- a/fissa/__meta__.py +++ b/fissa/__meta__.py @@ -1,6 +1,6 @@ name = 'fissa' path = name -version = '0.6.1' +version = '0.6.2' author = "Sander Keemink & Scott Lowe" author_email = "swkeemink@scimail.eu" description = "A Python Library estimating somatic signals in 2-photon data" diff --git a/fissa/tests/test_datahandler_framebyframe.py b/fissa/tests/test_datahandler_framebyframe.py index 4a907e90..0f6079f4 100755 --- a/fissa/tests/test_datahandler_framebyframe.py +++ b/fissa/tests/test_datahandler_framebyframe.py @@ -4,7 +4,7 @@ import os import numpy as np -from scipy.misc import imsave +import imageio from PIL import Image from .base_test import BaseTestCase @@ -18,7 +18,7 @@ def setup_class(self): self.expected = np.array([[1, 2, 3], [5, 6, 7], [8, 9, 10]], dtype=np.uint8) # make tif - imsave('test.tif', self.expected) + imageio.imwrite('test.tif', self.expected) def test_actual_tiff(self): # load from tif diff --git a/requirements-dev.txt b/requirements-dev.txt index 7bb576f5..06a0f586 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,5 @@ pytest pytest-cov pytest-flake8 +imageio>=2.5.0; python_version>='3' +imageio>=2.5.0, <2.8.0; python_version<'3' diff --git a/requirements.txt b/requirements.txt index 668a4aa3..cfa7513c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,5 +4,6 @@ future>=0.16.0 scikit-learn>=0.17.0 scikit-image>=0.12.3 shapely>=1.5.17 -tifffile>=0.10.0 +tifffile>=0.10.0; python_version>='3.6' +tifffile>=0.10.0,<=2019.7.26; python_version<'3.6' Pillow>=3.0.0 diff --git a/setup.py b/setup.py index 0865fa12..ef065c86 100644 --- a/setup.py +++ b/setup.py @@ -61,10 +61,31 @@ def run_tests(self): packages = [meta['name']], license = "GNU", long_description = read('README.rst'), + # https://pypi.org/pypi?%3Aaction=list_classifiers classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Natural Language :: English", + "Operating System :: OS Independent", "Programming Language :: Python", - "Topic :: Scientific/Engineering" + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Bio-Informatics", + "Topic :: Scientific/Engineering :: Information Analysis", ], + project_urls={ + "Documentation": "https://fissa.readthedocs.io", + "Source Code": "https://github.com/rochefort-lab/fissa", + "Bug Tracker": "https://github.com/rochefort-lab/fissa/issues", + "Citation": "https://www.doi.org/10.1038/s41598-018-21640-2", + }, cmdclass = {'test': PyTest}, )