diff --git a/README.md b/README.md index d6c26e5..bd36281 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,4 @@ user guide explains in more detail how to use this extension for HED. pip install -U ndx-hed ``` -**Matlab:** The Matlab extension is under development +**Matlab:** The Matlab extension is under development. diff --git a/pyproject.toml b/pyproject.toml index 1ec18a8..26ddb0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -104,7 +104,7 @@ preview = true exclude = ".git|.mypy_cache|.tox|.venv|venv|.ipynb_checkpoints|_build/|dist/|__pypackages__|.ipynb|docs/" [tool.ruff] -select = ["E", "F", "T100", "T201", "T203"] +lint.select = ["E", "F", "T100", "T201", "T203"] exclude = [ ".git", ".tox", @@ -114,8 +114,8 @@ exclude = [ ] line-length = 120 -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "src/spec/create_extension_spec.py" = ["T201"] -[tool.ruff.mccabe] +[tool.ruff.lint.mccabe] max-complexity = 17 diff --git a/setup.py b/setup.py index 525b9a0..9bf0b62 100644 --- a/setup.py +++ b/setup.py @@ -5,65 +5,3 @@ if __name__ == "__main__": setup() -# import os -# -# from setuptools import setup, find_packages -# from shutil import copy2 -# -# # load README.md/README.rst file -# try: -# if os.path.exists('README.md'): -# with open('README.md', 'r') as fp: -# readme = fp.read() -# readme_type = 'text/markdown; charset=UTF-8' -# elif os.path.exists('README.rst'): -# with open('README.rst', 'r') as fp: -# readme = fp.read() -# readme_type = 'text/x-rst; charset=UTF-8' -# else: -# readme = "" -# except Exception: -# readme = "" -# -# setup_args = { -# 'name': 'ndx-hed', -# 'version': '0.1.0', -# 'description': 'NWB extension for storing HED annotations in VectorData format.', -# 'long_description': readme, -# 'long_description_content_type': readme_type, -# 'author': 'Ryan Ly, Kay Robbins', -# 'author_email': 'rly@lbl.gov, Kay.Robbins@utsa.edu', -# 'url': 'https://github.com/hed-standard/ndx-hed', -# 'license': 'BSD 3-Clause', -# 'install_requires': [ -# 'pynwb>=1.1.2' -# ], -# 'packages': find_packages('src/pynwb'), -# 'package_dir': {'': 'src/pynwb'}, -# 'package_data': {'ndx_hed': [ -# 'spec/ndx-hed.namespace.yaml', -# 'spec/ndx-hed.extensions.yaml', -# ]}, -# 'classifiers': [ -# "Intended Audience :: Developers", -# "Intended Audience :: Science/Research", -# ], -# 'zip_safe': False -# } -# -# -# def _copy_spec_files(project_dir): -# ns_path = os.path.join(project_dir, 'spec', 'ndx-hed.namespace.yaml') -# ext_path = os.path.join(project_dir, 'spec', 'ndx-hed.extensions.yaml') -# -# dst_dir = os.path.join(project_dir, 'src', 'pynwb', 'ndx_hed', 'spec') -# if not os.path.exists(dst_dir): -# os.mkdir(dst_dir) -# -# copy2(ns_path, dst_dir) -# copy2(ext_path, dst_dir) -# -# -# if __name__ == '__main__': -# _copy_spec_files(os.path.dirname(__file__)) -# setup(**setup_args) diff --git a/src/pynwb/ndx_hed/__init__.py b/src/pynwb/ndx_hed/__init__.py index 0d7d4e6..c2055fa 100644 --- a/src/pynwb/ndx_hed/__init__.py +++ b/src/pynwb/ndx_hed/__init__.py @@ -2,14 +2,9 @@ from pynwb import load_namespaces, get_class # Set path of the namespace.yaml file to the expected install location -ndx_hed_specpath = os.path.join( - os.path.dirname(__file__), - 'spec', - 'ndx-hed.namespace.yaml' -) +ndx_hed_specpath = os.path.join(os.path.dirname(__file__), 'spec', 'ndx-hed.namespace.yaml') -# If the extension has not been installed yet but we are running directly from -# the git repo +# If the extension has not been installed yet, but we are running directly from the git repo if not os.path.exists(ndx_hed_specpath): ndx_hed_specpath = os.path.abspath(os.path.join( os.path.dirname(__file__), @@ -20,37 +15,7 @@ # Load the namespace load_namespaces(ndx_hed_specpath) -# -# from . import io as __io # noqa: E402,F401 -# from .hed_models import NWBHedVersion -# -# try: -# from importlib.resources import files -# except ImportError: -# # TODO: Remove when python 3.9 becomes the new minimum -# from importlib_resources import files -# -# -# -# # Get path to the namespace.yaml file with the expected location when installed not in editable mode -# __location_of_this_file = files(__name__) -# __spec_path = __location_of_this_file / "spec" / "ndx-hed.namespace.yaml" -# -# # If that path does not exist, we are likely running in editable mode. Use the local path instead -# if not os.path.exists(__spec_path): -# __spec_path = __location_of_this_file.parent.parent.parent / "spec" / "ndx-hed.namespace.yaml" -# -# # Load the namespace -# load_namespaces(str(__spec_path)) -# -# # TODO: Define your classes here to make them accessible at the package level. -# # Either have PyNWB generate a class from the spec using `get_class` as shown -# # below or write a custom class and register it using the class decorator -# # `@register_class("TetrodeSeries", "ndx-hed")` -# # HedAnnotations = get_class("HedAnnotations", "ndx-hed") -# HedVersion = get_class("HedVersion", "ndx-hed") -# -# # Remove these functions from the package + del load_namespaces, get_class -from .hed_tags import HedTags +#from .hed_tags import HedTags as HedTags diff --git a/src/pynwb/tests/test_hed_tags.py b/src/pynwb/tests/test_hed_tags.py index 3ed3d8e..809ce54 100644 --- a/src/pynwb/tests/test_hed_tags.py +++ b/src/pynwb/tests/test_hed_tags.py @@ -8,7 +8,7 @@ from pynwb import NWBHDF5IO, NWBFile from pynwb.testing.mock.file import mock_NWBFile from pynwb.testing import TestCase, remove_test_file -from ndx_hed import HedTags +from ndx_hed.hed_tags import HedTags class TestHedTagsConstructor(TestCase): @@ -68,7 +68,7 @@ def test_get(self): def test_temp(self): tags = HedTags(hed_version='8.3.0', data=["Correct-action", "Incorrect-action"]) tags.add_row("Sensory-event, Visual-presentation") - print(tags) + def test_dynamic_table(self): """Add a HED column to a DynamicTable.""" my_table = DynamicTable( diff --git a/src/spec/create_extension_spec.py b/src/spec/create_extension_spec.py index 5704488..f396951 100644 --- a/src/spec/create_extension_spec.py +++ b/src/spec/create_extension_spec.py @@ -1,10 +1,7 @@ # -*- coding: utf-8 -*- import os.path -from pynwb.spec import NWBNamespaceBuilder, export_spec, NWBDatasetSpec, NWBGroupSpec, NWBAttributeSpec - -# TODO: import other spec classes as needed -# from pynwb.spec import , NWBLinkSpec, NWBDtypeSpec, NWBRefSpec +from pynwb.spec import NWBNamespaceBuilder, export_spec, NWBDatasetSpec, NWBAttributeSpec def main():