-
Notifications
You must be signed in to change notification settings - Fork 17
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
import - package structure #120
Comments
I am all in favor of this, let's get rid of latest. as soon as a spec gets merged into master and the import in the top-level init is adapted it should count as stable.
Sounds good to me 👍 |
yes,
👍 🏆 |
Maybe there is an obvious reason not to do this, but actually the code structure allows for symbolic links to be used to solve this as well (except for init.py, but Wouldn't this be even cleaner? I stumbled onto this when adding 'utils.py' from v0_3 to v0_1 (didn't have utils). |
yeah.. well.. never mind. PyCharm is a lost cause with symbolic links... |
after a recent refactor there are 3 potential ways to import the v3 spec (which all come with different limitations, those are not equivalent):
I can see that I would do 1. do get a specific spec, and 2. and 3. if I want the latest.
Proposal 1: let's get rid of
latest
:) I'm not sure what this should even mean. If you start working onv0_4
, is this automatically the latest? or does latest mean current stable? Furthermore having it in the "root" of spec should be "latest" enough.then there are issues how the imports from submodules are passed on. Let's take
bioimageio/spec/__init__.py
:spec-bioimage-io/bioimageio/spec/__init__.py
Lines 1 to 4 in afff3a4
(latest
__init__
will havefrom v0_3 import *
)with this submodule import is broken:
This is because the "linking" via
import *
does not generate modules that can be discovered - it makes attributes available in the module namespace. There simply is noraw_nodes.py
in the/spec
, so it isn't discovered.There are solutions to this:
bioimageio.raw_nodes
is not supported anymore :)/bioimageio/spec
. These are placeholder modules thatimport *
from the relevant module inv0_3
or whatever the current (not necessarily latest...) spec is. Something like the following does the job:From these solutions I have to say I favor 3:
Proposal 2: let's try to fix imports with (3)
CC: @FynnBe @constantinpape
P.S.: To make matters worse, we need to decide on this quickly - otherwise, I'll have to assume (1) and refactor downstream packages accordingly.
The text was updated successfully, but these errors were encountered: