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

update bioformats to 7.1.0 #68

Merged
merged 7 commits into from
Jan 30, 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
28 changes: 0 additions & 28 deletions .bumpversion.cfg

This file was deleted.

3 changes: 0 additions & 3 deletions .codespellrc

This file was deleted.

2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[flake8]
docstring-convention=google
max-line-length=88
exclude=noxfile.py,docs/*,tests/*,examples/*,.nox/*,build/*,bfio/OmeXml.py,setup.py
exclude=noxfile.py,docs/*,tests/*,examples/*,.nox/*,build/*
ignore=D105, W503, D100, D104, AZ100
extend-ignore = E203
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- uses: psf/black@stable
with:
options: "--check --color --verbose"
src: "./bfio"
src: "./src"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__pycache__
.vscode
.venv
venv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking that you intended to remove the "." If this is correct, then LGTM.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional change.

docs/build
dist
build
Expand Down
55 changes: 0 additions & 55 deletions bfio/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion codespellwords.txt

This file was deleted.

123 changes: 123 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
[build-system]
# Run dependencies are also considered as build dependencies
# due to cascading import situation in src/bfio/__init__.py
requires = [
"setuptools",
"wheel",
"imagecodecs>=2021.2.26",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upto you, but I would probably add a comment here saying that the runtime dependencies have been added as build-time dependencies, simply due to the fact that src/bfio/init.py exports some aliases, which causes cascading imports which effectively requires adding all runtime dependencies at build-time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do that!

"numpy",
"ome-types>=0.4.2",
"zarr>=2.6.1",
"scyjava",
"jpype1",
"tifffile>=2022.8.12"
]
build-backend = "setuptools.build_meta"


[project]
name = "bfio"
dynamic = ["version"]
dependencies = [
"imagecodecs>=2021.2.26",
"numpy",
"ome-types>=0.4.2",
"zarr>=2.6.1",
"scyjava",
"jpype1",
"tifffile>=2022.8.12"
]

description = "Simple reading and writing classes for tiled tiffs using Bioformats."
readme = "README.md"
license = {file = "LICENSE"}

authors = [
{name = "Nick Schaub", email = "nick.schaub@nih.gov"},
{name = "Sameeul Bashir Samee", email = "sameeul.samee@axleinfo.com"},
]

maintainers = [
{name = "Sameeul Bashir Samee", email = "sameeul.samee@axleinfo.com"},
]

classifiers = [
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

requires-python = ">=3.8"


[project.optional-dependencies]
dev = [
"ome_zarr",
"requests>=2.26.0"
]


[project.urls]
Documentation = "https://bfio.readthedocs.io/en/latest/"
Repository = "https://github.com/PolusAI/bfio"


[tool.setuptools.dynamic]
version = {attr = "bfio.__version__"}


[tool.setuptools]
package-dir = {"" = "src"}
include-package-data = true


[tool.setuptools.packages.find]
where = ["src"]
namespaces = false


[tool.setuptools.package-data]
"*" = [
"VERSION"
]


[tool.bumpversion]
current_version = "2.3.3"
commit = true
tag = true
commit_args = "--no-verify"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(\\-(?P<release>[a-z]+)(?P<build>\\d+))?"
serialize = [
"{major}.{minor}.{patch}-{release}{build}",
"{major}.{minor}.{patch}"
]

[tool.bumpversion.parts.release]
optional_value = "_"
first_value = "dev"
values = [
"dev",
"_"
]

[[tool.bumpversion.files]]
filename = "src/bfio/VERSION"
search = "{current_version}"
replace = "{new_version}"

[[tool.bumpversion.files]]
filename = "requirements/requirements-base.txt"
search = "bfio[all]=={current_version}"
replace = "bfio[all]=={new_version}"

[[tool.bumpversion.files]]
filename = "README.md"
search = "{current_version}"
replace = "{new_version}"


[tool.codespell]
skip = "*.svg,*.html"
ignore-words-list = "utput"
50 changes: 0 additions & 50 deletions setup.py

This file was deleted.

File renamed without changes.
29 changes: 29 additions & 0 deletions src/bfio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals

import logging
import pathlib

JAR_VERSION = None

logging.basicConfig(
format="%(asctime)s - %(name)-8s - %(levelname)-8s - %(message)s",
datefmt="%d-%b-%y %H:%M:%S",
)
logger = logging.getLogger("bfio.init")

log_level = logging.WARNING

try:
with open(pathlib.Path(__file__).parent.joinpath("VERSION"), "r") as fh:
__version__ = fh.read()
except FileNotFoundError:
logger.info(
"Could not find VERSION. "
+ "This is likely due to using a local/cloned version of bfio."
)
__version__ = "0.0.0"
logger.info("VERSION = {}".format(__version__))


from .bfio import BioReader, BioWriter, start # NOQA: F401, E402
6 changes: 3 additions & 3 deletions bfio/backends.py → src/bfio/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,9 @@ def _init_writer(self):

self._tags = []

self.frontend._metadata.images[
0
].id = f"Image:{Path(self.frontend._file_path).name}"
self.frontend._metadata.images[0].id = (
f"Image:{Path(self.frontend._file_path).name}"
)

if self.frontend.X * self.frontend.Y * self.frontend.bpp > 2**31:
big_tiff = True
Expand Down
File renamed without changes.
17 changes: 6 additions & 11 deletions bfio/bfio.py → src/bfio/bfio.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@
import typing
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from platform import processor, system

import numpy
import ome_types
import tifffile
import jpype
import scyjava

from bfio import backends
from bfio.base_classes import BioBase

import jpype
import scyjava

try:

def start() -> str:
Expand All @@ -30,10 +28,7 @@ def start() -> str:
"""

global JAR_VERSION
if system() == "Darwin" and processor() == "arm":
scyjava.config.endpoints.append("ome:formats-gpl:7.0.0")
else:
scyjava.config.endpoints.append("ome:formats-gpl:7.0.1")
scyjava.config.endpoints.append("ome:formats-gpl:7.1.0")
scyjava.start_jvm()
loci = jpype.JPackage("loci")
loci.common.DebugTools.setRootLevel("ERROR")
Expand Down Expand Up @@ -1009,9 +1004,9 @@ class if specified. *Defaults to None.*
self._metadata = metadata.model_copy(deep=True)

self._metadata.images[0].name = self._file_path.name
self._metadata.images[
0
].pixels.dimension_order = ome_types.model.Pixels_DimensionOrder.XYZCT
self._metadata.images[0].pixels.dimension_order = (
ome_types.model.Pixels_DimensionOrder.XYZCT
)
else:
self._metadata = self._minimal_xml()

Expand Down
4 changes: 3 additions & 1 deletion tests/test_read.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import unittest
import requests, io, pathlib, shutil, logging, sys
import requests, pathlib, shutil, logging, sys
import bfio
import numpy as np
import random
Expand Down Expand Up @@ -43,6 +43,8 @@ def setUpModule():
with open(TEST_DIR.joinpath(file), "wb") as fw:
fw.write(r.content)
else:
if TEST_DIR.joinpath(file).exists():
shutil.rmtree(TEST_DIR.joinpath(file))
zarr_download(url, str(TEST_DIR))

"""Load the czi image, and save as a npy file for further testing."""
Expand Down
Loading
Loading