diff --git a/.github/workflows/run_single_test.yml b/.github/workflows/run_single_test.yml new file mode 100644 index 0000000..851a271 --- /dev/null +++ b/.github/workflows/run_single_test.yml @@ -0,0 +1,158 @@ +name: Run one test +on: + push: + branches: ["*"] + pull_request: + branches: ["*"] + +jobs: + run-all-tests: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + include: + - { name: linux-python3.8-minimum , requirements: minimum , python-ver: "3.8" , os: ubuntu-latest } + + steps: + - name: Cancel non-latest runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + all_but_latest: true + access_token: ${{ github.token }} + + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: 0 # fetch tags + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-ver }} + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + python -m pip list + python -m pip check + + - name: Install run requirements (minimum) + if: ${{ matrix.requirements == 'minimum' }} + run: | + python -m pip install -r requirements-min.txt -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (pinned) + if: ${{ matrix.requirements == 'pinned' }} + run: | + python -m pip install -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (upgraded) + if: ${{ matrix.requirements == 'upgraded' }} + run: | + python -m pip install -r requirements-dev.txt + python -m pip install -U -e . + + - name: Run tests + run: | + pytest -v + + - name: Build wheel and source distribution + run: | + python -m pip install --upgrade build + python -m build + ls -1 dist + + - name: Test installation from a wheel (POSIX) + if: ${{ matrix.os != 'windows-latest' }} + run: | + python -m venv test-wheel-env + source test-wheel-env/bin/activate + python -m pip install dist/*-none-any.whl + python -c "import ndx_hed" + + - name: Test installation from a wheel (windows) + if: ${{ matrix.os == 'windows-latest' }} + run: | + python -m venv test-wheel-env + test-wheel-env/Scripts/activate.bat + python -m pip install dist/*-none-any.whl + python -c "import ndx_hed" + + run-all-tests-on-conda: + name: ${{ matrix.name }} + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} # needed for conda environment to work + strategy: + fail-fast: false + matrix: + include: + - { name: conda-linux-python3.8-minimum , requirements: minimum , python-ver: "3.8" , os: ubuntu-latest } + steps: + - name: Cancel any previous incomplete runs + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + + - uses: actions/checkout@v3 + with: + submodules: 'recursive' + fetch-depth: 0 # fetch tags + + - name: Set up Conda + uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + auto-activate-base: true + activate-environment: true + python-version: ${{ matrix.python-ver }} + + - name: Install build dependencies + run: | + conda config --set always_yes yes --set changeps1 no + conda info + conda config --show-sources + conda list --show-channel-urls + + - name: Install run requirements (minimum) + if: ${{ matrix.requirements == 'minimum' }} + run: | + python -m pip install -r requirements-min.txt -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (pinned) + if: ${{ matrix.requirements == 'pinned' }} + run: | + python -m pip install -r requirements-dev.txt + python -m pip install -e . + + - name: Install run requirements (upgraded) + if: ${{ matrix.requirements == 'upgraded' }} + run: | + python -m pip install -r requirements-dev.txt + python -m pip install -U -e . + + - name: Run tests + run: | + pytest -v + + - name: Build wheel and source distribution + run: | + python -m pip install --upgrade build + python -m build + ls -1 dist + + - name: Test installation from a wheel (POSIX) + run: | + python -m venv test-wheel-env + source test-wheel-env/bin/activate + python -m pip install dist/*-none-any.whl + python -c "import ndx_hed" diff --git a/pyproject.toml b/pyproject.toml index 0644760..97ac945 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ keywords = [ dependencies = [ "pynwb>=2.5.0", "hdmf>=3.10.0", + "hedtools>=0.4.0" ] # TODO: add URLs before release diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b3e6c0b..0000000 --- a/setup.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[wheel] -universal = 1 - -[flake8] -max-line-length = 120 -max-complexity = 17 -exclude = - .git, - .tox, - __pycache__, - build/, - dist/, - docs/source/conf.py - versioneer.py -per-file-ignores = - src/pynwb/tests/test_example_usage.py:T001 - - -[metadata] -description-file = README.md diff --git a/setup.py b/setup.py index e58d9b2..525b9a0 100644 --- a/setup.py +++ b/setup.py @@ -1,64 +1,69 @@ # -*- coding: utf-8 -*- -import os +from setuptools import setup -from setuptools import setup, find_packages -from shutil import copy2 +if __name__ == "__main__": + setup() -# 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) +# 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 365e445..e2419e6 100644 --- a/src/pynwb/ndx_hed/__init__.py +++ b/src/pynwb/ndx_hed/__init__.py @@ -5,7 +5,7 @@ ndx_hed_specpath = os.path.join( os.path.dirname(__file__), 'spec', - 'ndx-events.namespace.yaml' + 'ndx-hed.namespace.yaml' ) # If the extension has not been installed yet but we are running directly from