diff --git a/.readthedocs.yml b/.readthedocs.yml index e4fdd9c3..feda75c0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,9 +7,10 @@ build: python: install: - - requirements: requirements-rtd.txt - method: pip path: . + extra_requirements: + - docs sphinx: configuration: docs/source/conf.py diff --git a/CHANGELOG.md b/CHANGELOG.md index fe7e4349..86b55bb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ ### Fixes +## Improvements +* Use `pyproject.toml` for project metadata and installation requirements [#382](https://github.com/catalystneuro/roiextractors/pull/382) + # v0.5.10 (November 6th, 2024) diff --git a/docs/source/gettingstarted.rst b/docs/source/gettingstarted.rst index a21bf207..68633101 100644 --- a/docs/source/gettingstarted.rst +++ b/docs/source/gettingstarted.rst @@ -9,17 +9,23 @@ Installation $ pip install roiextractors -#. You can check for any missing packages by explicitly installing from the `requirements `_ file: - .. code-block:: shell - - $ pip install -r requirements.txt #. **Cloning the github repo**: .. code-block:: shell $ git clone https://github.com/SpikeInterface/spikeinterface.git $ cd spikeinterface - $ python setup.py install (or develop) + $ pip install --editable . + +You can also install the optional dependencies by installing the package with the following command: + +.. code-block:: shell + + $ pip install "roiextractors[full]" + $ pip install "roiextractors[test]" + $ pip install "roiextractors[docs]" + +These commands install the full, test, and documentation dependencies, respectively. What is RoiExtractors --------------------- diff --git a/pyproject.toml b/pyproject.toml index b9b26627..9c92d600 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,84 @@ +[build-system] +requires = ["setuptools>=64"] +build-backend = "setuptools.build_meta" + +[project] +name = "roiextractors" +version = "0.5.11" +description = "Python module for extracting optical physiology ROIs and traces for various file types and formats" +readme = "README.md" +license = { file = "LICENSE.txt" } +authors = [ + { name = "Heberto Mayorquin" }, + { name = "Szonja Weigl" }, + { name = "Cody Baker" }, + { name = "Ben Dichter", email = "ben.dichter@gmail.com" }, + { name = "Alessio Buccino" }, + { name = "Paul Adkisson" }, + { name = "Alessandra Trapani" } +] +keywords = ["ROI", "extraction", "optical physiology"] +classifiers = [ + "Intended Audience :: Science/Research", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Operating System :: POSIX :: Linux", + "Operating System :: Microsoft :: Windows", + "Operating System :: MacOS", + "License :: OSI Approved :: BSD License", +] +requires-python = ">=3.9" + +dependencies = [ + "h5py>=2.10.0", + "pynwb>=2.0.1", + "tqdm>=4.48.2", + "lazy_ops>=0.2.0", + "dill>=0.3.2", + "scipy>=1.5.2", + "psutil>=5.8.0", + "PyYAML", + "lxml", + "packaging" +] + +[project.optional-dependencies] +full = [ + "tifffile>=2018.10.18", + "scanimage-tiff-reader>=1.4.1.4", + "neuroconv[video]>=0.4.6", + "opencv-python-headless>=4.8.1.78", + "natsort>=8.3.1", + "isx>=1.0.4" +] +test = [ + "pytest", + "pytest-cov", + "parameterized==0.8.1", + "spikeinterface>=0.100.7", + "pytest-xdist" +] +docs = [ + "Jinja2", + "Sphinx", + "sphinx_rtd_theme", + "readthedocs-sphinx-search", + "sphinx-toggleprompt", + "sphinx-copybutton", + "pydata_sphinx_theme" +] + +[project.urls] +"Homepage" = "https://github.com/catalystneuro/roiextractors" +"Documentation" = "https://roiextractors.readthedocs.io//" +"Changelog" = "https://github.com/catalystneuro/roiextractors/blob/main/CHANGELOG.md" + +[tool.setuptools.packages.find] +where = ["src"] + + [tool.black] line-length = 120 diff --git a/requirements-full.txt b/requirements-full.txt deleted file mode 100644 index 7dc4aead..00000000 --- a/requirements-full.txt +++ /dev/null @@ -1,6 +0,0 @@ -tifffile>=2018.10.18 -scanimage-tiff-reader>=1.4.1.4 -neuroconv[video]>=0.4.6 # Uses the VideoCaptureContext class -opencv-python-headless>=4.8.1.78 -natsort>=8.3.1 -isx>=1.0.4 diff --git a/requirements-minimal.txt b/requirements-minimal.txt deleted file mode 100644 index 6a8d39d7..00000000 --- a/requirements-minimal.txt +++ /dev/null @@ -1,10 +0,0 @@ -h5py>=2.10.0 -pynwb>=2.0.1 -tqdm>=4.48.2 -lazy_ops>=0.2.0 -dill>=0.3.2 -scipy>=1.5.2 -psutil>=5.8.0 -PyYAML -lxml -packaging diff --git a/requirements-rtd.txt b/requirements-rtd.txt deleted file mode 100644 index 403fb912..00000000 --- a/requirements-rtd.txt +++ /dev/null @@ -1,7 +0,0 @@ -Jinja2 -Sphinx -sphinx_rtd_theme -readthedocs-sphinx-search -sphinx-toggleprompt -sphinx-copybutton -pydata_sphinx_theme diff --git a/requirements-testing.txt b/requirements-testing.txt deleted file mode 100644 index 3e67494c..00000000 --- a/requirements-testing.txt +++ /dev/null @@ -1,5 +0,0 @@ -pytest -pytest-cov -parameterized==0.8.1 -spikeinterface>=0.100.7 -pytest-xdist diff --git a/setup.py b/setup.py deleted file mode 100644 index 52c38140..00000000 --- a/setup.py +++ /dev/null @@ -1,38 +0,0 @@ -from pathlib import Path -from setuptools import setup, find_packages -from shutil import copy as copy_file - - -root = Path(__file__).parent -with open(root / "README.md") as f: - long_description = f.read() -with open(root / "requirements-minimal.txt") as f: - install_requires = f.readlines() -with open(root / "requirements-full.txt") as f: - full_dependencies = f.readlines() -with open(root / "requirements-testing.txt") as f: - testing_dependencies = f.readlines() -extras_require = dict(full=full_dependencies, test=testing_dependencies) - -# Create a local copy for the gin test configuration file based on the master file `base_gin_test_config.json` -gin_config_file_base = root / "base_gin_test_config.json" -gin_config_file_local = root / "tests" / "gin_test_config.json" -if not gin_config_file_local.exists(): - copy_file(src=gin_config_file_base, dst=gin_config_file_local) - -setup( - name="roiextractors", - version="0.5.11", - author="Heberto Mayorquin, Szonja Weigl, Cody Baker, Ben Dichter, Alessio Buccino, Paul Adkisson, Alessandra Trapani", - author_email="ben.dichter@gmail.com", - description="Python module for extracting optical physiology ROIs and traces for various file types and formats", - url="https://github.com/catalystneuro/roiextractors", - long_description=long_description, - long_description_content_type="text/markdown", - packages=find_packages(where="src"), - package_dir={"": "src"}, - include_package_data=True, # Includes files described in MANIFEST.in in the installation. - python_requires=">=3.7", - install_requires=install_requires, - extras_require=extras_require, -) diff --git a/tests/setup_paths.py b/tests/setup_paths.py index ff499b38..5430bd5d 100644 --- a/tests/setup_paths.py +++ b/tests/setup_paths.py @@ -1,15 +1,15 @@ import os -import json +import tempfile from pathlib import Path -from tempfile import mkdtemp +from shutil import copy +import json -import pytest +# Output by default to a temporary directory +OUTPUT_PATH = Path(tempfile.mkdtemp()) -file_path = Path(__file__).parent / "gin_test_config.json" +# Load the configuration for the data tests -with open(file=file_path) as f: - test_config_dict = json.load(f) if os.getenv("CI"): LOCAL_PATH = Path(".") # Must be set to "." for CI @@ -17,15 +17,27 @@ else: # Override LOCAL_PATH in the `gin_test_config.json` file to a point on your system that contains the dataset folder # Use DANDIHub at hub.dandiarchive.org for open, free use of data found in the /shared/catalystneuro/ directory + test_config_path = Path(__file__).parent / "gin_test_config.json" + config_file_exists = test_config_path.exists() + if not config_file_exists: + + root = test_config_path.parent.parent + base_test_config_path = root / "base_gin_test_config.json" + + test_config_path.parent.mkdir(parents=True, exist_ok=True) + copy(src=base_test_config_path, dst=test_config_path) + + with open(file=test_config_path) as f: + # Load the configuration for the data tests + test_config_dict = json.load(f) + LOCAL_PATH = Path(test_config_dict["LOCAL_PATH"]) - print("Running GIN tests locally!") + + if test_config_dict["SAVE_OUTPUTS"]: + OUTPUT_PATH = LOCAL_PATH / "neuroconv_test_outputs" + OUTPUT_PATH.mkdir(exist_ok=True, parents=True) + OPHYS_DATA_PATH = LOCAL_PATH / "ophys_testing_data" -if not OPHYS_DATA_PATH.exists(): - pytest.fail(f"No folder found in location: {OPHYS_DATA_PATH}!") -if test_config_dict["SAVE_OUTPUTS"]: - OUTPUT_PATH = LOCAL_PATH / "example_nwb_output" - OUTPUT_PATH.mkdir(exist_ok=True) -else: - OUTPUT_PATH = Path(mkdtemp()) +TEXT_DATA_PATH = Path(__file__).parent.parent.parent / "tests" / "test_text"