Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap to pyproject.toml setup #507

Merged
merged 15 commits into from
Sep 17, 2024
2 changes: 0 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)




Expand Down
38 changes: 31 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
<img src="docs/logo/logo.png" width="300">
<p align="center">
<img src="https://raw.githubusercontent.com/neurodatawithoutborders/nwbinspector/dev/docs/logo/logo.png" width="250" alt="NWB Inspector logo"/>

CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
<p align="center">
<a href="https://pypi.org/project/dandi_s3_log_parser/"><img alt="Supported Python versions" src="https://img.shields.io/pypi/pyversions/nwbinspector.svg"></a>
<a href="https://codecov.io/github/CatalystNeuro/dandi_s3_log_parser?branch=main"><img alt="codecov" src="https://codecov.io/github/NeurodataWithoutBorders/nwbinspector/coverage.svg?branch=main"></a>
</p>
<p align="center">
<a href="https://pypi.org/project/nwbinpsector/"><img alt="PyPI latest release version" src="https://badge.fury.io/py/nwbinspector.svg?id=py&kill_cache=1"></a>
<a href="https://github.com/NeurodataWithoutBorders/nwbinspector/blob/dev/license.txt"><img alt="License: BSD-3" src="https://img.shields.io/pypi/l/nwbinspector.svg"></a>
</p>
<p align="center">
<a href="https://github.com/psf/black"><img alt="Python code style: Black" src="https://img.shields.io/badge/python_code_style-black-000000.svg"></a>
<a href="https://github.com/astral-sh/ruff"><img alt="Python code style: Ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json"></a>
</p>
<p align="center">
<a href="https://nwbinspector.readthedocs.io/"><img alt="Documentation build status" src="https://readthedocs.org/projects/nwbinspector/badge/?version=dev"></a>
<a href="https://github.com/NeurodataWithoutBorders/nwbinspector/actions/workflows/dailies.yml/badge.svg"><img alt="Daily tests" src="https://github.com/NeurodataWithoutBorders/nwbinspector/actions/workflows/dailies.yml/badge.svg"></a>
</p>
</p>

CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
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
Expand All @@ -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).
23 changes: 23 additions & 0 deletions docs/.readthedocs.yaml
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied over these two RTD files to start a smooth transition to keeping the files there instead of the outer level to reduce clutter

It works fine as long as the settings on the RTD admin page are adjusted, which is why I will wait until after this PR is merged to do that and then remove the files still at the outer level (so it doesn't break on the other current PRs)

Original file line number Diff line number Diff line change
@@ -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: .
7 changes: 7 additions & 0 deletions docs/requirements-rtd.txt
Original file line number Diff line number Diff line change
@@ -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
64 changes: 64 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,67 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "nwbinspector"
version = "0.6.0"
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
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"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also removes Python 3.8 support, which ends its security upgrades next month

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"
CodyCBakerPhD marked this conversation as resolved.
Show resolved Hide resolved
]

[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']
Expand Down
15 changes: 0 additions & 15 deletions requirements.txt

This file was deleted.

13 changes: 0 additions & 13 deletions setup.cfg

This file was deleted.

39 changes: 0 additions & 39 deletions setup.py

This file was deleted.

6 changes: 5 additions & 1 deletion src/nwbinspector/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/nwbinspector/_nwbinspector_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Primary functions for inspecting NWBFiles."""

import importlib
import importlib.metadata
import json
import os
from pathlib import Path
Expand All @@ -18,7 +19,6 @@
)
from ._nwb_inspection import inspect_all
from ._types import Importance
from ._version import __version__
from .utils import strtobool


Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/nwbinspector/_version.py

This file was deleted.

4 changes: 3 additions & 1 deletion src/nwbinspector/version/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import importlib.metadata

import warnings

message = (
Expand All @@ -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")
Loading