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

Editable installs do not support traversing files in the build #807

Open
vyasr opened this issue Jul 13, 2024 · 2 comments · May be fixed by #808
Open

Editable installs do not support traversing files in the build #807

vyasr opened this issue Jul 13, 2024 · 2 comments · May be fixed by #808

Comments

@vyasr
Copy link
Contributor

vyasr commented Jul 13, 2024

It is not currently possible to use importlib.resources APIs like importlib.resources.files to access all of the files in an editable install using redirect-based editable installs. Files in the source directory (i.e. Python source files) are discoverable, but files in the build directory (i.e. CMake-generated files) are not. The reason is quite subtle and is a few layers down in the importlib stack, but it boils down to the fact that a Traversable is designed to represent a single node on the filesystem rather than a list of nodes.

Inplace editable installs also seem to fail here, but I have not checked why that is the case yet.

I will open a PR with a failing test as well as a demonstration of where I would expect to be able to fix this is if it were possible. I suspect that there is not easy way to solve this without modifications in CPython's importlib definitions.

@LecrisUT
Copy link
Collaborator

The reason is quite subtle and is a few layers down in the importlib stack, but it boils down to the fact that a Traversable is designed to represent a single node on the filesystem rather than a list of nodes.

There are multipath traversable if you point it to a directory-like path. Last time I've checked scikit-build-core managed to expand to those. Can you share a minimum example to work with, preferably basic with only library, files and python source.

What is not supported is navigating non-library files. Or did that change recently?

@vyasr
Copy link
Contributor Author

vyasr commented Jul 13, 2024

Yes, I am about to put up a PR with an example.

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 a pull request may close this issue.

2 participants