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

Reorganize imports #122

Merged
merged 7 commits into from
Jun 18, 2021
Merged

Reorganize imports #122

merged 7 commits into from
Jun 18, 2021

Conversation

k-dominik
Copy link
Member

Summary:

  • This PR removes the bioimageio.spec.latest module. gen_spec is moved to bioimageio.spec.
  • Added a script to automatically generate "passthrough" modules for a (single) specific version, ran this for v0_3. This makes the v0_3 spec available from bioimage.spec.

I kept this as draft, because after actually doing it, I think the approach with the script that generates those modules might be to fragile. Also I feel I would have to document it a lot, which also seems like a sign, that it's a bad idea. Maybe living with the fact that from bioimageio.spec.raw_nodes import Something doesn't work is less painful.

fixes #120

Copy link
Collaborator

@constantinpape constantinpape left a comment

Choose a reason for hiding this comment

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

LGTM, but I think it would be good if @FynnBe has another look at this too.

Edit: Sorry, I didn't see that this is still marked as draft, I assumed it was good to go since tests pass.

@k-dominik
Copy link
Member Author

LGTM, but I think it would be good if @FynnBe has another look at this too.

Edit: Sorry, I didn't see that this is still marked as draft, I assumed it was good to go since tests pass.

Thx @constantinpape for the review. I left it a draft because I felt it turned out a bit more complicated than I anticipated and was not sure whether it was a good idea or not. But I think we'd have similar issues with the custom finder/loader approach.

Let's let @FynnBe have a look and then maybe decide.

@k-dominik k-dominik marked this pull request as ready for review June 17, 2021 06:51
Copy link
Member

@FynnBe FynnBe left a comment

Choose a reason for hiding this comment

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

LGTM

it would be great to add a CI check and maybe also a pre-commit hook for convenience.

# assuming schema will always be part of spec
from . import schema
from .raw_nodes import FormatVersion
__version__ = schema.get_args(FormatVersion)[-1]
Copy link
Member

Choose a reason for hiding this comment

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

here you are actually assuming that schema always imports typing.get_args

Did you avoid

try:
    from typing import get_args
except ImportError:
    from typing_extensions import get_args

her ein init.py on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch. this doesn't make any sense - I'm going to move that import to spec.shared.common, and change all imports accordingly.

@FynnBe FynnBe mentioned this pull request Jun 17, 2021
k-dominik and others added 2 commits June 18, 2021 11:35
# Conflicts:
#	bioimageio/spec/latest/__init__.py
#	bioimageio/spec/v0_3/schema.py
#	bioimageio/spec/v0_3/utils.py
@FynnBe FynnBe merged commit 4a9b166 into master Jun 18, 2021
@FynnBe FynnBe deleted the reorg-imports branch June 18, 2021 09:46
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.

import - package structure
3 participants