-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Griffe with scikit-build-core does not work in editable mode #154
Comments
Hey, thanks for the report! I'm getting a 404, is the repo public? |
Shoot! I just made it public, sorry about that: https://github.com/JeremyBYU/griffe-scikit-build-core-bug
…On Wed, May 3, 2023 at 3:26 PM Timothée Mazzucotelli < ***@***.***> wrote:
Hey, thanks for the report!
I'm getting a 404, is the repo public?
—
Reply to this email directly, view it on GitHub
<#154 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSSF5NSHJBQDN22PLLPKS3XEKWPTANCNFSM6AAAAAAXUSIVRA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Fixed, will push a release 🙂 |
Thanks will try it out soon! |
This does not seem to fully fix the issue for me. I updated the bug repository to generate documentation using mkdocs and instructions to reproduce. |
Thanks for the update. Yeah the Based on the other paths, your project root is Could you post the resulting file system tree, so that I can see where the .pyd file is located? With a command like |
Yes you are correct. In my haste to put out this bug report I made a few blunders. The main one was here where I accidentally left this as Aside: Usually the purepython package ( Here are my directories after
No compiled module inside here. The compiled module will actually be installed in the site-packages folder in the virtual environment
Here are my directories after
Again, no compiled module inside here. The compiled module will actually be installed in the site-packages folder but so will be the pure python code.
Hopefully the debug repo is in good shape now to help solve the problem. |
Thanks, that's perfect. I was also able to use your reproduction repo locally (thanks a lot by the way, amazing report!!). So, this is problematic. The editable install points at your src folder, which is handled by Griffe. But the compiled module is indeed installed in site-packages/griffedemo. The issue is that #148 could probably help us here, but I don't know the implications yet. I strived to design Griffe as to not rely on sys.path or any execution of Python code. In this case "static" search is not enough. I'll try to see how other frameworks that compile modules handle editable installs. |
Heh, anyway we could still somehow use #148 is very promising but doesn't help at discovering all modules: >>> _find_spec("griffedemo", None)
ModuleSpec(
name='griffedemo',
loader=<_frozen_importlib_external.SourceFileLoader object at 0x7fcc380b2f90>,
origin='/media/data/dev/griffe-scikit-build-core-bug/src/griffedemo/__init__.py',
submodule_search_locations=['/media/data/dev/griffe-scikit-build-core-bug/src/griffedemo']
)
# scanning griffe-scikit-build-core-bug/src/griffedemo will not give us the compiled module |
Thanks for looking into this. A final thing I may add is the possibility of using I will try and update the bug repo to show this pattern, which is what I want to use anyways! |
Oh yes, definitely, that's a good idea! Griffe does support stubs (.pyi files) so this would work, and even give better result than relying on the inspection of the compiled modules (no need to import, so faster, and more accurate API signatures) 🙂 |
I have pushed an update to the bug repo with a python stub file. Griffe is still currently not working with that solution as well. There are issues both in the local install and with the editable install (but failing for different reasons). Editable: Two problems:
Local Install: One Problem:
Thanks again for your help! |
And thanks again for the update on the repro! I removed my venv, recreated it, installed in editable mode, and the docs show up just fine: I see both the purepython Now if I install in non-editable mode, it indeed seems to use the data from the compiled module, which is now found. To fix this, you can tell Griffe to avoid inspecting the compiled module, since you provide stubs with accurate data anyway: plugins:
- mkdocstrings:
handlers:
python:
options:
docstring_style: google
docstring_options:
ignore_init_summary: yes
merge_init_into_class: yes
show_submodules: no
allow_inspection: no See https://mkdocstrings.github.io/python/usage/configuration/general/#allow_inspection. About the original issue: I don't see a clean way to support how scikit-build-core puts files on the disk. Even using the Python's standard mechanisms to find packages won't allow us to discover all modules without actually importing some of them, which is a no-go for Griffe. I can still add support for scikit-build-core editable module names, but that will not help finding the compiled modules (only the sources .py files). In any case, I believe that stubs are the way to go for documenting compiled modules. |
Kay, released a new version, closing again (:joy:) , feel free to comment further :slightly_smiling_face: |
Thank you again for your help. I followed suit and removed my old virtual environment and started fresh from my github repo master branch. Your solution for
To me, the issue still seems to be that its not looking at the local project folder to find the pure python code and the pyi stub file. Its still focused on the site_pacakges. If I remove
Same issue as before when looking at the wrong path. Note that I am running windows 11, 64 bit, conda environments, python 3.10. You have already put so much work into this issue that I recommend that you close this and forget about it. The stop gap for me is to simply install full locally before updating my documentation. When I am done, I just reinstall in editable mode. It's not that serious of an issue and this project is super helpful the way it currently works. |
It seems like a difference between Windows and Linux. Here are the equivalent logs on Linux:
Notice how your logs say |
Haha , will do at some point! Thanks again for all your help in the open source community. |
Describe the bug
Griffe is unable to find modules for a package built in editable mode when using scikit-build-core (
pip install -e .
) . If you build the module and install regularly (pip install .
) everything works as expected. I have created a repository (with instructions) that replicates this issue: https://github.com/JeremyBYU/griffe-scikit-build-core-bugThe text was updated successfully, but these errors were encountered: