Skip to content

Commit

Permalink
Merge pull request #32 from catalystneuro/update_template
Browse files Browse the repository at this point in the history
Minor update to use latest template
  • Loading branch information
pauladkisson authored Aug 21, 2024
2 parents 7583a8a + 13196de commit 057781d
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 275 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/run_all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,20 @@ jobs:
if: ${{ matrix.requirements == 'minimum' }}
run: |
python -m pip install -r requirements-min.txt -r requirements-dev.txt
python -m pip install -e .
python -m pip install .
- name: Install run requirements (pinned)
if: ${{ matrix.requirements == 'pinned' }}
run: |
python -m pip install -r requirements-dev.txt
python -m pip install -e .
python -m pip install .
- name: Install run requirements (upgraded)
if: ${{ matrix.requirements == 'upgraded' }}
run: |
python -m pip install -r requirements-dev.txt
python -m pip install -U -e .
# force upgrade of all dependencies to latest versions within allowed range
python -m pip install -U --upgrade-strategy eager .
- name: Run tests
run: |
Expand Down Expand Up @@ -146,19 +147,19 @@ jobs:
if: ${{ matrix.requirements == 'minimum' }}
run: |
python -m pip install -r requirements-min.txt -r requirements-dev.txt
python -m pip install -e .
python -m pip install .
- name: Install run requirements (pinned)
if: ${{ matrix.requirements == 'pinned' }}
run: |
python -m pip install -r requirements-dev.txt
python -m pip install -e .
python -m pip install .
- name: Install run requirements (upgraded)
if: ${{ matrix.requirements == 'upgraded' }}
run: |
python -m pip install -r requirements-dev.txt
python -m pip install -U -e .
python -m pip install -U --upgrade-strategy eager .
- name: Run tests
run: |
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/run_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ jobs:
- name: Install package
run: |
python -m pip install -e . # must install in editable mode for coverage to find sources
python -m pip install .
python -m pip list
- name: Run tests and generate coverage report
run: |
pytest --cov
python -m coverage xml # codecov uploader requires xml format
python -m coverage report -m
pytest --cov --cov-report=xml --cov-report=term # codecov uploader requires xml format
# TODO uncomment after setting up repo on codecov.io
# - name: Upload coverage to Codecov
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/validate_schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Validate schema

on:
push:
pull_request:
workflow_dispatch:

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install HDMF
run: |
pip install hdmf
- name: Download latest nwb schema language specification
run: |
curl -L https://raw.githubusercontent.com/NeurodataWithoutBorders/nwb-schema/dev/nwb.schema.json -o nwb.schema.json
- name: Validate schema specification
run: |
validate_hdmf_spec spec -m nwb.schema.json
165 changes: 0 additions & 165 deletions notebooks/example.ipynb

This file was deleted.

