-
Notifications
You must be signed in to change notification settings - Fork 765
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
Apply Absorption Law when normalizing markers #4536
Comments
I wonder if we should do something like this: https://docs.rs/boolean_expression/latest/boolean_expression/enum.Expr.html#method.simplify_via_bdd |
Alternatively, maybe we can just apply this in the |
I think smart constructors are the way to go. To make smart constructors work, you have to make sure they are the only things capable of constructing the internal representation. You also need to make all normalization steps inductive. On top of this, I think the normalization logic (which would need to be ported to smart constructors in I would love to do this personally as I love smart constructors and they've worked out great when I used them in the past (like in |
I'm not sure the smart constructor helps with the simplification. For example, the expression I think it would be helpful to know what kind of expressions the lockfile generates to see how far we need to take this. We can solve this issue using our current recursive approach and see whether more complex cases come up. It's totally possible that an inductive approach that only looks one layer deep is enough for us, but I would hesitate to add smart constructors and them end up not being useful because we need to do a recursive solve anyways. |
This includes a functional change, we now skip the forked state pop/push if we didn't fork. From transformers: ``` DEBUG Pre-fork split universal took 0.036s DEBUG Split python_version >= '3.10' and python_version >= '3.10' and platform_system == 'Darwin' and python_version >= '3.11' and python_version >= '3.12' and python_version >= '3.6' and platform_system == 'Linux' and platform_machine == 'aarch64' took 0.048s DEBUG Split python_version <= '3.9' and platform_system == 'Darwin' and platform_machine == 'arm64' and python_version >= '3.7' and python_version >= '3.8' and python_version >= '3.9' took 0.038s ``` The messages could use simplification from #4536 We can consider nested spans in the future but this works nicely for now.
FYI I came across this today with the following example:
|
Confusingly there are Python versions that do not match either of those bounds. For example, |
I don't feel like that's a correct interpretation of Python version numbers. When you are installing into a Python installation there is only one specific version number available for that Python. So if you are installing into Python 3.11.0a0 then all versions of Python available (i.e. the one you are installing into) are pre-releases and therefore But that's just me thinking out loud, when I get a moment I'll check what pip does and read through the spec. |
I think per the spec it's correct. I actually agree that we should probably simplify that, but I think that's why it doesn't get simplified today.
|
My understanding is per PEP 440 But, this was just all off the top of my head, I should of really waited to get home and test it out. I will do so later. |
Got home and ran some tests and read some specs and I still think uv isn't correct here, I created a seperate issue: #4714 |
I filed a separate issue for that normalization here: #4719. (It's different than what's described in this issue.) |
## Summary More marker simplification: - Filters out redundant subtrees based on outer expressions, e.g. `a and (a or b)` simplifies to `a`. - Flattens nested trees internally, e.g. `(a and b) and c` Resolves #4536.
E.g.,
python_version < '3.11' or (python_version < '3.11' and implementation_name == 'cpython')
should be reduced topython_version < '3.11'
.The text was updated successfully, but these errors were encountered: