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

overrides: integrate poetry2nix_override_bruteforcer (many overrides...) #1742

Conversation

TyberiusPrime
Copy link
Contributor

poetry2nix_override_bruteforcer is an attempt to enlarge the set of packages poetry2nix can actually build.

It starts with a 16kish set of python packages (top 8k by downloads, everything with 5 or more pypi dependencies), tries to build them, and then auto-writes build-systems / overrides, downloads cargo.locks etc., all depending on the failure messages.

With a little bit of polishing, these are then ready to integrate into poetry2nix, hence this PR.

I have chosen to integrate them as separate files, since it's so much generated code, and I don't want to pollute the current set of hand-crafted overrides. Also it should make updates later on easy, since we don't need to actually merge files.

And I fully expect that the generated get both larger, and more polished in the future as the scope and sophistication of poetry2nix_override_bruteforcer grows.

Statistics:
The package set is 16375 packages larges (17336 minus packages that I have tagged 'won't ever build).
The base rev I used (which incoporates #1738) builds 6467 of them, or 39.49%.
The auto-generated overrides manage to build another 7667, leading to a 86.31% build rate.

(the actual merged set might build a few fewer. There's some need to merge multiple overrides that I haven't been able to get to yet, and so they're not included here. Same for 'needs different overrides depending on package version'. But it's a small set)

  • Commit messages are conventional - examples from the log include "feat: add changelog files to fixup hook", "fix(contourpy): allow wheel usage", and "test: add sqlalchemy2 test"

@Atry
Copy link
Contributor

Atry commented Aug 1, 2024

Some existing tests are broken. Do you know why?

@TyberiusPrime
Copy link
Contributor Author

Some existing tests are broken. Do you know why?

I haven't had time to investigate, but I expect it to be python package drift - i.e. older versions needing different overrides than the current ones.

Plus maybe the override issue in #1737 .

I'll get it into mergeable state next week, hopefully, had to take a brief break.

@TyberiusPrime TyberiusPrime force-pushed the autodiscovered_overrides branch 6 times, most recently from 2a18dfa to 7295413 Compare August 14, 2024 18:50
@TyberiusPrime TyberiusPrime force-pushed the autodiscovered_overrides branch 2 times, most recently from e1ff8f5 to 63b62d1 Compare August 21, 2024 12:24
@TyberiusPrime
Copy link
Contributor Author

Once more, with feeling.
It was indeed mostly drift in what the python packages actually need.

I also fixed a bunch of packages that need setuptools_scm or such not to produce 0.0.0 'versions' in the output.

And bunch more epi-circles in the generator.
Let's hope it passes the CI now.

@TyberiusPrime TyberiusPrime force-pushed the autodiscovered_overrides branch 3 times, most recently from 085ac5c to d1c131a Compare August 22, 2024 08:04
@TyberiusPrime
Copy link
Contributor Author

TyberiusPrime commented Aug 22, 2024

Ok, I think the vllm one and the mac one are temporary issues talking with pypi,
for at least vllm builds locally (with a cached xformers wheel).

2024-08-22T08:32:53.4011699Z error: builder for '/nix/store/5885nhv9qmnn165cpza4p4mnj1c2av49-xformers-0.0.26.post1-cp311-cp311-manylinux2014_x86_64.whl.drv' failed with exit code 92;
2024-08-22T08:32:53.4013180Z        last 7 log lines:
2024-08-22T08:32:53.4014748Z        > Trying to fetch with predicted URL: https://files.pythonhosted.org/packages/wheel/x/xformers/xformers-0.0.26.post1-cp311-cp311-manylinux2014_x86_64.whl
2024-08-22T08:32:53.4016224Z        > curl: (22) The requested URL returned error: 404
2024-08-22T08:32:53.4016807Z        >
2024-08-22T08:32:53.4018306Z        > Predicted URL 'https://files.pythonhosted.org/packages/wheel/x/xformers/xformers-0.0.26.post1-cp311-cp311-manylinux2014_x86_64.whl' failed, querying pypi.org
2024-08-22T08:32:53.4020098Z        > ######################################################################## 100.0%
2024-08-22T08:32:53.4021046Z        > ###################################################                       71.5%curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)
2024-08-22T08:32:53.4021841Z        >
2024-08-22T08:32:53.4023138Z        For full logs, run 'nix log /nix/store/5885nhv9qmnn165cpza4p4mnj1c2av49-xformers-0.0.26.post1-cp311-cp311-manylinux2014_x86_64.whl.drv'.
2024-08-22T08:32:53.4291648Z building '/nix/store/i4pf4x95q2rjklaxmrr7mci9njmwkzqn-yarl-1.9.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.drv'...

Otherwise, I think I got it in mergeable shape for now.

Obviously, the overrides could use some nix-level refactoring, but I'll have to rethink the architecture of my 'bruteforcer' first.

I needed to do a lot of 'sweeping' of every package version,
so the stats read

Total pkg * versions attempted: 41847
builds without patch: 31.69%
builds after patch 84.22 %

I'll retrigger the CI some time later today, hopefully it the pypi issue will have passed by then.
(edit: I have retriggered the CI. I can nix-store --realise --check the very FOD derivation that failed in CI).

@TyberiusPrime TyberiusPrime force-pushed the autodiscovered_overrides branch from d1c131a to cf609a0 Compare August 22, 2024 12:47
(poetry2nix_override_bruteforcer)[https://github.com/TyberiusPrime/poetry2nix_override_bruteforcer] as an attempt to enlarge the set of
packages poetry2nix can atually build.

It starts with a 16kish set of python packages (top 8k by downloads,
everything with 5 or more pypi dependencies), tries to build them,
and then auto-writes build-systems / overrides, downloads cargo.locks
etc., all  depending on the failure messages.

With a little bit of polishing, these are then ready to integrate
into poetry2nix.

I have chosen to integrate them as separate files,
since it's so much generated code, and I don't want to polute the
current set of hand-crafted overrides. Also it should make updates
later on easy, since we don't need to actually merge files.

And I fully expect that they get both larger, and more polished
in the future as the scope and sophistication of poetry2nix_override_bruteforcer
grows.
@TyberiusPrime TyberiusPrime force-pushed the autodiscovered_overrides branch from cf609a0 to d08a3e9 Compare August 23, 2024 07:44
@TyberiusPrime
Copy link
Contributor Author

Ok, the pypi issues went away but I broke two packages on mac.
Wish I could test that locally, but a quick grep suggests there shouldn't be any more. (fingers crossed...)

@TyberiusPrime
Copy link
Contributor Author

Great, now the macos runner is running out of disk space ?!

@Atry
Copy link
Contributor

Atry commented Sep 9, 2024

@adisbladis This PR is really useful. How can we get it merged?

@TyberiusPrime
Copy link
Contributor Author

TyberiusPrime commented Sep 18, 2024

If you like this PR, you might also like https://github.com/TyberiusPrime/uv2nix_hammer_overrides which is an independent override collection.

@TyberiusPrime
Copy link
Contributor Author

abandoning this for uv2nix.

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 this pull request may close these issues.

2 participants