diff --git a/.github/workflows/io-test.yml b/.github/workflows/io-test.yml index 8e416a669..26a923ae4 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: @@ -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 @@ -75,6 +75,7 @@ jobs: - name: Install neo run: | pip install --upgrade -e . + pip install .[test] - name: Test with pytest run: | 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/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/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..05696df84 100644 --- a/neo/__init__.py +++ b/neo/__init__.py @@ -2,6 +2,9 @@ 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 @@ -10,4 +13,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..75464938d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,99 @@ +[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.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.19.5", + "quantities>=0.14.0", +] + +[project.urls] +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" + +[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"] + +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 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index b7685f101..000000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -packaging -numpy>=1.19.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 old mode 100755 new mode 100644 index 9cb679363..94052e072 --- a/setup.py +++ b/setup.py @@ -1,61 +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.19.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(), []) - -# explicitly removing stfio from list of all as it is not pip installable -extras_require["all"].remove('stfio') - -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.8", - 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.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3 :: Only', - 'Topic :: Scientific/Engineering'] -) +if __name__ == "__main__": + setuptools.setup() \ No newline at end of file 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