-
-
Notifications
You must be signed in to change notification settings - Fork 11k
ENH: add pkg_config entrypoint #28214
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
Any chance you can add a test showing that the entry point works? Not sure if that's doable without adding |
That gh-26574 PR is pretty small - in case the issue we ran into there is fully fixed, please feel free to fold those changes into this PR. |
EDIT: oops, wrong branch checked out |
It looks like this is working, but I did notice something a little weird when I tried testing. It looks like if you use goldbaum at Mac in ~/Documents
○ python
Python 3.13.1 experimental free-threading build (main, Dec 10 2024, 14:07:41) [Clang 16.0.0 (clang-1600.0.26.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkgconf
>>> list(pkgconf.get_pkg_config_path())
['/Users/goldbaum/.pyenv/versions/3.13.1t/lib/python3.13t/site-packages/numpy/_core/lib/pkgconfig']
>>> import numpy
>>> numpy.__version__
Traceback (most recent call last):
File "<python-input-3>", line 1, in <module>
numpy.__version__
AttributeError: module 'numpy' has no attribute '__version__'
>>> quit
goldbaum at Mac in ~/Documents
○ python
Python 3.13.1 experimental free-threading build (main, Dec 10 2024, 14:07:41) [Clang 16.0.0 (clang-1600.0.26.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import pkgconf
>>> list(pkgconf.get_pkg_config_path())
['/Users/goldbaum/.pyenv/versions/3.13.1t/lib/python3.13t/site-packages/numpy/_core/lib/pkgconfig']
>>> numpy.__version__
'2.3.0.dev0+git20250122.deb4bf3' That seems like a bug in the pkgconf-pypi project though and probably unrelated to merging this. |
Yeah, I don't think we really need a test, defining an entrypoint is very low-risk. If anything, what could make sense is making sure its value is correct, for the |
I added a test to check the entrypoint. While I was at it, I also refactored a bit the |
97292b8
to
7fef045
Compare
That must have to do with our lazy loading, which we need to do to resolve the path of the module specified in the entrypoint without actually executing the module, in case that raises an exception. I'll look into it. |
a814d04
to
d298264
Compare
I believe the CI failure is unrelated, could someone trigger a re-run of the job? Thanks! |
I re-ran it now. It is very likely related though - that's the one job that uses an editable install and builds extension modules with f2py, so I think your tweaks to determining |
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
…ported Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
Signed-off-by: Filipe Laíns <lains@riseup.net>
3a4a3c0
to
68a501c
Compare
Signed-off-by: Filipe Laíns <lains@riseup.net>
e8b70bf
to
12f69e0
Compare
Alright, everything's good now 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks this looks like a nice cleanup! Sorry my comment led to you discovering a bunch of issues but I'm glad you found and fixed things. I didn't look it over carefully but I will soon if someone else doesn't in the meantime.
No worries, this did highlight some un-engornomic aspects of the The The |
@FFY00 you're adding an unconditional test dependency here, which is undesirable. Was the old method to determine
If it's helpful to make it not a namespace package by adding an extra |
It depends on meson-python implementation details, and is incorrectly true if the environment prefix contains "editable" anywhere. The unconditional test dependency is only on older Python versions, so it's temporary. It could be worked around by reading
No, we explicitly don't want those modules to show in |
Yes I know, that's fine. Those are pretty minor downsides that don't matter in practice (and in case |
I'd be okay with an optional test dependency, but keeping the fallback to the current method is necessary instead of failing outright. |
I backported |
5f3f9a7
to
89bf31b
Compare
Signed-off-by: Filipe Laíns <lains@riseup.net>
89bf31b
to
f6d44cc
Compare
The CI seems to be happy now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I trust you to know the packaging details here better than I do.
It's technically a new feature so I think it needs a release note.
Also this is not your fault and it's not incumbent on you to fix in this PR, but it looks the only place numpy-config
is documented is in the release notes. Maybe we could add a note to the docstring for np.show_config
? Or give it its own page somewhere?
Packaging-wise, this only adds metadata, so it's a very low-risk change when it comes to the NumPy project itself 1. They only affect the usage of the
Ah, yes, it definitely makes sense mentioning this in the release notes.
I am happy to do this, but maybe it'd be better to do it in a separate PR? So that we can discuss its documentation details without impacting the Footnotes
|
Signed-off-by: Filipe Laíns <lains@riseup.net>
Sounds great! I'm going to merge this now. |
Asserting on a non-empty string literal will always pass This line of code had been modified by numpy#28214 / b45b614 without any explanation. I believe that's an error as the current asertion is a no-op. So revert to actually test something in this test.
Asserting on a non-empty string literal will always pass This line had been modified by numpy#28214 / b45b614 without any explanation. I believe that's an error as the current asertion is a no-op. So revert to actually test something!
Asserting on a non-empty string literal will always pass This line had been modified by numpy#28214 / b45b614 without any explanation. I believe it's an error as the current assertion is a no-op. Change to have the test actually test something.
This makes pkgconf-pypi be able to pickup NumPy's pkg-config file.