-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feat: support sdists #32
Comments
I believe the way to go is to compile the sdist to a wheel, and then extract metadata from there. We could also check how |
Pip definitely has to compile sdists to extract their metadata. I would make the recommendation that in any situation you can don't try to resolve sdists until you know for sure you can't use wheels to find a solution that matches the spec given. This can be in terms of backtracking on different packages but also installation version of a given package. Pip has an option called "--prefer-binary" which has been discussed for a long time to make default but will cause backwards compatibility issues for them. Compiling sdists is where a lot of the trouble around Python packaging comes from, as they can run arbitrary code and be heavily dependent on a users environment. Pip also immediately exits resolving requirements if an sdists compilation fails, this is on the assumption that the user does not have the prerequisites in their environment to compile. |
P.s. I think it's within spec to serve PEP 658 metadata files for sdists but I don't believe anyone is doing it yet or has a proposed solution for how that would work. But something to be aware of. |
The way that would work is:
|
There's an easier way for y'all, theoretically: Use Either of those still needs to use multiple subprocesses though, so that's going to slow down the overall resolve (it's a partial or complete build of the package). There's also the prepare_metadata hooks which allow short-curcuit builds, if the backend implements that and allows the resolver to get the dependency metadata eagerly. |
FWIW, Posy has some support for building source distributions in Rust without a dependency on |
Yes, so I will want to give a stab at implementing this in the coming week. What I see from posy is that it indeed uses it's own minimal build front-end and the following things need to be implemented. Let's say we are mainly interested in getting the metadata from the
This would also depend on wheel installs to create the environment #6 |
Just an update @baszalmstra @wolfv @ruben-arts and others. So I've been working on this some. Currently, have PKG-INFO loading #71 and reading the correct Now getting to the fun part, currently working on setting up the venv for building in a branch on my forked repo Also found out, that although PEP643 is widely implemented, the requirements do not always match-up. E.g apache airflow sdist has no depencies, while the wheel does, I think this is erroneous. |
You're missing an important caveat in PEP 643: it bumped the metadata version to 2.2 and your implementation is not filtering out projects that don't have that metadata version. |
@pradyunsg thanks will change that! |
@pradyunsg I created a PR that adresses the issue you noticed. #76 A question, in a lot of my testing I don't really see version 2.2 being used a lot. Do you have any idea how widespread the support is. I suppose, even though some projects like Flask seem to list the correct requirements even though still at an older Metadata-Version, we cannot rely on this as we cannot be sure this is correct. This potentially blocks out quite usable PKG-INFO's but I guees there is no other way. Also poetry/masonry for example, from a cursory glance at the source code, do seem to support the use of |
Will continue on the sdist building and leaving the PEP643 handling as is, as we would need this for resolution anyways. |
To keep better track I've split this into three issues
When we want to integrate this into pixi we would also need functions that expose the installation of an sdist. |
There shouldn't be any. pypi/warehouse#9660 -- PyPI does not support it yet, and hence backends shouldn't be producing that. I expect we'd have stricter validation of metadata on PyPI in a bit as well, with https://packaging.pypa.io/en/stable/metadata.html#packaging.metadata.Metadata implemented and available for use within Warehouse and pip. |
This is the first iteration in rip to add support for #78. Small test was added to see if the wheel install works, this will mainly be used for #32 but we can also integrate this into the `rip` binary to be able to add the install path there as well. @baszalmstra let me know if you want me to add this in a separate PR once this is merged.
Initial support is integrated as of now into main 👍 |
Currently we only support wheels. It would be nice if we could retrieve metadata from sdists.
Remaining:
The text was updated successfully, but these errors were encountered: