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

Prepare 0.10.0 release #251

Merged
merged 9 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/run_all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,13 @@ jobs:
auto-update-conda: true
python-version: ${{ matrix.python-ver }}
channels: conda-forge
conda-remove-defaults: "true"

- name: Install build dependencies
run: |
conda config --set always_yes yes --set changeps1 no
conda info
conda install -c conda-forge tox
conda install tox

- name: Conda reporting
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,13 @@ jobs:
auto-update-conda: true
python-version: ${{ matrix.python-ver }}
channels: conda-forge
conda-remove-defaults: "true"

- name: Install build dependencies
run: |
conda config --set always_yes yes --set changeps1 no
conda info
conda install -c conda-forge tox
conda install tox

- name: Conda reporting
run: |
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# HDMF-ZARR Changelog

## 0.10.0 (Upcoming)
## 0.10.0 (December 18, 2024)

### Enhancements
* Added initial refactor of export, supporting references and internal/external links from Zarr to Zarr. This will introduce breaking changes that could lead to existing exported files to be invalid. This update removes '.' as the object default file source. @mavaylon1 [#194](https://github.com/hdmf-dev/hdmf-zarr/pull/194)
Expand Down
22 changes: 11 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ CI / Health Status
.. image:: https://codecov.io/gh/hdmf-dev/hdmf-zarr/branch/dev/graph/badge.svg
:target: https://codecov.io/gh/hdmf-dev/hdmf-zarr

.. image:: https://github.com/hdmf-dev/hdmf-zarr/workflows/Run%20code%20coverage/badge.svg
.. image:: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/run_coverage.yml/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/run_coverage.yml

.. image:: https://github.com/hdmf-dev/hdmf-zarr/workflows/Run%20tests/badge.svg
.. image:: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/run_tests.yml/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/run_tests.yml

.. image:: https://github.com/hdmf-dev/hdmf-zarr/workflows/Run%20all%20tests/badge.svg
.. image:: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/run_all_tests.yml/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/run_all_tests.yml

.. image:: https://github.com/hdmf-dev/hdmf-zarr/workflows/Check%20Sphinx%20external%20links/badge.svg
.. image:: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/check_external_links.yml/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/check_external_links.yml

.. image:: https://github.com/hdmf-dev/hdmf-zarr/workflows/Deploy%20release/badge.svg
.. image:: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/deploy_release.yml/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/deploy_release.yml

.. image:: https://github.com/hdmf-dev/hdmf-zarr/workflows/black/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/black.yml
.. image:: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/ruff.yml/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/ruff.yml

.. image:: https://github.com/hdmf-dev/hdmf-zarr/workflows/Run%20style%20check/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/run_flake8.yml
.. image:: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/codespell.yml/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/codespell.yml

.. image:: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/HDMF_dev.yaml/badge.svg
:target: https://github.com/hdmf-dev/hdmf-zarr/actions/workflows/HDMF_dev.yaml


Citing hdmf-zarr
----------------

If you use HDMF or hdmf_zarr in your research, please use the following citation:
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/plot_convert_nwb_hdf5.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# -----
#
# Here we use a small NWB file from the DANDI neurophysiology data archive from
# `DANDIset 000009 <https://dandiarchive.org/dandiset/000009/0.220126.1903>`_ as an example.
# `Dandiset 000009 <https://dandiarchive.org/dandiset/000009/0.220126.1903>`_ as an example.
# To download the file directly from DANDI we can use:
#
# .. code-block:: python
Expand All @@ -29,7 +29,7 @@
# filename = os.path.basename(asset.path)
# asset.download(filename)
#
# We here use a local copy of a small file from this DANDIset as an example:
# We here use a local copy of a small file from this Dandiset as an example:


# sphinx_gallery_thumbnail_path = 'figures/gallery_thumbnail_plot_convert_nwb.png'
Expand Down
4 changes: 2 additions & 2 deletions docs/gallery/resources/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Resources
sub_anm00239123_ses_20170627T093549_ecephys_and_ogen.nwb
--------------------------------------------------------

This NWB file was downloaded from `DANDIset 000009 <https://dandiarchive.org/dandiset/000009/0.220126.1903>`_
This NWB file was downloaded from `Dandiset 000009 <https://dandiarchive.org/dandiset/000009/0.220126.1903>`_
The file was modified to replace ``:`` characters used in the name of the ``ElectrodeGroup`` called ``ADunit: 32`` in
``'general/extracellular_ephys/`` to ``'ADunit_32'``. The dataset ``general/extracellular_ephys/electrodes/group_name``
as part of the electrodes table was updated accordingly to list the appropriate group name. This is to avoid issues
on Windows file systems that do not support ``:`` as part of folder names. The asses can be downloaded from DANDI via:
on Windows file systems that do not support ``:`` as part of folder names. The asset can be downloaded from DANDI via:

.. code-block:: python
:linenos:
Expand Down
1 change: 0 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@

html_theme_options = {
'logo_only': False, # Only show the hdmf-zarr logo without the documentation title
'display_version': True,
'prev_next_buttons_location': 'bottom', # Show previous/next button at the bottom
'style_external_links': True, # Add marker to indicate external links
'vcs_pageview_mode': '',
Expand Down
1 change: 0 additions & 1 deletion docs/source/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Supported features
Known Limitations
-----------------

- Support for region references is not yet implemented. See also :ref:`sec-zarr-storage-references-region` for details.
- The Zarr backend is currently experimental and may still change.
- Attributes are stored as JSON documents in Zarr (using the DirectoryStore). As such, all attributes must be JSON serializable. The :py:class:`~hdmf_zarr.backend.ZarrIO` backend attempts to cast types to JSON serializable types as much as possible.
- Currently the :py:class:`~hdmf_zarr.backend.ZarrIO` backend supports Zarr's directory-based stores :py:class:`~zarr.storage.DirectoryStore`, :py:class:`~zarr.storage.NestedDirectoryStore`, and :py:class:`~zarr.storage.TempStore`. Other `Zarr stores <https://zarr.readthedocs.io/en/stable/api/storage.html>`_ could be added but will require proper treatment of links and references for those backends as links are not supported in Zarr (see `zarr-python issues #389 <https://github.com/zarr-developers/zarr-python/issues/389>`_.
Expand Down
36 changes: 1 addition & 35 deletions docs/source/storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Storing object references in Attributes
Object references are stored in a attributes as dicts with the following keys:

* ``zarr_dtype`` : Indicating the data type for the attribute. For object references
``zarr_dtype`` is set to ``"object"`` (or ``"region"`` for :ref:`sec-zarr-storage-references-region`)
``zarr_dtype`` is set to ``"object"``
* ``value``: The value of the object references, i.e., here the py:class:`~hdmf_zarr.utils.ZarrReference`
dictionary with the ``source``, ``path``, ``object_id``, and ``source_object_id`` keys defining
the object reference, with the definition of the keys being the same as
Expand All @@ -280,36 +280,6 @@ For example in NWB, the attribute ``ElectricalSeries.electrodes.table`` would be
"zarr_dtype": "object"
}

.. _sec-zarr-storage-references-region:

Region references
-----------------

Region references are similar to object references, but instead of references other Datasets or Groups,
region references link to subsets of another Dataset. To identify region references, the reserved attribute
``zarr_dtype`` is set to ``'region'`` (see also :ref:`sec-zarr-storage-attributes-reserved`). In addition
to the ``source`` and ``path``, the py:class:`~hdmf_zarr.utils.ZarrReference` object will also need to
store the definition of the ``region`` that is being referenced, e.g., a slice or list on point indices.

.. warning::

Region references are not yet fully implemented in :py:class:`~hdmf_zarr.backend.ZarrIO`.
To implement region references will require updating:
1) py:class:`~hdmf_zarr.utils.ZarrReference` to add a ``region`` key to support storing
the selection for the region,
2) :py:meth:`~hdmf_zarr.backend.ZarrIO._create_ref` to support passing in the region definition to
be added to the py:class:`~hdmf_zarr.utils.ZarrReference`,
3) :py:meth:`~hdmf_zarr.backend.ZarrIO.write_dataset` already partially implements the required
logic for creating region references by checking for :py:class:`hdmf.build.RegionBuilder` inputs
but will likely need updates as well
4) :py:meth:`~hdmf_zarr.backend.ZarrIO.__read_dataset` to support reading region references,
which may also require updates to :py:meth:`~hdmf_zarr.backend.ZarrIO.__parse_ref` and
:py:meth:`~hdmf_zarr.backend.ZarrIO.__resolve_ref`, and
5) and possibly other parts of :py:class:`~hdmf_zarr.backend.ZarrIO`.
6) The py:class:`~hdmf_zarr.zarr_utils.ContainerZarrRegionDataset` and
py:class:`~hdmf_zarr.zarr_utils.ContainerZarrRegionDataset` classes will also need to be finalized
to support region references.


.. _sec-zarr-storage-dtypes:

Expand Down Expand Up @@ -357,10 +327,6 @@ The mappings of data types is as follows
| * "reference" | dataset. See | |
| * "object" | :ref:`sec-zarr-storage-references` | |
+--------------------------+------------------------------------+----------------+
| * region | Reference to a region | |
| | of another dataset. See | |
| | :ref:sec-zarr-storage-references` | |
+--------------------------+------------------------------------+----------------+
| * compound dtype | Compound data type | |
+--------------------------+------------------------------------+----------------+
| * "isodatetime" | ASCII ISO8061 datetime string. | variable |
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name = "hdmf_zarr"
authors = [
{ name="Oliver Ruebel", email="[email protected]" },
{ name="Matthew Avaylon", email="[email protected]" },
{ name="Ryan Ly", email="[email protected]" },
]
description = "A package defining a Zarr I/O backend for HDMF"
readme = "README.rst"
Expand All @@ -18,8 +19,9 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"License :: OSI Approved :: BSD License",
"Development Status :: 5 - Production/Stable",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: Microsoft :: Windows",
Expand Down Expand Up @@ -130,7 +132,6 @@ line-length = 120

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

[tool.ruff.lint.mccabe]
Expand Down
5 changes: 4 additions & 1 deletion src/hdmf_zarr/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,10 @@ def resolve_ref(self, zarr_ref):
source_file = str(zarr_ref["source"])
# Resolve the path relative to the current file
if not self.is_remote():
source_file = os.path.abspath(source_file)
if isinstance(self.source, str) and self.source.startswith(("s3://")):
source_file = self.source
else:
source_file = os.path.abspath(source_file)
else:
# get rid of extra "/" and "./" in the path root and source_file
root_path = str(self.path).rstrip("/")
Expand Down
Loading