-
Notifications
You must be signed in to change notification settings - Fork 66
feat: Support importlib.resources
in edittable installs
#399
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
Conversation
I need some advice on getting the pre-commit working and on how I can run |
5291b67
to
4198d3a
Compare
Ok, this one is somehow working. Do you know a python way to get the list of functions, or any other way to test if a library is cython or not? About test issues:
|
importlib.resources
importlib.resources
in edittable installs
If it's the mypy part, I can touch that up in _editable.py; given that that's imported whenever you start up Python, keeping it minimal is important - I almost don't even want to import typing to get
Easiest way is to add
From what? A module (
Pretty sure we can get that working, though manipulating it won't always be correct. |
We should also clearly support (or not support) namespace packages. |
Thanks a lot. Now I understand what that option does.
This is because loadable library modules with suffix
That one is weird, because I imagined that using the native
I haven't played around with namespaces, but isn't that natively supported due to the tree mapping? Got any folder structure or mwe to see how namespaces are supposed to work? |
Idea for the future: navigate the The file-api can also be used to find the python module target by checking their dependencies assuming the python binding is set to private. I was trying to find a way to check if the configuration is dirty, but couldn't find a way. But on the other hand the build system could handle the unnecessary re-builds. The configure-log from 3.26 can be used to check if a build was triggered, or some simple stdout parsing. |
FYI, one of the first things added to scikit-build-core was the file API module, but we've not used it yet anywhere except tests. It reads the FileAPI into fully typed dataclasses. |
TODO:
I think that is all the todos for this PR? |
Hi @LecrisUT @henryiii any updates on this PR? Totally understand things get busy, so just checking in. I'm happy to try and help get this over the finish line if that would be useful/appreciated (to be clear I don't know much about this PR so would have to get myself up to speed, but I'm willing to do that), but I'm also OK waiting if there's a plan to get back to this. I don't want to step on any toes, was just hoping to tackle #442 at some point soonish and I know @henryiii wanted this PR to get done first. |
I will work on this more today and try to get the tests for the different cases with a simple python binding |
575e801
to
6efa883
Compare
02d3357
to
e211960
Compare
b0f084d
to
0a415e2
Compare
Okay, couple of things to keep in mind: Every single usage of Python imports this file, just to start up the import system. You really want to avoid importing anything unnecessary (like pathlib) (unless it’s already imported by something else). It’s fine if we have to disable linter checks for this file. It’s not normal Python, don’t worry if a check is telling you to use pathlib, etc. |
Also, I prefer Also |
5af5bd1
to
b01fcbe
Compare
e3cb861
to
33d0489
Compare
AFAICT the only remaining issue is the weird 3.9 UNIX behavior. I've added a macOS run so we can see if it's all UNIX or just Linux. |
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Remove leftover comment Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
907c1b6
to
3dd0548
Compare
Ok, seems like I've overlooked something. If the |
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
cf43dfe
to
2972c04
Compare
I've added xfails. We could put this in then continue to work on getting rid of the xfails in followups. |
@henryiii Quick update about the Python |
I thought I checked that. Yes, if it works, then we can document that & test it. |
Here's an initial attempt at getting
importlib.resources
to work with editable install.Closes #388