-
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
refactor: make _v2 facade a static module. #1758
Conversation
Codecov Report
Additional details and impacted files
|
The only downside of this approach is that I have a few more ideas on this, which I'm just trying out :) |
I'll wait to see your idea. (Leaving this PR open.) |
I've spent some time digging, and I've realised that my understanding of what's happening with respect to the renamed modules is not the full picture. It turns out that the What's actually happening is that Python's creating a new module object for imports of I had not realised that this would happen, because I'd thought that Python took the So, we need to revert #1730, and I think the safest thing to do is to just have a proxy module like you've shown. That will support So, apologies for holding this back, and indeed taking us down this path to begin with. I was hoping that #1730 would give us clean support for aliasing v2, but it rather turned out to be a liability. |
…ions'. Co-authored-by: Angus Hollands <[email protected]>
Okay, this does revert #1730, and I've been testing it against Uproot, though I think my issues were local to my computer. Uproot's tests passed even with the other way of doing So I'll enable auto-squash-and-merge. |
Instead of making
awkward._v2
be referentially the same asawkward
, inserted intosys.modules
by hand (which does strange things to the__package__
names of all submodules, described here: #1757 (comment)), I made a file named src/awkward/_v2.py and filled it with what the old _v2 had.Now
awkward._v2
is a plain old boring submodule, referentially distinct fromawkward
, and submodule__package__
names are not changed. It also has exactly the contents that the oldawkward._v2
had (not a superset of them), and it gives us a place where we could add a deprecation warning, if we ever want to. The direct imports can be replaced with a module-level__getitem__
that warns before it returns what was requested, like the module-level__getitem__
in Uproot (here).