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

Feature/add writers #9

Merged
merged 7 commits into from
Jul 25, 2023
Merged

Feature/add writers #9

merged 7 commits into from
Jul 25, 2023

Conversation

SeanLeRoy
Copy link
Contributor

@SeanLeRoy SeanLeRoy commented Jul 10, 2023

Link to Relevant Issue

This pull request resolves #3

Description of Changes

This adds the writers from aicsimageio. The major difference between the writers and tests I copied from aicsimageio is that these no longer rely on DefaultReader or OmeTiffReader so I had to use imageio and tifffile more directly in the related writer and tests.

Testing

I tested these against the unit tests and locally writing out some files.

@@ -29,6 +29,14 @@ classifiers = [
dynamic = ["version"]
dependencies = [
"bioio-base>=0.1.1",
"dask[array]>=2021.4.1",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lots of dependencies added here that are specific to the writers. Does it seem worth it to move these to an extra so they are installable like bioio[writers] instead of by default or is that just added complexity for not much gain?

Copy link
Contributor

Choose a reason for hiding this comment

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

dask is an interesting one - I can see many projects importing dask on their own too. Personally I don't have a strong opinion other than "keep it simple" - start with this and we can change things later if we need to separate it into an extra.

"write_shape, write_dim_order, read_shape",
[
# TODO: Failing currently, needs work,
# see https://github.com/bioio-devs/bioio/issues/10
Copy link
Contributor Author

@SeanLeRoy SeanLeRoy Jul 10, 2023

Choose a reason for hiding this comment

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

These two commented out tests pass on aicsimageio (technically) see the issue for why this was commented out.

LOCAL_RESOURCES_DIR = pathlib.Path(__file__).parent / "resources"
LOCAL_RESOURCES_WRITE_DIR = pathlib.Path(__file__).parent / "writer_products"


def get_resource_full_path(filename: str) -> typing.Union[str, pathlib.Path]:
return LOCAL_RESOURCES_DIR / filename
def pytest_sessionstart(session: pytest.Session) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually rethinking this I think I'll change this to use tempdir. Maybe we can write out an example.txt to tempdir too and avoid having any files download for this package thus far.

Base automatically changed from feature/add-bioimage to main July 13, 2023 21:21
pyproject.toml Outdated
"fsspec>=2022.8.0",
"imageio[ffmpeg]>=2.11.0,<2.28.0",
"numpy>=1.16.0,<2.0.0",
"ome-types>=0.3.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

while that migration guide looks like a lot, you should also know that I routinely test against aicsimageio ... and you should be able to use v0.4.0 without any errors (albeit plenty of name change warnings which that migration guide would help with).

I don't think it should cause any ecosystem difficulties if you pin to >0.4.0 ... since v0.4.0 should work for any libraries that haven't updated

Copy link
Contributor

Choose a reason for hiding this comment

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

I basically agree, we might as well go with the latest if there are no obvious problems 🚀

Choose a reason for hiding this comment

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

happy to help with that. do you want me to open a PR to remove all the warnings?

Choose a reason for hiding this comment

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

btw... i'm also working on pydantic2 support (tlambert03/ome-types#205) ... and it's speedy!

Screen Shot 2023-07-13 at 5 50 16 PM

(though, I don't think you should pin pydantic yet)

Copy link
Contributor

@toloudis toloudis Jul 13, 2023

Choose a reason for hiding this comment

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

@SeanLeRoy should chime in, but I'll just say that one other option is to defer this dependency version update till we move further along on getting bioio ready. But I'm comfy merging such a change both here and aicsimageio anytime

Choose a reason for hiding this comment

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

yep, sounds good either way. just ping me if I can be of help

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm willing to try out migrating to ome-types>=0.4.0. I'll give it a shot as part of this and update here with my findings though it seems like it should be an easy migration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seemed easy enough 👍 , looks like as part of this lxml can be dropped as a direct dependency of this package and installed as an extra from ome-types which I did in #1dcd7ae

Copy link
Contributor

@toloudis toloudis left a comment

Choose a reason for hiding this comment

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

I wish there were an explicit declaration of tmp_path somewhere. As a newbie it looks confusing because where did it come from? But I am not complaining, it's incredibly convenient.

Copy link
Contributor

@BrianWhitneyAI BrianWhitneyAI left a comment

Choose a reason for hiding this comment

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

Looks good to me! need to add the changes to ome_zarr_writer once they get merged but that is for a later date.

@SeanLeRoy SeanLeRoy merged commit d4fbe67 into main Jul 25, 2023
@SeanLeRoy SeanLeRoy deleted the feature/add-writers branch July 25, 2023 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add writers
4 participants