-
Notifications
You must be signed in to change notification settings - Fork 31
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
Change default to use ".venv" under project root #1001
Open
cpprust
wants to merge
1
commit into
DetachHead:main
Choose a base branch
from
cpprust:default-use-project-root-venv
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+16
−0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fixes DetachHead#365 If project root is found, and ".venv" is found under project root, use that venv as default. Project root is found if "pyrightconfig.json" or "pyproject.toml" is found. ".venv" can change to another name by change the '[tool.pyright] venv="venv_name"' in "pyproject.toml". But note that `uv` only support ".venv" so better stick with that.
thanks for the contribution. i think this sounds like a good idea, however i want to hold off merging it until #570 is resolved because otherwise there'll be no workaround |
Diff from mypy_primer, showing the effect of this PR on open source code: sympy (https://github.com/sympy/sympy)
- Type of "sol1" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
+ Type of "sol1" is "Equality | Unknown" (reportUnknownVariableType)
- /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:37:34 - error: Cannot access attribute "lhs" for class "Integer"
- Attribute "lhs" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:38:34 - error: Cannot access attribute "lhs" for class "Integer"
- Attribute "lhs" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:39:34 - error: Cannot access attribute "lhs" for class "Integer"
- Attribute "lhs" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:40:34 - error: Cannot access attribute "lhs" for class "Integer"
- Attribute "lhs" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:41:34 - error: Cannot access attribute "lhs" for class "Integer"
- Attribute "lhs" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:42:34 - error: Cannot access attribute "lhs" for class "Integer"
- Attribute "lhs" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/sympy/sympy/solvers/ode/tests/test_subscheck.py:43:34 - error: Cannot access attribute "lhs" for class "Integer"
- Attribute "lhs" is unknown (reportAttributeAccessIssue)
- Type of "sol3" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
+ Type of "sol3" is "Equality | Unknown" (reportUnknownVariableType)
- Type of "eqn" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
+ Type of "eqn" is "Equality | Unknown" (reportUnknownVariableType)
- Type of "sol" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
+ Type of "sol" is "Equality | Unknown" (reportUnknownVariableType)
- Type of "sol" is "Equality | Unknown | Relational | Unequality | Integer" (reportUnknownVariableType)
+ Type of "sol" is "Equality | Unknown" (reportUnknownVariableType)
- Type of "eqs" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eqs" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
- Type of "eq" is "tuple[Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer, Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "eq" is "tuple[Equality | Unknown, Equality | Unknown, Equality | Unknown]" (reportUnknownVariableType)
- Type of "sol" is "list[Equality | Unknown | Relational | Unequality | Integer]" (reportUnknownVariableType)
+ Type of "sol" is "list[Equality | Unknown]" (reportUnknownVariableType)
... (truncated 3441 lines) ...
black (https://github.com/psf/black): 5.96x slower (2.2s -> 12.8s in a single noisy sample)
spack (https://github.com/spack/spack)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtlink3/package.py:16:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtlink3/package.py:17:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtlink3/package.py:16:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtlink3/package.py:17:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtrun1/package.py:16:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtrun1/package.py:17:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtrun1/package.py:16:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtrun1/package.py:17:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtrun3/package.py:16:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtrun3/package.py:16:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dttop/package.py:16:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dttop/package.py:17:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dttop/package.py:18:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dttop/package.py:16:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dttop/package.py:17:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dttop/package.py:18:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtuse/package.py:16:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dtuse/package.py:16:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dyninst/package.py:28:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dyninst/package.py:29:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dyninst/package.py:28:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/dyninst/package.py:29:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/ecp-viz-sdk/package.py:17:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/ecp-viz-sdk/package.py:17:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/extension2/package.py:18:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/extension2/package.py:18:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py:17:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-buildable-with-variant/package.py:17:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-common-openssl/package.py:13:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-common-openssl/package.py:13:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-common-perl/package.py:13:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-common-perl/package.py:13:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-common-python/package.py:13:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-common-python/package.py:13:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
- /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-common-python/package.py:14:5 - warning: Result of call expression is of type "((pkg: type[PackageBase]) -> None)" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
+ /tmp/mypy_primer/projects/spack/var/spack/repos/builtin.mock/packages/external-common-python/package.py:14:5 - warning: Result of call expression is of type "(pkg: type[PackageBase]) -> None" and is not used; assign to variable "_" if this is intentional (reportUnusedCallResult)
... (truncated 92 lines) ...
comtypes (https://github.com/enthought/comtypes): 277.35x slower (0.1s -> 22.1s in a single noisy sample)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #365
If project root is found, and ".venv" is found under project root, use that as default.
Project root is found if "pyrightconfig.json" or "pyproject.toml" is found. ".venv" can change to another name by change the '[tool.pyright] venv="venv_name"' in "pyproject.toml". But note that
uv
only support ".venv" so better stick with that.