diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 86336f379..9a8b80e9b 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -31,8 +31,6 @@ jobs: pip install pytest pip install pytest-cov - - name: Install ROS3 - run: conda install -c conda-forge h5py - name: Install package run: pip install ".[dandi]" - name: Download testing data and set config path diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b6856826..357e75628 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ * Removed the `robust_ros3_read` utility helper. [#506](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/506) * Simplified the `nwbinspector.testing` configuration framework. [#509](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/509) * Cleaned old references to non-recent PyNWB and HDMF versions. Current policy is that latest NWB Inspector releases should only support compatibility with latest PyNWB and HDMF. [#510](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/510) +* Swapped setup approach to the modern `pyproject.toml` standard. [#507](https://github.com/NeurodataWithoutBorders/nwbinspector/pull/507) + diff --git a/README.md b/README.md index d4e68e73e..0be426641 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,40 @@ - +

+ NWB Inspector logo + +

+ Supported Python versions + codecov +

+

+ PyPI latest release version + License: BSD-3 +

+

+ Python code style: Black + Python code style: Ruff +

+

+ Documentation build status + Daily tests +

+

+ +Inspect NWB files for compliance with [NWB Best Practices](https://nwbinspector.readthedocs.io/en/dev/best_practices/best_practices_index.html). + +This inspector is meant as a companion to the PyNWB validator, which checks for strict schema compliance. This tool attempts to apply some common sense to find components of the file that are technically compliant, but possibly incorrect, suboptimal in their representation, or deviate from best practices. + +This tool is meant simply as a data review aid. It does not catch all possible violations of best practices and any warnings it does produce should be checked by a knowledgeable reviewer. -[![PyPI version](https://badge.fury.io/py/nwbinspector.svg)](https://badge.fury.io/py/nwbinspector) -[![ReadTheDocs](https://readthedocs.org/projects/nwbinspector/badge/?version=dev)](https://nwbinspector.readthedocs.io/) -![Tests](https://github.com/NeurodataWithoutBorders/nwbinspector/actions/workflows/dailies.yml/badge.svg) -[![codecov](https://codecov.io/gh/NeurodataWithoutBorders/nwbinspector/branch/dev/graphs/badge.svg?branch=dev)](https://codecov.io/github/NeurodataWithoutBorders/nwbinspector?branch=dev) -[![License](https://img.shields.io/pypi/l/nwbinspector.svg)](https://github.com/NeurodataWithoutBorders/nwbinspector/blob/dev/license.txt) -Inspect NWB files for compliance with [NWB Best Practices](https://nwbinspector.readthedocs.io/en/dev/best_practices/best_practices_index.html). This inspector is meant as a companion to the PyNWB validator, which checks for strict schema compliance. In contrast, this tool attempts to apply some common sense to find components of the file that are technically compliant, but possibly incorrect, suboptimal in their representation, or deviate from best practices. This tool is meant simply as a data review aid. It does not catch all best practice violations, and any warnings it does produce should be checked by a knowledgeable reviewer. ## Installation + ```bash pip install nwbinspector ``` + + ## Usage ```bash @@ -22,3 +44,5 @@ nwbinspector path/to/my/data.nwb # supply a path to a directory containing NWB files nwbinspector path/to/my/data/folder/ ``` + +Read about more detailed usage in the main [documentation](https://nwbinspector.readthedocs.io/en/dev/user_guide/user_guide_index.html). diff --git a/docs/.readthedocs.yaml b/docs/.readthedocs.yaml new file mode 100644 index 000000000..a0d4dd7b1 --- /dev/null +++ b/docs/.readthedocs.yaml @@ -0,0 +1,23 @@ +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the version of Python and other tools you might need +build: + os: ubuntu-20.04 + tools: + python: "3.9" + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + fail_on_warning: true + +# Python requirements required to build your docs +python: + install: + - requirements: requirements-rtd.txt + - method: pip + path: . diff --git a/docs/requirements-rtd.txt b/docs/requirements-rtd.txt new file mode 100644 index 000000000..cf9500d54 --- /dev/null +++ b/docs/requirements-rtd.txt @@ -0,0 +1,7 @@ +numpy +jsonschema==3.2.0 +Jinja2>=3.1.3 +sphinx==5.1.1 +sphinx_rtd_theme==0.5.1 +readthedocs-sphinx-search==0.3.2 +sphinx-copybutton==0.5.0 diff --git a/pyproject.toml b/pyproject.toml index e49d1e1e0..afb56999e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,67 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "nwbinspector" +version = "0.6.0" +description = "Tool to inspect NWB files for best practices compliance." +readme = "README.md" +authors = [ + {name = "Cody Baker"}, + {name = "Steph Prince"}, + {name = "Szonja Weigl"}, + {name = "Heberto Mayorquin"}, + {name = "Paul Adkisson"}, + {name = "Luiz Tauffer"}, + {name = "Ben Dichter", email = "ben.dichter@catalystneuro.com"} +] +urls = { "Homepage" = "https://github.com/NeurodataWithoutBorders/nwbinspector" } +license = {file = "license.txt"} +keywords = ["nwb"] +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 = [ + "pynwb>=2.8", # NWB Inspector should always be used with most recent minor versions of PyNWB + "hdmf-zarr", + "fsspec", + "s3fs", + "requests", + "aiohttp", + "PyYAML", + "jsonschema", + "packaging", + "natsort", + "click", + "tqdm", + "isodate", + "numpy>=1.22.0,<2.0.0" # TODO: add compatibility for 2.0 +] + +[project.optional-dependencies] +dandi = [ + "dandi", + "remfile", +] + +[tool.setuptools.packages.find] +where = ["src"] + +[project.scripts] +nwbinspector = "nwbinspector._nwbinspector_cli:_nwbinspector_cli" + + + [tool.black] line-length = 120 target-version = ['py37'] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index b7e024f8f..000000000 --- a/requirements.txt +++ /dev/null @@ -1,15 +0,0 @@ -pynwb>=2.8 # NWB Inspector should always be used with most recent minor versions of PyNWB -hdmf-zarr -fsspec -s3fs -requests -aiohttp -PyYAML -jsonschema -packaging -natsort -click -tqdm -isodate -numpy>=1.20.0,<1.21.0;python_version<'3.8' -numpy>=1.22.0,<2.0.0;python_version>='3.8' diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index cad5e3cfd..000000000 --- a/setup.cfg +++ /dev/null @@ -1,13 +0,0 @@ -[metadata] -license_files = license.txt - -[flake8] -max-line-length = 120 -exclude = - .git, - __pycache__, - build/, - dist/, - docs -per-file-ignores = - nwbinspector/__init__.py:F401,F403 diff --git a/setup.py b/setup.py deleted file mode 100644 index 8a8b8253e..000000000 --- a/setup.py +++ /dev/null @@ -1,39 +0,0 @@ -from pathlib import Path - -from setuptools import find_packages, setup - -root = Path(__file__).parent -with open(root / "README.md", "r") as f: - long_description = f.read() -with open(root / "requirements.txt") as f: - install_requires = f.readlines() -with open(root / "src" / "nwbinspector" / "_version.py") as f: - version = f.read() - -setup( - name="nwbinspector", - version=version.split('"')[1], - description="Tool to inspect NWB files for best practices compliance.", - long_description=long_description, - long_description_content_type="text/markdown", - author="Ryan Ly, Ben Dichter, and Cody Baker.", - author_email="rly@lbl.gov, ben.dichter@gmail.com, cody.baker@catalystneuro.com", - url="https://nwbinspector.readthedocs.io/", - keywords="nwb", - packages=find_packages(where="src"), - package_dir={"": "src"}, - include_package_data=True, # Includes files described in MANIFEST.in in the installation - install_requires=install_requires, - # zarr<2.18.0 because of https://github.com/NeurodataWithoutBorders/nwbinspector/pull/460 - extras_require=dict(dandi=["dandi>=0.39.2", "zarr<2.18.0", "remfile"], zarr=["hdmf_zarr>=0.3.0", "zarr<2.18.0"]), - entry_points={"console_scripts": ["nwbinspector=nwbinspector._nwbinspector_cli:_nwbinspector_cli"]}, - license="BSD-3-Clause", - classifiers=[ - "Development Status :: 4 - Beta", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - ], -) diff --git a/src/nwbinspector/__init__.py b/src/nwbinspector/__init__.py index 0c403bd34..4c5f6a3d6 100644 --- a/src/nwbinspector/__init__.py +++ b/src/nwbinspector/__init__.py @@ -1,4 +1,5 @@ -from ._version import __version__ +import importlib.metadata + from ._registration import available_checks, register_check from ._types import Importance, Severity, InspectorMessage from ._configuration import load_config, validate_config, configure_checks @@ -22,6 +23,9 @@ default_check_registry = {check.__name__: check for check in available_checks} +# Still keeping the legacy magic version attribute requested by some users +__version__ = importlib.metadata.version(distribution_name="nwbinspector") + __all__ = [ "available_checks", "default_check_registry", diff --git a/src/nwbinspector/_nwbinspector_cli.py b/src/nwbinspector/_nwbinspector_cli.py index 6296cb4b8..6e9fa5678 100644 --- a/src/nwbinspector/_nwbinspector_cli.py +++ b/src/nwbinspector/_nwbinspector_cli.py @@ -1,6 +1,7 @@ """Primary functions for inspecting NWBFiles.""" import importlib +import importlib.metadata import json import os from pathlib import Path @@ -18,7 +19,6 @@ ) from ._nwb_inspection import inspect_all from ._types import Importance -from ._version import __version__ from .utils import strtobool @@ -83,7 +83,7 @@ required=False, default=None, ) -@click.version_option(__version__) +@click.version_option(version=importlib.metadata.version(distribution_name="nwbinspector")) def _nwbinspector_cli( *, path: str, diff --git a/src/nwbinspector/_version.py b/src/nwbinspector/_version.py deleted file mode 100644 index 43a1e95ba..000000000 --- a/src/nwbinspector/_version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.5.3" diff --git a/src/nwbinspector/version/__init__.py b/src/nwbinspector/version/__init__.py index 3127748f2..ba6d8d0b1 100644 --- a/src/nwbinspector/version/__init__.py +++ b/src/nwbinspector/version/__init__.py @@ -1,3 +1,5 @@ +import importlib.metadata + import warnings message = ( @@ -9,4 +11,4 @@ # Still keep imports functional with warning for soft deprecation cycle # TODO: remove after 9/15/2024 -from .._version import __version__ +__version__ = importlib.metadata.version(distribution_name="nwbinspector")