-
Notifications
You must be signed in to change notification settings - Fork 89
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
awkward._v2
imports broken with subpackages
#1771
Comments
This is a known "bug", and it seems like it is the least-worst option of the solutions to implementing a v2 shim. It doesn't seem like there is a way to import the same package under different names in Given that v2 has had so many bug fixes over the last couple of versions, and we made no guarantees initially that we would provide a shim, my feeling is that we just have to put up with a hard-breakage if users aren't already treating |
The code change of import awkward._v2 as ak to import awkward as ak is an easy one. What's hard is coordinating versions of packages, particularly in a CI matrix, in which each one might get a different version from PyPI. But if the shim isn't working or only partially works, then that's even worse, since downstream users have to adapt anyway, and it's not the simple adaptation described above. Okay, so I'm thinking that you're right and we should give up on the idea of a shim, just doing a hard break. That's also different from what I told @alexander-held, so I'm including him in the loop here, too. Since we haven't released even an RC yet, going back and forth like this won't be too disruptive. Suppose instead of a shim, we ask all downstream users to replace import awkward._v2 as ak with try:
import awkward._v2 as ak
except ImportError:
import awkward as ak As of 2.0.0rc1 (not released yet), we would have no Maybe it needs to be ModuleNotFoundError, but that's a subclass of ImportError, so it still works. Anyone who has a testing matrix that's not complicated by Python versions that Awkward v2 doesn't support (3.6, specifically) can just import awkward as ak after 2.0.0rc1, and that includes Uproot. |
@agoose77 thanks for the explanation of the imports issue. And wearing my early adopter hat (and having easily transitioned to removing |
I've been using try:
import awkward._v2 as ak
except ModuleNotFoundError:
import awkward as ak so far, with the intention of monitoring the developments to see whether I would need to update this. I also do not feel strongly either way, this was easy to adopt. I imagine the most challenging setup for projects depending on |
There is a simple fix: make "_v2" a symbolic file link back to the root directory. The only downside is that you would have an |
I'm not sure that will work 🤔; wheels don't support symlinks. We could create a v2 symlink at runtime (only on unix), but that's fairly unappealing. Furthermore, if we could establish the link by other means, we would then end up with two separate instances of Awkward in the same Python interpreter which I'm not sure about. On the one hand, that's what we had with v1/v2, but on the other, |
A decision needs to be made on this. We've tried two ways of implementing an So I think we should have no
try:
import awkward._v2 as ak
except ModuleNotFoundError:
import awkward as ak
This set of consequences sound pretty good to me. It would be strictly nicer to provide a Actually, a little better than having no |
Personally, I'm in favour of this. We don't want people to be running on |
Version of Awkward Array
2.0.0rc1
Description and code to reproduce
In dask-awkward we have some imports that break after installing from the
main
branch (but not removing the_v2
imports). For example: https://github.com/ContinuumIO/dask-awkward/blob/7a0cceeade6aa8f64f5f3c29fb59c75a807230f7/src/dask_awkward/lib/io/io.py#L9This is because
awkward._v2.types
used to be package and now it's just a module with the updated repo structure.Note that dask-awkward is fine if we transition to not importing
_v2
things (https://github.com/ContinuumIO/dask-awkward/pull/86)The text was updated successfully, but these errors were encountered: