-
Notifications
You must be signed in to change notification settings - Fork 104
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
Persist packages from original lockfile _only_ for platforms not requested for lock #485
Conversation
✅ Deploy Preview for conda-lock ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@maresb What do you think of this approach? We have to add some unit tests, but want to check that the approach is sound and take feedback in to account before writing unit tests for what might be a bad idea 😸 |
conda_lock/conda_lock.py
Outdated
for dep in lock_content.package | ||
if dep.platform not in platforms_to_lock | ||
] | ||
filtered_lock_content = lock_content.copy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better name: lock_content_to_persist
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya. I'd even rename the original to original_lock_content
. And maybe new_lock_content
→ fresh_lock_content
in order to reserve new_lock_content
for the final result.
I'm a big fan of long and descriptive variable names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya. I'd even rename the original to original_lock_content. And maybe new_lock_content → fresh_lock_content in order to reserve new_lock_content for the final result.
I'm a big fan of long and descriptive variable names.
💯 same here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- `lock_content` -> `old_lock_content` - `new_lock_content` -> `fresh_lock_content` - `filtered_lock_content` -> `lock_content_to_persist` - create var `new_lock_content` from merge of `filtered_lock_content` and `fresh_lock_content`
fb65026
to
40dc5f3
Compare
Unit tests for this change are in. We're thinking one more unit test to validate a single-platform update works as expected (that's not testing new functionality, it's testing a feature that pre-dates this change hasn't regressed). Then we're thinking we will work on variable naming! |
647aeca
to
e9a50df
Compare
While doing this renaming work, I felt the need to refactor. I actually got sucked a little bit in to doing a refactor and then pulled myself back and made this change as simple as I could. This change made it clear that there's a point midway in TODO: Rebase again, mark ready for review |
Co-authored-by: Arie Knoester <arikstr@gmail.com> Reviewed-by: Matt Fisher <mfisher87@gmail.com>
…or lock Addresses conda#196: for requested platforms replaces lock content without erroneously persisting packages. Co-authored-by: Arie Knoester <arikstr@gmail.com> Reviewed-by: Matt Fisher <mfisher87@gmail.com>
Co-authored-by: Arie Knoester <arikstr@gmail.com>
b13c677
to
2a1fb78
Compare
assert lock_content is not None | ||
# After this point, we're working with `new_lock_content`, never | ||
# `original_lock_content` or `fresh_lock_content`. | ||
assert new_lock_content is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this assertion a bit confusing. I was not able to type new_lock_content: Lockfile
because original_lock_content
could be None
when we do this assignment:
if not platforms_to_lock:
new_lock_content = original_lock_content
I would like to move this check in to the type system, but that seems better left for a larger refactor effort.
@@ -385,9 +385,12 @@ def make_lock_files( | |||
) | |||
platforms_to_lock = sorted(set(platforms_to_lock)) | |||
|
|||
if platforms_to_lock: | |||
if not platforms_to_lock: | |||
new_lock_content = original_lock_content |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since previously we were mutating lock_content
in this conditional block, the "else" condition was lack of mutation. I think making that case explicit and first made this renaming change the most readable.
@maresb I feel this is ready for a full review :) Thanks for your time thinking about this change! |
Thanks so much for this!!! I'm currently on the road and a bit slammed, so I'm not sure how long it'll take me to give the 👍 but at first glance everything looks good. I don't like having both Left: |
I could probably knock that out! I've used |
The test workflow and netlify builds use the |
Ah, I'm so sorry, I didn't mean to send you down that rabbit hole! Let's
I don't have access to Netlify myself, so it's a black box. We'll need help from @mariusvniekerk on this. I tried setting up Netlify through my GitHub, but this is what I end up with: |
54f685d
to
99922db
Compare
No sweat at all, I didn't fall in too deep :P I think I've got all the requests done now @maresb! |
@maresb I've used One way I've seen to work around this is to have Actions build previews in response to comments (
|
I'm seeing this error 504 on PR #504 as well (just a coincidence :P )... I'm able to download this file just fine on my local machine. |
I'm hoping that the error we're seeing is transient. I'm rerunning the failed tests. I'm a bit confused by the last commit. Do we really want to offer Apart from that, this is really wonderful, and really boosts the code quality here! As soon as we clarify the README and the failing test I'm ready to merge. |
Looks like we're in luck 🥳
My fault, forgot I need to be pushing to @itsarobin's fork instead of mine :) Thanks for supporting this change! It's always been a pleasure to interact on this repo ❤️ |
Thank you @mfisher87! Likewise, it's a pleasure to get such well-curated PRs that I can review in just a few minutes! All this refactoring and cleanup is greatly appreciated. |
Shouldn't be needed anymore after conda/conda-lock#485. Also removed some extra whitespace.
* Bump conda-lock from 1.4 to 2.3 Bumps [conda-lock](https://github.com/conda/conda-lock) from 1.4.0 to 2.3.0. - [Release notes](https://github.com/conda/conda-lock/releases) - [Commits](conda/conda-lock@v1.4.0...v2.3.0) * [condalock-command] autogenerated conda-lock files * Remove rm conda-lock.yml workaround Shouldn't be needed anymore after conda/conda-lock#485. Also removed some extra whitespace. --------- Co-authored-by: pangeo-bot <pangeo-bot@users.noreply.github.com>
Description
Addresses #196: for requested platforms replaces lock content without erroneously persisting packages.
TODO:
Co-authored-by: Arie Knoester arikstr@gmail.com
Reviewed-by: Matt Fisher mfisher87@gmail.com