Skip to content

Commit

Permalink
Merge branch 'ome:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
berombau authored Feb 28, 2024
2 parents 6d718e0 + f79bad0 commit 03d8f53
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 83 deletions.
63 changes: 13 additions & 50 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,30 @@ on: [push, pull_request]

jobs:
test:
name: Test ${{ matrix.os }} / ${{ matrix.toxenv }}
name: Test ${{ matrix.os }}-python${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: windows-latest, python_Version: '3.11', toxenv: 'py311'}
- {os: windows-latest, python_Version: '3.10', toxenv: 'py310'}
- {os: windows-latest, python_Version: '3.8', toxenv: 'py38'}
- {os: windows-latest, python_Version: '3.9', toxenv: 'py39'}
- {os: ubuntu-latest, python_Version: '3.11', toxenv: 'py311'}
- {os: ubuntu-latest, python_Version: '3.10', toxenv: 'py310'}
- {os: ubuntu-latest, python_Version: '3.8', toxenv: 'py38'}
- {os: ubuntu-latest, python_Version: '3.9', toxenv: 'py39'}
- {os: macos-latest, python_Version: '3.11', toxenv: 'py311'}
- {os: macos-latest, python_Version: '3.10', toxenv: 'py310'}
- {os: macos-latest, python_Version: '3.8', toxenv: 'py38'}
# missing numcodecs wheels on 3.9. conda not yet an option. see gh-51
# {os: macos-latest, python_Version: '3.9', toxenv: 'py39'}

