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

Only call pip compile once #5905

Merged

Conversation

jerbob92
Copy link
Contributor

@jerbob92 jerbob92 commented Oct 17, 2022

Avoid unnecessary pip-compile processes, and explain why we need to run an extra one sometimes.

Closes #5903.

@jerbob92 jerbob92 requested a review from a team as a code owner October 17, 2022 14:40
@jerbob92 jerbob92 marked this pull request as draft October 17, 2022 14:40
@jurre
Copy link
Member

jurre commented Oct 18, 2022

Thanks for digging into this, would be interesting to get some data on how this effects real-world workloads!

@jerbob92
Copy link
Contributor Author

@jurre I have just ran the change on a real-world project of ours. It has 3 .in/.txt combinations (ci, dev and prod). It has a total of 33 direct dependencies and ~150 indirect dependencies. When running the dry run for one dependency where there is a newer version available, these are the run times:

  • On current main branch: 4m21.778s
  • With my changes: 1m52.702s

As you can see the improvement is quite significant. This is also because it has to run pip-compile for every .in/.txt combination. So you can imagine the total time profit if it's 2.5m faster for every dependency that has a newer version available (it always run this logic, even if the rules don't allow going to this new version, it only doesn't run it when the latest version available is your current version).

In this case the update was not allowed, due to requirements, so the total time profit could be even bigger because it also runs pip-compile twice in the updater itself.

@jurre
Copy link
Member

jurre commented Oct 19, 2022

Seems very promising, especially since we see just one test fail. Anything we can do to help from our end?

@deivid-rodriguez
Copy link
Contributor

I think my suggestion from #5903 (comment) should hopefully get things green!

@jerbob92 jerbob92 marked this pull request as ready for review October 19, 2022 19:51
@jerbob92 jerbob92 changed the title WIP: Only call pip compile once Only call pip compile once Oct 19, 2022
Copy link
Contributor

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome speed up! 🎉

@deivid-rodriguez deivid-rodriguez force-pushed the feature/only-call-pip-compile-once branch from fbc10f2 to 44a6dd7 Compare October 21, 2022 14:44
Copy link
Member

@Nishnha Nishnha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving based on the discussion in #5903

@jerbob92 jerbob92 force-pushed the feature/only-call-pip-compile-once branch from 44a6dd7 to e138e24 Compare October 22, 2022 09:23
…encies

Also, update the comment about why we do this.
@deivid-rodriguez deivid-rodriguez force-pushed the feature/only-call-pip-compile-once branch from e138e24 to fbdad5a Compare October 24, 2022 11:23
@deivid-rodriguez
Copy link
Contributor

Thanks so much for this @jerbob92! 🎉

@deivid-rodriguez deivid-rodriguez merged commit f494222 into dependabot:main Oct 24, 2022
@pavera pavera mentioned this pull request Oct 31, 2022
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.

pip-compile is called twice per dependency
4 participants