-
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
Remove optional
From Dependency Info in Internal Code
#389
Conversation
✅ Deploy Preview for conda-lock ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
8040d20
to
b372c6a
Compare
b372c6a
to
5e96205
Compare
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.
From a thorough reading of the changes, I'm quite confident that this is a pure refactor. LGTM, and significantly increases code clarity.
If you could rebase on main I'd like to merge. Thanks @srilman!
@@ -542,7 +542,7 @@ def render_lockfile_for_platform( # noqa: C901 | |||
lockfile.toposort_inplace() | |||
|
|||
for p in lockfile.package: | |||
if p.platform == platform and ((not p.optional) or (p.category in categories)): | |||
if p.platform == platform and p.category in categories: |
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.
Note to self: not p.optional
⇒ p.category == "main"
.
Since "main" in categories
, this is redundant and can be deleted.
Therefore, this is logically sound.
@@ -95,6 +93,9 @@ def parse_conda_lock_file( | |||
if not (isinstance(version, int) and version <= Lockfile.version): | |||
raise ValueError(f"{path} has unknown version {version}") | |||
|
|||
for p in content["package"]: | |||
del p["optional"] |
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.
Note to self: we need to delete the optional
key in order to parse this as a StrictModel
.
Or does it make more sense to merge #390 all at once, once I've completed that? |
Sorry, I seem to have been confused. |
@maresb Resolving conflicts now ... |
updates: - [github.com/pre-commit/mirrors-mypy: v1.0.1 → v1.1.1](pre-commit/mirrors-mypy@v1.0.1...v1.1.1)
d0d86be
to
5ee8289
Compare
Merged with main, everything should be good! |
Looking great, thanks!!! As we wait for the Windows test to finish, can we rebase #390 on this? |
"metadata": json.loads( | ||
content.metadata.json( |
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 just noticed that in #390 you have here instead "metadata": content.metadata.dict(
which seems more elegant. Is this an accident, or does this cover some edge case?
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 believe there was an issue when encoding content.metadata
as a dict due to a special class / container that was used in the metadata (was it a frozenset?). Let me check for certain.
The tests are passing. Let's pick up on #389 (comment) with #390. I have to stop for tonight. |
This PR removes any references to an
optional
flag or option from the entire codebase. This builds on top of PR #388, so make sure to get that one merged first. At that point, there is an implicit invariant for all dependencies; the dependency is optional ifcategory != "main"
. Therefore, storing the optional value just makes the code unnecessarily complex.Note that this does not affect how source files are parsed or the produced lock file in any way. The step that writes the lockfile out will insert
optional: true
oroptional: false
flags depending on the category.