python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: ['windows-latest', 'macos-latest', 'ubuntu-latest']
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
name: Install Python ${{ matrix.python_version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}

- name: Install ubuntu libraries
if: startsWith(matrix.os, 'ubuntu')
run: "\
sudo apt-get install -y \
libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 \
libxcb-render-util0 libxcb-xinerama0 \
libxcb-xinput0 libxcb-xfixes0"

- name: Install & test
run: |
python -m pip install tox
tox -e ${{ matrix.toxenv }}
test_coverage:
name: Test coverage
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
name: Install Python '3.10'
with:
python-version: '3.10'
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install -r requirements/requirements-dev.txt
- name: Test
run: tox -e 'py310-coverage'
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox --conf tox.ini

- uses: codecov/codecov-action@v2
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
fail_ci_if_error: false
fail_ci_if_error: true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ build
dist/
target/
docs/build/

# Testing files
.tox*
.coverage*
coverage.xml
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ repos:
- id: seed-isort-config

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 23.11.0
rev: 24.2.0
hooks:
- id: black
args: [--target-version=py36]

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.1
hooks:
- id: pyupgrade
args:
Expand All @@ -45,7 +45,7 @@ repos:
- --autofix

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies: [
Expand All @@ -66,13 +66,13 @@ repos:
]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.8.0
hooks:
- id: mypy
args: [--config-file=mypy.ini]

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
rev: v1.35.1
hooks:
- id: yamllint
# args: [--config-data=relaxed]
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.8.4 (unreleased)

- Correctly specify maximum compatible fsspec version. ([#338](https://github.com/ome/ome-zarr-py/pull/338))
- Add tests on Python 3.12. ([#338](https://github.com/ome/ome-zarr-py/pull/338))

# 0.8.3 (November 2023)

- Fix reading HCS file on AWS S3 ([#322](https://github.com/ome/ome-zarr-py/pull/322))
Expand Down
2 changes: 1 addition & 1 deletion docs/source/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ By default, a pyramid of resolution levels will be created by down-sampling the
of 2 in the X and Y dimensions.

Alternatively, the :py:func:`ome_zarr.writer.write_multiscale` can be used, which takes a
"pyramid" `numpy` arrays.
"pyramid" of pre-computed `numpy` arrays.

The following code creates a 3D Image in OME-Zarr::

Expand Down
1 change: 1 addition & 0 deletions ome_zarr/axes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Axes class for validating and transforming axes
"""

from typing import Any, Dict, List, Union

from .format import CurrentFormat, Format
Expand Down
1 change: 1 addition & 0 deletions ome_zarr/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Entrypoint for the `ome_zarr` command-line tool."""

import argparse
import logging
import sys
Expand Down
1 change: 1 addition & 0 deletions ome_zarr/data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions for generating synthetic data."""

from random import randrange
from typing import Callable, List, Optional, Tuple, Union

Expand Down
24 changes: 21 additions & 3 deletions ome_zarr/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,27 +166,45 @@ def get_json(self, subpath: str) -> JSONDict:
return {}

def parts(self) -> List[str]:
if self.__store.fs.protocol == "file":
if self._isfile():
return list(Path(self.__path).parts)
else:
return self.__path.split("/")

def subpath(self, subpath: str = "") -> str:
if self.__store.fs.protocol == "file":
if self._isfile():
filename = Path(self.__path) / subpath
filename = filename.resolve()
return str(filename)
if self.__store.fs.protocol in ["http", "https"]:
elif self._ishttp():
url = str(self.__path)
if not url.endswith("/"):
url = f"{url}/"
return urljoin(url, subpath)
else:
# Might require a warning
if self.__path.endswith("/"):
return f"{self.__path}{subpath}"
else:
return f"{self.__path}/{subpath}"

def _isfile(self) -> bool:
"""
Return whether the current underlying implementation
points to a local file or not.
"""
return self.__store.fs.protocol == "file" or self.__store.fs.protocol == (
"file",
"local",
)

def _ishttp(self) -> bool:
"""
Return whether the current underlying implementation
points to a URL
"""
return self.__store.fs.protocol in ["http", "https"]


def parse_url(
path: Union[Path, str], mode: str = "r", fmt: Format = CurrentFormat()
Expand Down
2 changes: 2 additions & 0 deletions ome_zarr/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ def __init__(

@overload
def first(self, spectype: Type["Well"]) -> Optional["Well"]:
# Handled by the generic case
...

@overload
def first(self, spectype: Type["Plate"]) -> Optional["Plate"]:
# Handled by the generic case
...

def first(self, spectype: Type["Spec"]) -> Optional["Spec"]:
Expand Down
1 change: 1 addition & 0 deletions ome_zarr/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
See the :class:`~ome_zarr.scale.Scaler` class for details.
"""

import inspect
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions ome_zarr/writer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Image writer utility
"""

import logging
import warnings
from pathlib import Path
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fsspec==2023.6.0
fsspec
black
cython >= 0.29.16
numpy >= 1.16.0
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
pytest
pytest-cov
codecov
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def read(fname):
install_requires += (["dask"],)
install_requires += (["distributed"],)
install_requires += (["zarr>=2.8.1"],)
install_requires += (["fsspec[s3]>=0.8,!=2021.07.0,!=2023.09.0"],)
install_requires += (["fsspec[s3]>=0.8,!=2021.07.0"],)
# See https://github.com/fsspec/filesystem_spec/issues/819
install_requires += (["aiohttp<4"],)
install_requires += (["requests"],)
Expand Down
32 changes: 12 additions & 20 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py{38,39,310,311}
envlist = py{38,39,310,311,312}


[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312

[testenv]
# passenv = DISPLAY XAUTHORITY
passenv = GITHUB_ACTIONS
deps =
-rrequirements/requirements-dev.txt
pytest-xvfb ; sys_platform == 'linux'

commands =
pytest {posargs:tests -s}
-r requirements/requirements-test.txt

[testenv:py310-coverage]
passenv =
CI
GITHUB_ACTIONS
usedevelop = true
commands =
pytest --cov-report=xml --cov=./ome_zarr --cov-append {posargs:-v}
codecov -f codecov.xml
pytest --cov-report=xml --cov=./ome_zarr --cov-append {posargs}

0 comments on commit 03d8f53

Please sign in to comment.