[ty] improve base conda distinction from child conda#20675
[ty] improve base conda distinction from child conda#20675Gankra merged 3 commits intoastral-sh:mainfrom
Conversation
9f5ae58 to
9bb68e9
Compare
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
|
Hmm this implementation has seemingly been working fine for uv for quite a while? Did I invert something in my implementation? |
|
Aha! uv just shipped this fix (and a bonus one) a couple weeks ago. |
Gankra
left a comment
There was a problem hiding this comment.
Approving the basic idea, but some more comment/naming cleanups are in-order, ala the equivalent uv PRs. Would you be interested in doing those extra changes? If not I can.
I can try to add these changes later today. |
| Used to detect the path of an active Conda environment. | ||
| If both `VIRTUAL_ENV` and `CONDA_PREFIX` are present, `VIRTUAL_ENV` will be preferred. | ||
|
|
||
| ### `_CONDA_ROOT` |
There was a problem hiding this comment.
uv writes CONDA_ROOT instead of _CONDA_ROOT, but the section is "Externally-defined variables", and the actual environment variable is with the _, so I wrote it like this.
|
@Gankra: I think I added what the mentioned uv PRs covered now. Let me know if you wanted more than this? Also: I left it is in a separate commit for now, but should I just rebase? |
* origin/main: [`flake8-bugbear`] Include certain guaranteed-mutable expressions: tuples, generators, and assignment expressions (`B006`) (#20024) [`flake8-comprehensions`] Clarify fix safety documentation (`C413`) (#20640) [ty] improve base conda distinction from child conda (#20675) [`ruff`] Extend FA102 with listed PEP 585-compatible APIs (#20659) [`ruff`] Handle argfile expansion errors gracefully (#20691) [`flynt`] Fix f-string quoting for mixed quote joiners (`FLY002`) (#20662) [ty] Fix file root matching for `/` [ruff,ty] Enable tracing's `log` feature [`flake8-annotations`] Fix return type annotations to handle shadowed builtin symbols (`ANN201`, `ANN202`, `ANN204`, `ANN205`, `ANN206`) (#20612) Bump 0.13.3 (#20685) Update benchmarking CI for cargo-codspeed v4 (#20686) [ty] Support single-starred argument for overload call (#20223) [ty] `~T` should never be assignable to `T` (#20606) [`pylint`] Clarify fix safety to include left-hand hashability (`PLR6201`) (#20518) [ty] No union with `Unknown` for module-global symbols (#20664) [`ty`] Reject renaming files to start with slash in Playground (#20666) [ty] Enums: allow multiple aliases to point to the same member (#20669)
Summary
#19990 didn't completely fix the base vs. child conda environment distinction, since it detected slightly different behavior than what I usually see in conda. E.g., I see something like the following:
But the current behavior looks for
CONDA_DEFAULT_ENV = basename(CONDA_PREFIX)for the base environment instead of the child environment, where we actually see this equality.This pull request fixes that and updates the tests correspondingly.
Test Plan
I updated the existing tests with the new behavior. Let me know if you want more tests. Note: It shouldn't be necessary to test for the case where we have
conda/envs/base, since one should not be able to create such an environment (one with the name ofCONDA_DEFAULT_ENV).