-
Notifications
You must be signed in to change notification settings - Fork 103
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
Refactor LockSpecification as a Dictionary from Platforms to List of Deps #383
Conversation
✅ Deploy Preview for conda-lock ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
0b567e5
to
8aaad3e
Compare
This is magnificent!!! I love that we were able to delete so much code. It's nice to see the CI green. And now the code logic agrees with my mental model. All this makes very happy. 😄 During my review I cleaned up some of the preexisting code a bit further: srilman#1. If you agree, let's wrap that into this PR by merging on your fork. I've reviewed this thoroughly, and from my side this is good to go. Since this is such a substantial structural change, I think we should get approval from @mariusvniekerk. |
@maresb I'm happy with the additional code cleanup in my local branch. I'm going to merge your branch into this one. |
Filtering categories is opt-in, thus the default of True is wrong. There is only one active usage of `make_lock_files` which sets `filter_categories` explicitly, so changing this value shouldn't break anything.
These lists are not optional, so `or []` doesn't seems to accomplish anything.
This is obsolete since we no longer use aggregate_lock_specs to aggregate specs from separate platforms.
We shouldn't compute `platforms` again in a different way. Instead we pass the value we already computed, and then we perform a consistency check whenever `len(lock_specs) > 0`.
For orientation as to how this fits into the big picture: What conda-lock does in a nutshell:
This PR reworks the internally-used |
To clarify further, this will not change how we parse input files or the resulting output lockfile in any way. This will only change an internal data structure so that it is easier to implement future changes. For example, I was working on a future PR to support encoding multiple categories in the lockfile, but kept running into bugs because of how we grouped all platforms together in the LockSpecification. |
Description
As discussed in #374, #278, and previously implemented in #316, this PR refactors the
LockSpecification
class to store all dependencies as a dictionary from platforms to a list of dependencies required for the platform.After this PR, it is no longer necessary to have the
Selector
class, so it is also removed in this PR.This PR still maintains source parsing code to return LockSpecification classes. This is not an ideal solution, since it requires parsing the source file multiple times. In the future, I will implement a PR to have a custom SourceFile class, like implemented in #316.