-
Notifications
You must be signed in to change notification settings - Fork 14
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
Is there any chance of discovering package dependencies without building wheels? #40
Comments
Hi @petergardfjall, Interesting question which has also interested me for a while. On using sdist: I think in the end it all depends on how the developers set up their packages. If they have a standardized setup.py, it would be relatively easy (preferably using a requirements.txt). But there are a lot of difficult cases in the wild that will make custom sdist introspection very error prone. I also seem to remember older versions matplotlib, where the final dependencies are only known for your env/system after actually running e.g. As the potential speedup of avoiding wheel building is of course huge, a first step could be to use the pypi api as mentioned here: #38 (comment) I think the pypi api will give enough info to replace the whole return value of this function (and save two calls to pip including wheel building): Line 354 in 84a766d
However, I think it'll be hard to get rid of wheels in pipgrip completely, as pypi api will not always have the info (or potentially missing info for weird packages!) and support for custom index-urls will be quite a hassle to get to play nice. And then there's of course the env/implementation specifics that pip works hard to support (and indirectly propagate into pipgrip), so it would be kinda cutting corners I guess. Example: running On the other hand of course, there are packages that require non-python libs and will fail to build (see issue I linked above). Pypi api could be used as (imperfect) fallback in such cases. For the numpy error you're facing, try using gcc instead of clang. It's my standard c++ compiler and I think often avoids such problems :) (e.g. #36) Hope that helps! |
@ddelange thanks for sharing your thoughts. From a very unscientific investigation, I believe that the PyPi API approach (looking for I was thinking that one could perhaps use As mentioned here pypa/pip#1884 (comment):
So I seem to have realized that a "build-free" dependency resolution procedure appears a lot more difficult to achieve than I first, naively, thought. I get the feeling that we won't get further on this topic. Build-free dependency resolution appears to be a dead-end as far as I can see, so I'm gonna close the issue. |
Another interesting discussion for future reference: pypi/warehouse#8254 (found via https://github.com/uranusjr/warehouse-filebrowser) |
It seems there is movement on |
Are there any new on the front? https://www.python.org/dev/peps/pep-0643/ is |
Since PyPA's funding period (mainly used to get resolvelib into production) has ended, I don't think there is currently a timeline available for this big overhaul. But since they're committed to PEP compliance, it will come sooner or later :) Until then, it probably even makes sense to reopen this issue in the hope that the overhaul can consequently be used to speed up this lib |
Update: PEP-658 draft has been merged and implementation details are being discussed ref pypi/warehouse#8254 (comment) |
I've submitted pypi/warehouse#9972 so hopefully it will be possible to just download But if there is no
Then some real-time representations for errors.
The format can be expressed in CSV. What for? To share the data on which dependency trees have problems resolving with the explanation why. |
Let's hope these PEP's get adopted by PyPA soon! It will not only be a huge resolving speedup for the users of pip, it will theoretically allow pipgrip to resolve much faster too. However, unless pip exposes a new command to fetch this metadata via CLI, to exploit the METADATA availability, pipgrip would have to move away from using pip as sole gateway to the internet. For now, I'm hoping this can be avoided and pip will expose this metadata download functionality: Mainly, because implementing the logic in-house to talk to
Luckily in the best case there's no need to think about all that and we can vendor pip's upcoming metadata logic. I hope this does not extinguish your enthusiasm! Let's revisit once there is movement on PyPA's side 💥 |
Update:
now let's see if pipgrip can leverage it with the current pip api :) |
It looks like there is one blocker left to avoid downloading wheels: pypa/pip#11512 (comment) When there are no compatible wheels available, the corresponding metadata files won't help either, and so pip will be forced to attempt a build from source. So strictly speaking, this ticket will not be fixed even after pipgrip leverages PEP 658. With the adoption, however, I think most has been said and done on this ticket and so I will close it with a PR soon 👍 |
Released 0.10.5 |
Description
I'm trying to understand python dependency management in general, and
pipgrep
's approach specifically. In particular, I'd like to understand if it is possible, at all, to determine dependencies for a package without ever having to build wheels.For example, the result of running
pipgrip
to see the dependency tree of a package containing non-Python code differs depending on the version I want to analyze. For example,fails (
clang
compilation fails with a massive stacktrace), whereassucceeds, which appears to be caused by the latter case (
1.19.1
) having a readily-available wheel in PyPi that matches my Python interpreter (version, abi, platform) [1] whereas the former (1.9.2
) does not have a pre-builtbdist
wheel that matches my Python interpreter and, therefore, needs to be built from thesdist
(which requires a ton of packages to be installed on my computer).Now, my question is if it's strictly necessary for
pipgrip
to build wheels to determine dependencies?Would it be possible to determine the tree of dependencies by only looking at
sdist
distributions (and hence, never having to build wheels)? I'm probably missing something in my understanding of python's dependency management so feel free to enlighten me! :)[1]
{'implementation_name': 'cpython', 'implementation_version': '3.8.2', 'os_name': 'posix', 'platform_machine': 'x86_64', 'platform_release': '5.4.0-42-generic', 'platform_system': 'Linux', 'platform_version': '#46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020', 'python_full_version': '3.8.2', 'platform_python_implementation': 'CPython', 'python_version': '3.8', 'sys_platform': 'linux'}
Use case / motivation / context
Related Issues
The text was updated successfully, but these errors were encountered: