glamorous-river-64734
12/01/2020, 9:47 PMrequirements.txt
files each included in the BUILD
file with the python_requirements()
code. One is called api
and the other is called qa
. Here are their structures:
src/api/
├── BUILD
├── Dockerfile
├── app
│ ├── __init__.py
│ └── api.py
├── main.py
└── requirements.txt
and:
src/processors/qa/
├── BUILD
├── Dockerfile
├── app
│ ├── __init__.py
│ ├── api.py
│ └── qa.py
├── main.py
└── requirements.txt
The qa
one loads all of its requirements from pip great in both mypy runs and repl, but the api
one completely misses installing them.
Both have the same BUILD
file with just the name swapped out:
python_requirements()
python_library(
name="<name here>",
sources=["**/*.py"],
interpreter_constraints=[">=3.6"],
)
Anyone have any ideas why one loads packages and the other doesn’t? Or a handy command I can use to help debug?salmon-barista-63163
12/01/2020, 11:16 PMhelpful-lunch-92084
12/02/2020, 4:44 PMERROR: Double requirement given:
message when trying to run a recursive test of a top-level project dir:
For example:
pants test foo::
Imagine the structure of foo as:
foo/
foo//tests
foo//tests/python
foo//tests/python/baz
foo//tests/python/baz/test_baz.py
foo//tests/python/baz/BUILD
foo//tests/python/bar
foo//tests/python/bar/BUILD
foo//tests/python/bar/test_bar.py
foo//src
foo//src/python
foo//src/python/baz
foo//src/python/baz/__init__.py
foo//src/python/baz/BUILD
foo//src/python/bar
foo//src/python/bar/__init__.py
foo//src/python/bar/BUILD
Now in this case, the bar module imports one dependency, say boto3==1.0 and the baz module imports a newer boto, say boto3==2.0.
In our example, imagine that the baz module is a complete refactor-in-progress that doesn’t share any imports with bar.
It seems that the recursive test tries to resolve all dependencies at once, and thus sees those duplicate boto3 deps and bails.
In our real case it’s a py3 upgrade of a project that is using a newer numpy but I feel like the specifics aren’t as important.
I realize we could just simply move baz out of the foo top-level. But it seems like pants should be resolving these dependencies separately? Is there a way to force that? I know in past versions of pants it was possible to specify --no-test-pytest-fast
which would resolve each target’s dependencies separately. Is there something similar for pants v2?hundreds-father-404
12/02/2020, 5:18 PM./pants dependencies path/to/file.py
to ensure everything shows up.
* If Pex interpreter constraints are not satisifiable, suggest running py-constraints
.
* “DoubleRequirementError”: give the advice from https://www.pantsbuild.org/docs/troubleshooting#double-requirement-given-error-when-resolving-requirements
We’d do something like if "ModuleNotFoundError" in result.stderr
, and append the message below the process’s output
Thoughts?
Posted in #documentationbest-nightfall-7221
12/08/2020, 9:25 PMclean-night-52582
12/09/2020, 11:38 PM./pants test ::
is there anyway to ensure that a given test gets run first? I have a very slow tests that I would like to ensure is in the first batch. I think it could speed up my test sweet since it runs long after every other test.narrow-activity-17405
12/10/2020, 9:07 AMERROR: Could not find a version that satisfies the requirement pantsbuild.pants==2.2.0dev1
ERROR: No matching distribution found for pantsbuild.pants==2.2.0dev1
./pants: line 261: /home/zdenal/.cache/pants/setup/bootstrap-Linux-x86_64/2.2.0dev1_py36/bin/python: No such file or directory
Any idea what should I do in order to upgrade? 🙂acceptable-guitar-79854
12/10/2020, 10:21 AM-ldebug
would do that?narrow-activity-17405
12/10/2020, 3:30 PM[test]
use_coverage = true
in my pants.toml but after update to Pants 2.2.0.dev1 my integration tests (using runtime_package_dependencies) started failing with
pytest-cov: Failed to setup subprocess coverage. Environ: {'COV_CORE_SOURCE': '.', 'COV_CORE_CONFIG': '/tmp/process-executionN7mCSU/.coveragerc', 'COV_CORE_DATAFILE': '/tmp/process-executionN7mCSU/.coverage'} Exception: CoverageException("Unrecognized option '[run] relative_files=' in config file /tmp/process-executionN7mCSU/.coveragerc")
pytest-cov: Failed to setup subprocess coverage. Environ: {'COV_CORE_SOURCE': '.', 'COV_CORE_CONFIG': '/tmp/process-executionN7mCSU/.coveragerc', 'COV_CORE_DATAFILE': '/tmp/process-executionN7mCSU/.coverage'} Exception: CoverageException("Unrecognized option '[run] relative_files=' in config file /tmp/process-executionN7mCSU/.coveragerc")
Traceback (most recent call last):
File "/tmp/process-executionN7mCSU/src.python.arcor2_mocks.scripts/mock_scene.pex/.bootstrap/pex/pex.py", line 444, in execute
File "/tmp/process-executionN7mCSU/src.python.arcor2_mocks.scripts/mock_scene.pex/.bootstrap/pex/pex.py", line 103, in _activate
File "/tmp/process-executionN7mCSU/src.python.arcor2_mocks.scripts/mock_scene.pex/.bootstrap/pex/environment.py", line 260, in activate
File "/tmp/process-executionN7mCSU/src.python.arcor2_mocks.scripts/mock_scene.pex/.bootstrap/pex/environment.py", line 425, in _activate
File "/tmp/process-executionN7mCSU/src.python.arcor2_mocks.scripts/mock_scene.pex/.bootstrap/pex/environment.py", line 160, in _update_module_paths
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named '__mp_main__'
When I remove use_coverage
from pants.toml, it works ok again. Any idea?calm-ambulance-65371
12/10/2020, 4:54 PMpython_tests
and resources
?polite-vase-75369
12/11/2020, 4:30 PMhappy-kitchen-89482
12/11/2020, 5:33 PMhappy-kitchen-89482
12/11/2020, 5:35 PMhappy-kitchen-89482
12/11/2020, 5:36 PMhappy-kitchen-89482
12/11/2020, 5:36 PMenough-analyst-54434
12/11/2020, 5:54 PMhappy-kitchen-89482
12/11/2020, 6:18 PMhappy-kitchen-89482
12/11/2020, 6:18 PMhappy-kitchen-89482
12/11/2020, 6:19 PMhappy-kitchen-89482
12/11/2020, 6:19 PMenough-analyst-54434
12/11/2020, 6:20 PMhappy-kitchen-89482
12/11/2020, 6:21 PMenough-analyst-54434
12/11/2020, 6:21 PMenough-analyst-54434
12/11/2020, 6:29 PM./pants resolve.coursier --report 3rdparty:shapeless
...
10:28:07 00:04 [resolve]
10:28:07 00:04 [coursier]
10:28:07 00:04 [coursier]
/home/jsirois/.cache/pants/coursier/https/maven-central.storage-download.googleapis.com/maven2/org/scala-lang/scala-library/2.12.0/scala-library-2.12.0.jar
/home/jsirois/.cache/pants/coursier/https/maven-central.storage-download.googleapis.com/maven2/com/chuusai/shapeless_2.12/2.3.2/shapeless_2.12-2.3.2.jar
/home/jsirois/.cache/pants/coursier/https/maven-central.storage-download.googleapis.com/maven2/org/typelevel/macro-compat_2.12/1.1.1/macro-compat_2.12-1.1.1.jar
Result:
└─ com.chuusai:shapeless_2.12:2.3.2
├─ org.scala-lang:scala-library:2.12.0
└─ org.typelevel:macro-compat_2.12:1.1.1
└─ org.scala-lang:scala-library:2.12.0
...
enough-analyst-54434
12/11/2020, 6:30 PMpolite-vase-75369
12/11/2020, 6:35 PMpolite-vase-75369
12/11/2020, 6:38 PMpolite-vase-75369
12/11/2020, 6:43 PM/Users/lawrencefinn/.ivy2/pants/https/maven-central.storage-download.googleapis.com/maven2/com/fasterxml/jackson/core/jackson-annotations/2.6.7/jackson-annotations-2.6.7.jar
/Users/lawrencefinn/.ivy2/pants/https/repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.10.0/jackson-annotations-2.10.0.jar
polite-vase-75369
12/11/2020, 6:46 PMpolite-vase-75369
12/11/2020, 6:46 PM