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

support zipfile.ZipFile, improve docs and improve get_io_sample_block_metas #432

Merged
merged 49 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
fa050eb
WIP update for download returning zipfile.Path
FynnBe Oct 31, 2024
29f45f2
expose submodules explicitly
FynnBe Nov 5, 2024
e38a79e
use resolve_and_extract in _import_from_file_impl
FynnBe Nov 5, 2024
5cef0f4
avoid circular imports
FynnBe Nov 5, 2024
6ef4a2d
update use of ValidationDetail
FynnBe Nov 5, 2024
eaa424f
update dev envs
FynnBe Nov 7, 2024
18bed26
add docstinrgs and annotations
FynnBe Nov 7, 2024
3fbf0c5
improve get_io_sample_block_metas
FynnBe Nov 7, 2024
2705e74
raise ValueError instead of assertion
FynnBe Nov 7, 2024
51b3fa3
update to spec changes
FynnBe Nov 7, 2024
3f81091
update python versions for tools
FynnBe Nov 7, 2024
f052891
add test case predict
FynnBe Nov 8, 2024
d315075
improve coverage reporting
FynnBe Nov 8, 2024
b1bf3d2
merge main
FynnBe Nov 8, 2024
4de7672
update pdoc doc generation
FynnBe Nov 8, 2024
b1225b7
pyright fixes
FynnBe Nov 11, 2024
25ac8d3
black
FynnBe Nov 11, 2024
4941dc1
ignore presentations folder
FynnBe Nov 11, 2024
07989d3
update test_bioimageio_spec_version
FynnBe Nov 11, 2024
20545fa
reenable test_get_block_transform
FynnBe Nov 11, 2024
29ed684
use new cli_implicit_flags config
FynnBe Nov 11, 2024
067f24d
use ZipPath instead of zipfile.Path
FynnBe Nov 11, 2024
fe993d0
fix test_bioimageio_spec_version
FynnBe Nov 11, 2024
f4efbaa
update CLI
FynnBe Nov 11, 2024
5f52b15
fix test predict --example command
FynnBe Nov 12, 2024
91f2b87
update get_example_command
FynnBe Nov 12, 2024
53596f6
update changelog
FynnBe Nov 12, 2024
815d87f
blockwise
FynnBe Nov 12, 2024
8a8cb00
add test_commands
FynnBe Nov 12, 2024
a9d1132
WIP add test_prediction
FynnBe Nov 12, 2024
c97a893
use bioimageio cache
FynnBe Nov 13, 2024
f9c3bf0
fix typo
FynnBe Nov 13, 2024
27ef747
WIP fix tests and cleanup
FynnBe Nov 13, 2024
0043abf
fix deprecation warning
FynnBe Nov 14, 2024
4da6766
fix assert_never import
FynnBe Nov 14, 2024
4cbf9ef
add explicit support for h5
FynnBe Nov 15, 2024
37acc79
improve error messages for split_multiple_shapes_into_blocks
FynnBe Nov 15, 2024
f155c9d
adapt test to multi tensor model
FynnBe Nov 15, 2024
150df64
fix docstring test
FynnBe Nov 15, 2024
b8bad0b
bump minor and spec
FynnBe Nov 15, 2024
a1b6f5c
add enable_determinism
FynnBe Nov 15, 2024
324f15c
use determinism and refactor decimal
FynnBe Nov 15, 2024
b40c0e5
update changelog
FynnBe Nov 15, 2024
e34ad21
pin tifffile
FynnBe Nov 18, 2024
e5deb74
test with py3.13 and for TF with spec-main
FynnBe Nov 18, 2024
ee80605
test up to py3.12 (onnxruntime and tf not available for py3.13)
FynnBe Nov 18, 2024
bcc905e
tf 2.15 requires py>=3.9
FynnBe Nov 18, 2024
07cc873
bump spec version
FynnBe Nov 18, 2024
cf48411
remove tifffile dep (now in spec)
FynnBe Nov 18, 2024
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
Prev Previous commit
Next Next commit
update CLI
FynnBe committed Nov 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit f4efbaae8229a44954dd2f2e78a661ccc78173ff
27 changes: 12 additions & 15 deletions bioimageio/core/cli.py
Original file line number Diff line number Diff line change
@@ -8,11 +8,10 @@
import shutil
import subprocess
import sys
import zipfile
from argparse import RawTextHelpFormatter
from difflib import SequenceMatcher
from functools import cached_property
from pathlib import Path, PurePosixPath
from pathlib import Path
from pprint import pformat, pprint
from typing import (
Any,
@@ -29,7 +28,7 @@
)

from loguru import logger
from pydantic import BaseModel, model_validator
from pydantic import BaseModel, Field, model_validator
from pydantic_settings import (
BaseSettings,
CliPositionalArg,
@@ -114,14 +113,14 @@ def descr_id(self) -> str:


class ValidateFormatCmd(CmdBase, WithSource):
"""bioimageio-validate-format - validate the meta data format of a bioimageio resource."""
"""validate the meta data format of a bioimageio resource."""

def run(self):
validate_format(self.descr)


class TestCmd(CmdBase, WithSource):
"""bioimageio-test - Test a bioimageio resource (beyond meta data formatting)"""
"""Test a bioimageio resource (beyond meta data formatting)"""

weight_format: WeightFormatArgAll = "all"
"""The weight format to limit testing to.
@@ -144,7 +143,7 @@ def run(self):


class PackageCmd(CmdBase, WithSource):
"""bioimageio-package - save a resource's metadata with its associated files."""
"""save a resource's metadata with its associated files."""

path: CliPositionalArg[Path]
"""The path to write the (zipped) package to.
@@ -201,7 +200,7 @@ def _get_stat(


class PredictCmd(CmdBase, WithSource):
"""bioimageio-predict - Run inference on your data with a bioimage.io model."""
"""Run inference on your data with a bioimage.io model."""

inputs: NotEmpty[Sequence[Union[str, NotEmpty[Tuple[str, ...]]]]] = (
"{input_id}/001.tif",
@@ -547,22 +546,20 @@ def input_dataset(stat: Stat):

class Bioimageio(
BaseSettings,
# alias_generator=AliasGenerator(
# validation_alias=lambda s: AliasChoices(s, to_snake(s).replace("_", "-"))
# ),
# TODO: investigate how to allow a validation alias for subcommands
# ('validate-format' vs 'validate_format')
cli_parse_args=True,
cli_prog_name="bioimageio",
cli_use_class_docs_for_groups=True,
# cli_implicit_flags=True, # TODO: make flags implicit, see https://github.com/pydantic/pydantic-settings/issues/361
cli_implicit_flags=True,
use_attribute_docstrings=True,
):
"""bioimageio - CLI for bioimage.io resources 🦒"""

model_config = SettingsConfigDict(json_file=JSON_FILE, yaml_file=YAML_FILE)
model_config = SettingsConfigDict(
json_file=JSON_FILE,
yaml_file=YAML_FILE,
)

validate_format: CliSubCommand[ValidateFormatCmd]
validate_format: CliSubCommand[ValidateFormatCmd] = Field(alias="validate-format")
"Check a resource's metadata format"

test: CliSubCommand[TestCmd]