Skip to content

Commit

Permalink
Update pyproject.toml and remove setup.py (#143)
Browse files Browse the repository at this point in the history
* Update pyproject.toml and remove setup.py

- Update version control to hatch backend
- Update pytest, coverage, and ruff via pyproject.toml

* Update __init__.py

* Delete versioneer.py

* Update .gitignore

* Create .git_archival.txt

* Update .gitattributes

* Create codespell.yml

* Create ruff.yml

* Update conf.py

* Update conf.py

* Update test_io_convert.py

* Update CHANGELOG.md

* Update base_tests_zarrio.py

* Update test_fsspec_streaming.py

* Update overview.rst

* Update storage.rst

* Update _version.py

* Update utils.py

* Update backend.py

* Update backend.py

* Update CHANGELOG.md

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

* Update pyproject.toml

Co-authored-by: Ryan Ly <[email protected]>

* Delete setup.cfg

* Delete setup.py

* Delete src/hdmf_zarr/_version.py

* Delete .github/workflows/run_flake8.yml

---------

Co-authored-by: Ryan Ly <[email protected]>
  • Loading branch information
mavaylon1 and rly authored Dec 7, 2023
1 parent 9c3b4be commit 5e48ab5
Show file tree
Hide file tree
Showing 21 changed files with 169 additions and 2,594 deletions.
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
src/hdmf_zarr/_version.py export-subst
.git_archival.txt export-subst
14 changes: 14 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Codespell
on:
pull_request:
workflow_dispatch:

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Codespell
uses: codespell-project/actions-codespell@v2
11 changes: 11 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Ruff
on: pull_request

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Run ruff
uses: chartboost/ruff-action@v1
30 changes: 0 additions & 30 deletions .github/workflows/run_flake8.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,6 @@ dmypy.json

# DS_Store
.DS_Store

# Version
_version.py
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Enhancements
* Added a new default to consolidate metadata in order more efficeintly traverse storage contents. @mavaylon1 [#142](https://github.com/hdmf-dev/hdmf-zarr/pull/142)
* Fix linking for FSSpec and support passing of `storage_options` required reading data from S3 #138. @alejoe91 [#120](https://github.com/hdmf-dev/hdmf-zarr/pull/138)
* Updated versioning to hatch-vcs and deprecated setup.py in full transition to `pyproject.toml`. @mavaylon1 [#143](https://github.com/hdmf-dev/hdmf-zarr/pull/143)

## 0.4.0 (October 3, 2023)

Expand Down Expand Up @@ -65,7 +66,7 @@
links/reference when moving Zarr files @oruebel [#46](https://github.com/hdmf-dev/hdmf-zarr/pull/46)
* Fixed bugs in requirements defined in setup.py @oruebel [#46](https://github.com/hdmf-dev/hdmf-zarr/pull/46)
* Fixed bug regarding Sphinx external links @mavaylon1 [#53](https://github.com/hdmf-dev/hdmf-zarr/pull/53)
* Updated gallery tests to use test_gallery.py and necessary package dependcies
* Updated gallery tests to use test_gallery.py and necessary package dependencies
@mavaylon1 [#53](https://github.com/hdmf-dev/hdmf-zarr/pull/53)
* Updated dateset used in conversion tutorial, which caused warnings
@oruebel [#56](https://github.com/hdmf-dev/hdmf-zarr/pull/56)
Expand Down
6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
# This lets us ensure that the source package is imported, and that its
# version is used.
sys.path.insert(0, os.path.join(project_root, 'src'))
from hdmf_zarr._version import get_versions

import hdmf_zarr

# -- Autodoc configuration -----------------------------------------------------
autoclass_content = 'both'
Expand All @@ -46,9 +46,9 @@
author = 'Oliver Ruebel, Matthew Avaylon'

# The short X.Y version.
version = '{}'.format(get_versions()['version'])
version = hdmf_zarr.__version__
# The full version, including alpha/beta/rc tags.
release = '{}'.format(get_versions()['version'])
release = hdmf_zarr.__version__

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Supported features
- Iterative data write using :py:class:`~hdmf.data_utils.AbstractDataChunkIterator`
- Parallel write with :py:class:`~hdmf.data_utils.GenericDataChunkIterator` (since v0.4)
- Lazy load of datasets
- Lazy load of datasets containing object refernces (since v0.4)
- Lazy load of datasets containing object references (since v0.4)

Known Limitations
-----------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ as JSON. Each dict (i.e., element) in the list defines a link, with each dict co
pointing to an object within the same Zarr file, the value of source will be ``"."``. For external
links that point to object in another Zarr file, the value of source will be the path to
the other Zarr file relative to the root path of the Zarr file containing the link.
* ``path`` : Path to the linked object within the Zarr file idenfied by the ``source`` key
* ``path`` : Path to the linked object within the Zarr file identified by the ``source`` key
* ``object_id``: Object id of the reference object. May be None in case the referenced object
does not have an assigned object_id (e.g., in the case we reference a dataset with a fixed
name but without and assigned ``data_type`` (or ``neurodata_type`` in the case of NWB).
Expand Down
107 changes: 107 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,87 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "hdmf_zarr"
authors = [
{ name="Oliver Ruebel", email="[email protected]" },
{ name="Matthew Avaylon", email="[email protected]" },
]
description = "A package defining a Zarr I/O backend for HDMF"
readme = "README.rst"
requires-python = ">=3.8"
license = {text = "BSD"}
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: BSD License",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Operating System :: Unix",
"Topic :: Scientific/Engineering :: Medical Science Apps."
]
dependencies = [
'hdmf>=3.9.0',
'zarr>=2.11.0',
'numpy>=1.24',
'numcodecs>=0.9.1',
'numcodecs==0.11.0',
'pynwb>=2.5.0',
'threadpoolctl>=3.1.0',
]
dynamic = ["version"]

[project.optional-dependencies]
tqdm = ["tqdm>=4.41.0"]
fsspec = ["fsspec"]
s3fs = ["s3fs"]

[project.urls]
"Homepage" = "https://github.com/hdmf-dev/hdmf-zarr"
"Bug Tracker" = "https://github.com/hdmf-dev/hdmf-zarr/issues"

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
# this file is created/updated when the package is installed and used in
# src/hdmf_zarr/__init__.py to set `hdmf_zarr.__version__`
# this allows the version to be accessible from python
version-file = "src/hdmf_zarr/_version.py"

[tool.hatch.build.targets.sdist]
exclude = [".git_archival.txt"]

[tool.hatch.build.targets.wheel]
packages = ["src/hdmf_zarr"]

[tool.pytest.ini_options]
addopts = "--cov --cov-report html"

[tool.codespell]
skip = "htmlcov,.git,.mypy_cache,.pytest_cache,.coverage,*.pdf,*.svg,venvs,.tox,./docs/_build/*,*.ipynb"
ignore-words-list = "datas"

[tool.coverage.run]
branch = true
source = ["src/"]
omit = [
"src/hdmf_zarr/_due.py",
]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"@abstract"
]

[tool.black]
line-length = 120
target-version = ['py38']
Expand Down Expand Up @@ -25,3 +109,26 @@ force-exclude = '''
/docs/*
)\
'''

[tool.ruff]
select = ["E", "F", "T100", "T201", "T203"]
exclude = [
".git",
".tox",
"__pycache__",
"build/",
"dist/",
"docs/source/conf.py",
"src/hdmf_zarr/_due.py",
"docs/source/tutorials/",
"docs/_build/",
]
line-length = 120

[tool.ruff.per-file-ignores]
"docs/gallery/*" = ["E402", "T201"]
"src/*/__init__.py" = ["F401"]
"test_gallery.py" = ["T201"]

[tool.ruff.mccabe]
max-complexity = 17
27 changes: 0 additions & 27 deletions setup.cfg

This file was deleted.

79 changes: 0 additions & 79 deletions setup.py

This file was deleted.

12 changes: 9 additions & 3 deletions src/hdmf_zarr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
from .utils import ZarrDataIO
from .nwb import NWBZarrIO

from ._version import get_versions # noqa: E402
__version__ = get_versions()['version']
del get_versions
try:
# see https://effigies.gitlab.io/posts/python-packaging-2023/
from ._version import __version__
except ImportError: # pragma: no cover
# this is a relatively slower method for getting the version string
from importlib.metadata import version # noqa: E402

__version__ = version("hdmf")
del version

# Duecredit definitions
from ._due import due, BibTeX # noqa: E402
Expand Down
Loading

0 comments on commit 5e48ab5

Please sign in to comment.