From 5a3fb22c9abb93ef575869fe2ff615a56a198e21 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 5 Oct 2022 11:40:11 +0200 Subject: [PATCH 1/9] Draft to move from setup.py to pyproject.toml --- .github/workflows/io-test.yml | 3 +- .readthedocs.yaml | 4 +- doc/requirements_docs.txt | 3 -- environment_testing.yml | 2 - neo/__init__.py | 4 +- neo/io/nixio.py | 2 +- neo/version.py | 1 - pyproject.toml | 84 +++++++++++++++++++++++++++++++++++ requirements.txt | 3 -- requirements_testing.txt | 18 -------- setup.py | 60 ++----------------------- tox.ini | 10 ----- 12 files changed, 95 insertions(+), 99 deletions(-) delete mode 100644 doc/requirements_docs.txt delete mode 100644 neo/version.py create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 requirements_testing.txt delete mode 100644 tox.ini diff --git a/.github/workflows/io-test.yml b/.github/workflows/io-test.yml index 700eb88b3..dbf13946f 100644 --- a/.github/workflows/io-test.yml +++ b/.github/workflows/io-test.yml @@ -59,7 +59,7 @@ jobs: id: cache-conda-env with: path: /usr/share/miniconda/envs/neo-test-env - key: ${{ runner.os }}-conda-env-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements_testing.txt') }}-${{ hashFiles('**/environment_testing.txt') }}-${{ steps.date.outputs.date }} + key: ${{ runner.os }}-conda-env-${{ hashFiles('**/pyproject.toml') }}-${{ steps.date.outputs.date }} - name: Install testing dependencies # testing environment is only installed if no cache was found @@ -74,6 +74,7 @@ jobs: - name: Install neo run: | + pip install .[test] pip install --upgrade -e . - name: Test with pytest diff --git a/.readthedocs.yaml b/.readthedocs.yaml index f85923cc6..7d671aabb 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -12,4 +12,6 @@ python: install: - method: pip path: . - - requirements: doc/requirements_docs.txt + extra_requirements: + - docs + diff --git a/doc/requirements_docs.txt b/doc/requirements_docs.txt deleted file mode 100644 index ffb1703c3..000000000 --- a/doc/requirements_docs.txt +++ /dev/null @@ -1,3 +0,0 @@ -docutils<0.18 -numpy>=1.16.1 -quantities>=0.12.1 diff --git a/environment_testing.yml b/environment_testing.yml index 80020c2aa..8ff8bd984 100644 --- a/environment_testing.yml +++ b/environment_testing.yml @@ -4,5 +4,3 @@ channels: dependencies: - datalad - pip - - pip: - - -r requirements_testing.txt \ No newline at end of file diff --git a/neo/__init__.py b/neo/__init__.py index 69df6b7a5..6cc61f6ca 100644 --- a/neo/__init__.py +++ b/neo/__init__.py @@ -2,6 +2,8 @@ Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats ''' +import importlib.metadata +__version__ = importlib.metadata.version("neo") import logging @@ -9,5 +11,3 @@ from neo.core import * from neo.io import * - -from neo.version import version as __version__ diff --git a/neo/io/nixio.py b/neo/io/nixio.py index 923f89161..cb6285ecc 100644 --- a/neo/io/nixio.py +++ b/neo/io/nixio.py @@ -37,7 +37,7 @@ IrregularlySampledSignal, Epoch, Event, SpikeTrain, ImageSequence, ChannelView, Group) from ..io.proxyobjects import BaseProxy -from ..version import version as neover +from .. import __version__ as neover datetime_types = (date, time, datetime) diff --git a/neo/version.py b/neo/version.py deleted file mode 100644 index eafbe38bb..000000000 --- a/neo/version.py +++ /dev/null @@ -1 +0,0 @@ -version = '0.12.0.dev0' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..2ae60f946 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,84 @@ +[project] +name = "neo" +version = "0.12.0.dev0" + +authors = [ + { name="Samuel Garcia", email="samuel.garcia@cnrs.fr" }, + { name="Andrew Davison", email="andrew.davison@cnrs.fr" }, + { name="Julia Sprenger", email="julia.sprenger@univ-amu.fr" }, + { name="Michael Denker", email="m.denker@fz-juelich.de" }, +] + +description = "Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats" + +readme = "README.rst" +requires-python = ">=3.7" +license = {text = "BSD 3-Clause License"} +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", + "Intended Audience :: Science/Research", + "Natural Language :: English", + "Topic :: Scientific/Engineering", +] + +dependencies = [ + "packaging", + "numpy>=1.18.5", + "quantities>=0.12.1", +] + +[project.urls] +"Homepage" = "https://neuralensemble.org/neo" + +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[tool.setuptools.packages.find] +where = ["neo"] + +[project.optional-dependencies] + +test = [ + "pytest", + "pytest-cov", + + # datalad # this dependency is covered by conda (environment_testing.yml) + "scipy>=1.0.0", + "pyedflib", + "h5py", + "igor", + "klusta", + "tqdm", + "nixio", + "matplotlib", + "ipython", + "coverage", + "coveralls", + "pillow", + "sonpy", + "pynwb", + "probeinterface", +] + +docs = [ + "docutils<0.18", +] + +igorproio = ['igor'] +kwikio = ['klusta'] +neomatlabio = ['scipy>=1.0.0'] +nixio = ['nixio>=1.5.0'] +stimfitio = ['stfio'] +tiffio = ['pillow'] +edf = ['pyedflib'] +ced = ['sonpy'] +nwb = ['pynwb'] +maxwell = ['h5py'] +biocam = ['h5py'] + +# TODO [all] + + + diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 299eac70b..000000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -packaging -numpy>=1.18.5 -quantities>=0.12.1 diff --git a/requirements_testing.txt b/requirements_testing.txt deleted file mode 100644 index 4cec16df6..000000000 --- a/requirements_testing.txt +++ /dev/null @@ -1,18 +0,0 @@ -pytest -pytest-cov -# datalad # this dependency is covered by conda (environment_testing.yml) -scipy>=1.0.0 -pyedflib -h5py -igor -klusta -tqdm -nixio -matplotlib -ipython -coverage -coveralls -pillow -sonpy -pynwb -probeinterface diff --git a/setup.py b/setup.py index 6ce0dce63..39b4ce3f6 100755 --- a/setup.py +++ b/setup.py @@ -1,58 +1,4 @@ -#!/usr/bin/env python +import setuptools -from setuptools import setup, find_packages -import os - -long_description = open("README.rst").read() -install_requires = ['packaging', - 'numpy>=1.18.5', - 'quantities>=0.12.1'] -extras_require = { - 'igorproio': ['igor'], - 'kwikio': ['klusta'], - 'neomatlabio': ['scipy>=1.0.0'], - 'nixio': ['nixio>=1.5.0'], - 'stimfitio': ['stfio'], - 'tiffio': ['pillow'], - 'edf': ['pyedflib'], - 'ced': ['sonpy'], - 'nwb': ['pynwb'], - 'maxwell': ['h5py'], - 'biocam': ['h5py'], -} -extras_require["all"] = sum(extras_require.values(), []) - -with open("neo/version.py") as fp: - d = {} - exec(fp.read(), d) - neo_version = d['version'] - -setup( - name="neo", - version=neo_version, - packages=find_packages(), - install_requires=install_requires, - extras_require=extras_require, - author="Neo authors and contributors", - author_email="samuel.garcia@cnrs.fr", - description="Neo is a package for representing electrophysiology data in " - "Python, together with support for reading a wide range of " - "neurophysiology file formats", - long_description=long_description, - license="BSD-3-Clause", - url='https://neuralensemble.org/neo', - python_requires=">=3.7", - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: BSD License', - 'Natural Language :: English', - 'Operating System :: OS Independent', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3 :: Only', - 'Topic :: Scientific/Engineering'] -) +if __name__ == "__main__": + setuptools.setup() diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 1741643b8..000000000 --- a/tox.ini +++ /dev/null @@ -1,10 +0,0 @@ -[tox] -envlist = py35, py36, py37 -[testenv] -commands=nosetests {posargs} -deps = - # essential - numpy>=1.7.1,!=1.16.0 - quantities>=0.9.0 - # for running tests - nose>=1.1.2 From 6bd93c62aa8947d0429694be1d8a534462fd6520 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 5 Oct 2022 13:53:18 +0200 Subject: [PATCH 2/9] Adress some andrew's comments. --- .github/workflows/io-test.yml | 2 +- neo/__init__.py | 6 +++--- pyproject.toml | 7 +------ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/io-test.yml b/.github/workflows/io-test.yml index dbf13946f..a72039438 100644 --- a/.github/workflows/io-test.yml +++ b/.github/workflows/io-test.yml @@ -74,8 +74,8 @@ jobs: - name: Install neo run: | - pip install .[test] pip install --upgrade -e . + pip install .[test] - name: Test with pytest run: | diff --git a/neo/__init__.py b/neo/__init__.py index 6cc61f6ca..4300abb78 100644 --- a/neo/__init__.py +++ b/neo/__init__.py @@ -2,12 +2,12 @@ Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats ''' -import importlib.metadata -__version__ = importlib.metadata.version("neo") - import logging logging_handler = logging.StreamHandler() from neo.core import * from neo.io import * + +import importlib.metadata +__version__ = importlib.metadata.version("neo") diff --git a/pyproject.toml b/pyproject.toml index 2ae60f946..fe2c6123e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,12 +2,7 @@ name = "neo" version = "0.12.0.dev0" -authors = [ - { name="Samuel Garcia", email="samuel.garcia@cnrs.fr" }, - { name="Andrew Davison", email="andrew.davison@cnrs.fr" }, - { name="Julia Sprenger", email="julia.sprenger@univ-amu.fr" }, - { name="Michael Denker", email="m.denker@fz-juelich.de" }, -] +authors = "Neo authors and contributors" description = "Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats" From 8246640b1794d470306920b639b0439bf9b26c10 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 5 Oct 2022 14:33:33 +0200 Subject: [PATCH 3/9] oups --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index fe2c6123e..78c5b3917 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "neo" version = "0.12.0.dev0" -authors = "Neo authors and contributors" +authors = [{name = "Neo authors and contributors"}] description = "Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats" From 05c823b94f19d99c21499a306fc4f0f084933807 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 5 Oct 2022 21:14:10 +0200 Subject: [PATCH 4/9] fix version and install --- doc/source/conf.py | 9 ++++----- pyproject.toml | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 9f6942cde..c6243c0f3 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -13,17 +13,16 @@ import os import sys +import re from packaging.version import Version -with open("../../neo/version.py") as fp: - d = {} - exec(fp.read(), d) - neo_release = d['version'] +with open('../../pyproject.toml', mode='r') as f: + txt = f.read() + neo_release = re.findall('version = "(\S+)"', txt)[0] neo_version = '.'.join((str(e) for e in Version(neo_release).release[:2])) - AUTHORS = 'Neo authors and contributors ' # If extensions (or modules to document with autodoc) are in another directory, diff --git a/pyproject.toml b/pyproject.toml index 78c5b3917..4d4ab21c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,8 +30,8 @@ dependencies = [ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" -[tool.setuptools.packages.find] -where = ["neo"] +[tool.setuptools.packages] +find = {} [project.optional-dependencies] From 58fd97825c6ad5a75b0eabced79b4c70ffaa1057 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Wed, 5 Oct 2022 21:16:43 +0200 Subject: [PATCH 5/9] Fix init with version at begining --- neo/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/neo/__init__.py b/neo/__init__.py index 4300abb78..05696df84 100644 --- a/neo/__init__.py +++ b/neo/__init__.py @@ -2,6 +2,10 @@ Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats ''' +import importlib.metadata +# this need to be at the begining because some sub module will need the version +__version__ = importlib.metadata.version("neo") + import logging logging_handler = logging.StreamHandler() @@ -9,5 +13,3 @@ from neo.core import * from neo.io import * -import importlib.metadata -__version__ = importlib.metadata.version("neo") From 234fb2d1ebcfadae9ea44d778fc901a5db8ef27e Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Tue, 18 Oct 2022 16:02:17 +0200 Subject: [PATCH 6/9] Better handling of setuptools --- pyproject.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4d4ab21c4..4010c0cb7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,11 +27,12 @@ dependencies = [ "Homepage" = "https://neuralensemble.org/neo" [build-system] -requires = ["setuptools>=61.0"] +requires = ["setuptools>=62.0"] build-backend = "setuptools.build_meta" -[tool.setuptools.packages] -find = {} +[tool.setuptools] +packages = ["neo"] +package-dir = {"neo" = "neo"} [project.optional-dependencies] From 80ced982e255932d3f7750cc10902dff758ef7f7 Mon Sep 17 00:00:00 2001 From: Samuel Garcia Date: Tue, 18 Oct 2022 17:42:02 +0200 Subject: [PATCH 7/9] Remove 3.7 from core test --- .github/workflows/core-test.yml | 8 ++------ .github/workflows/io-test.yml | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/core-test.yml b/.github/workflows/core-test.yml index 9af86c4f5..69aa4daee 100644 --- a/.github/workflows/core-test.yml +++ b/.github/workflows/core-test.yml @@ -20,13 +20,9 @@ jobs: matrix: os: ["ubuntu-latest", "windows-latest"] # "macos-latest", - python-version: ['3.7', '3.8', '3.9', '3.10'] - numpy-version: ['1.18.5', '1.19.5', '1.20.3', '1.21.6', '1.22.4', '1.23.0'] + python-version: ['3.8', '3.9', '3.10'] + numpy-version: [ '1.20.3', '1.21.6', '1.22.4', '1.23.4'] exclude: - - python-version: '3.7' - numpy-version: '1.22.4' - - python-version: '3.7' - numpy-version: '1.23.0' - python-version: '3.10' numpy-version: '1.18.5' - python-version: '3.10' diff --git a/.github/workflows/io-test.yml b/.github/workflows/io-test.yml index a72039438..c46b12c76 100644 --- a/.github/workflows/io-test.yml +++ b/.github/workflows/io-test.yml @@ -19,7 +19,7 @@ jobs: matrix: # "macos-latest", "windows-latest" os: ["ubuntu-latest", ] - python-version: ['3.8', ] + python-version: ['3.9', ] defaults: # by default run in bash mode (required for conda usage) run: From 677038edd3328e7cbed7158be21cbcb106e01b52 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Thu, 16 Feb 2023 15:39:00 +0100 Subject: [PATCH 8/9] Update pyproject.toml --- pyproject.toml | 73 +++++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 27 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4010c0cb7..509150ace 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,45 +1,48 @@ [project] name = "neo" version = "0.12.0.dev0" - authors = [{name = "Neo authors and contributors"}] - description = "Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats" - readme = "README.rst" -requires-python = ">=3.7" +requires-python = ">=3.8" license = {text = "BSD 3-Clause License"} classifiers = [ + "Development Status :: 4 - Beta", "Programming Language :: Python :: 3", "Operating System :: OS Independent", "Intended Audience :: Science/Research", "Natural Language :: English", "Topic :: Scientific/Engineering", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3 :: Only", ] dependencies = [ "packaging", - "numpy>=1.18.5", - "quantities>=0.12.1", + "numpy>=1.19.5", + "quantities>=0.14.0", ] [project.urls] -"Homepage" = "https://neuralensemble.org/neo" +homepage = "https://neuralensemble.org/neo" +documentation = "http://neo.readthedocs.io/" +repository = "https://github.com/NeuralEnsemble/python-neo" +download = "http://pypi.python.org/pypi/neo" + [build-system] requires = ["setuptools>=62.0"] build-backend = "setuptools.build_meta" -[tool.setuptools] -packages = ["neo"] -package-dir = {"neo" = "neo"} - [project.optional-dependencies] test = [ "pytest", "pytest-cov", - # datalad # this dependency is covered by conda (environment_testing.yml) "scipy>=1.0.0", "pyedflib", @@ -62,19 +65,35 @@ docs = [ "docutils<0.18", ] -igorproio = ['igor'] -kwikio = ['klusta'] -neomatlabio = ['scipy>=1.0.0'] -nixio = ['nixio>=1.5.0'] -stimfitio = ['stfio'] -tiffio = ['pillow'] -edf = ['pyedflib'] -ced = ['sonpy'] -nwb = ['pynwb'] -maxwell = ['h5py'] -biocam = ['h5py'] - -# TODO [all] - - +igorproio = ["igor"] +kwikio = ["klusta"] +neomatlabio = ["scipy>=1.0.0"] +nixio = ["nixio>=1.5.0"] +stimfitio = ["stfio"] +tiffio = ["pillow"] +edf = ["pyedflib"] +ced = ["sonpy"] +nwb = ["pynwb"] +maxwell = ["h5py"] +biocam = ["h5py"] +all = [ + "coverage", + "coveralls", + "h5py", + "igor", + "ipython", + "klusta", + "matplotlib", + "nixio>=1.5.0", + "pillow", + "probeinterface" + "pyedflib", + "pynwb", + "pytest", + "pytest-cov", + "scipy>=1.0.0", + "sonpy", + "tqdm, +] +# we do not include 'stfio' in 'all' as it is not pip installable From 9ea34c6a11f222b39c84c8a6ddf5b0143e0af295 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Thu, 16 Feb 2023 15:40:38 +0100 Subject: [PATCH 9/9] fix typos --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 509150ace..75464938d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,13 +87,13 @@ all = [ "matplotlib", "nixio>=1.5.0", "pillow", - "probeinterface" + "probeinterface", "pyedflib", "pynwb", "pytest", "pytest-cov", "scipy>=1.0.0", "sonpy", - "tqdm, + "tqdm", ] # we do not include 'stfio' in 'all' as it is not pip installable