brief-branch-21752
10/18/2024, 4:20 PM>=3.9,<3.13
). In order to speed up local development, we would like to just test/check with 3.12 and let CI/CD cover the other versions. Is there a way to do that? I tried setting a .pants.rc
file with interpreter_constraints = ["==3.12.*"]
but then I just get an error when running tests like this:
InvalidFieldException: The target tests/cli/test_cli.py:tests@interpreter_constraints=py310 has the `interpreter_constraints` ('==3.10.*',), which are not a subset of the `interpreter_constraints` of some of its dependencies
better-van-82973
10/18/2024, 4:55 PM==3.12.*
in your pants.toml
, but override it to >=3.9,<3.13
in pants.ci.toml
. Does that work?brief-branch-21752
10/18/2024, 5:56 PMpython_tests(
name = "tests",
interpreter_constraints = parametrize(
py310 = ["==3.10.*"],
py311 = ["==3.11.*"],
py312 = ["==3.12.*"],
py39 = ["==3.9.*"],
),
)
It seems like the issue is that I am saying in pants config that I am only using 3.12 but then the test is asserting it should run on 3.9 through 3.12.curved-manchester-66006
10/18/2024, 6:39 PM**parametrize(
"py311",
interpreter_constraints=["==3.11.*"],
tags=["py311", "unit", "unit-test"],
And then you could -- I think -- locally always do:
--tag=py311
to only run those testsbrief-branch-21752
10/18/2024, 6:39 PMbrief-branch-21752
10/18/2024, 6:41 PMbrief-branch-21752
10/18/2024, 7:54 PMcurved-manchester-66006
10/18/2024, 8:05 PMThe mypy check takes a long time.Doe
pants --tag=py311 check foo::
not work the same?brief-branch-21752
10/18/2024, 11:35 PM16:25:29.25 [WARN] The target path/to/file.py@parametrize=py311 imports `some.other.path.Class`, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['some/other/path.py@parametrize=py310', 'some/other/path.py@parametrize=py311', 'some/other/path.py@parametrize=py312', 'some/other/path.py@parametrize=py39'].
So it seems like it doesn't understand the relationship between sources that py39
should related to py39
in the dependency. My sources currently don't define an interpreter-constraint at all and just use the project default of ">=3.9,<3.13"
.curved-manchester-66006
10/19/2024, 12:50 AM">=3.9,<3.13"
and locally everyone has just 3.12, what does pants check
do that isn't what you would like?brief-branch-21752
10/20/2024, 10:30 PM16:44:05.88 [INFO] Completed: Typecheck using MyPy - mypy - mypy succeeded.
Partition #1 - python-default, ['CPython<3.13,>=3.9']:
Success: no issues found in 261 source files
Partition #2 - python-default, ['CPython==3.12.*']:
Success: no issues found in 74 source files
Partition #3 - python-default, ['CPython==3.10.*']:
Success: no issues found in 25 source files
Partition #4 - python-default, ['CPython==3.11.*']:
Success: no issues found in 25 source files
Partition #5 - python-default, ['CPython==3.9.*']:
Success: no issues found in 25 source files
I guess partitions 3-5 are from python test files that mypy is checking. If I pass in --tag=py312
then I get this:
15:22:26.60 [INFO] Completed: Typecheck using MyPy - mypy - mypy succeeded.
Success: no issues found in 59 source files
Which makes sense in that it is only checking test files.
So I can't seem to find a way to say "check all files with mypy with only py312". That being said, I'm not sure how much time I would be saving if I did make pants only process 3.12 since it seems like the overhead of pex + having to set --no-incremental
for mypy (bug here: https://github.com/pantsbuild/pants/issues/18519) is causing most of extra time.