40 changes: 19 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,44 +43,42 @@ dependencies = [
# "Discussions" = "https://github.com/organization/package/discussions"
# "Changelog" = "https://github.com/organization/package/blob/main/CHANGELOG.md"

[tool.hatch.build]
include = [
"src/pynwb",
"spec/ndx-fiber-photometry.extensions.yaml",
"spec/ndx-fiber-photometry.namespace.yaml",
]
exclude = [
"src/pynwb/tests",
]

# Include only the source code under `src/pynwb/ndx_fiber_photometry` and the spec files under `spec`
# in the wheel.
[tool.hatch.build.targets.wheel]
packages = [
"src/pynwb/ndx_fiber_photometry",
"spec"
]

# Rewrite the path to the `spec` directory to `{{ cookiecutter.py_pkg_name }}/spec`.
# `{{ cookiecutter.py_pkg_name }}/__init__.py` will look there first for the spec files.
# The resulting directory structure within the wheel will be:
# {{ cookiecutter.py_pkg_name }}/
# ├── __init__.py
# ├── spec
# └── widgets
[tool.hatch.build.targets.wheel.sources]
"spec" = "ndx_fiber_photometry/spec"

# The source distribution includes everything in the package except for the `src/matnwb` directory and
# git and github-related files.
[tool.hatch.build.targets.sdist]
include = [
"src/pynwb",
"spec/ndx-fiber-photometry.extensions.yaml",
"spec/ndx-fiber-photometry.namespace.yaml",
"docs",
exclude = [
".git*",
"src/matnwb",
]
exclude = []

[tool.pytest.ini_options]
# uncomment below to run pytest with code coverage reporting. NOTE: breakpoints may not work
# uncomment below to run pytest always with code coverage reporting. NOTE: breakpoints may not work
# addopts = "--cov --cov-report html"

[tool.codespell]
skip = "htmlcov,.git,.mypy_cache,.pytest_cache,.coverage,*.pdf,*.svg,venvs,.tox,hdmf-common-schema,./docs/_build/*,*.ipynb"

[tool.coverage.run]
branch = true
source = ["src/pynwb"]
source = ["ndx_fiber_photometry"]

[tool.coverage.report]
exclude_lines = [
Expand All @@ -94,7 +92,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",
Expand All @@ -105,9 +103,9 @@ exclude = [
]
line-length = 120

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"src/pynwb/ndx_fiber_photometry/__init__.py" = ["E402", "F401"]
"src/spec/create_extension_spec.py" = ["T201"]

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 17
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ codespell==2.2.6
coverage==7.4.4
hdmf==3.14.2
hdmf-docutils==0.4.7
nwbwidgets==0.11.3
# nwbwidgets==0.11.3
pre-commit==3.5.0
pynwb==2.8.1
pytest==8.1.1
Expand Down
8 changes: 1 addition & 7 deletions src/pynwb/ndx_fiber_photometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@
EdgeOpticalFilter = get_class("EdgeOpticalFilter", "ndx-fiber-photometry")
FiberPhotometry = get_class("FiberPhotometry", "ndx-fiber-photometry")
from .fiber_photometry import FiberPhotometryTable

FiberPhotometryResponseSeries = get_class("FiberPhotometryResponseSeries", "ndx-fiber-photometry")
CommandedVoltageSeries = get_class("CommandedVoltageSeries", "ndx-fiber-photometry")


# NOTE: `widgets/tetrode_series_widget.py` adds a "widget"
# attribute to the TetrodeSeries class. This attribute is used by NWBWidgets.
# Delete the `widgets` subpackage or the `tetrode_series_widget.py` module
# if you do not want to define a custom widget for your extension neurodata
# type.

# Remove these functions from the package
del load_namespaces, get_class
12 changes: 7 additions & 5 deletions src/pynwb/ndx_fiber_photometry/fiber_photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@

FiberPhotometryTable = get_class("FiberPhotometryTable", "ndx-fiber-photometry")


@docval(
{'name': 'region', 'type': list, 'doc': 'the indices of the FiberPhotometryTable'},
{'name': 'description', 'type': str, 'doc': 'a brief description of what these table entries represent'},
{"name": "region", "type": list, "doc": "the indices of the FiberPhotometryTable"},
{"name": "description", "type": str, "doc": "a brief description of what these table entries represent"},
)
def create_fiber_photometry_table_region(self, **kwargs):
region, description = popargs('region', 'description', kwargs)
name = 'fiber_photometry_table_region'
region, description = popargs("region", "description", kwargs)
name = "fiber_photometry_table_region"
return super(FiberPhotometryTable, self).create_region(name=name, region=region, description=description)

FiberPhotometryTable.create_fiber_photometry_table_region = create_fiber_photometry_table_region

FiberPhotometryTable.create_fiber_photometry_table_region = create_fiber_photometry_table_region
6 changes: 0 additions & 6 deletions src/pynwb/ndx_fiber_photometry/widgets/README.md

This file was deleted.

Loading

0 comments on commit 057781d

Please sign in to comment.