rhythmic-morning-87313
05/01/2022, 5:49 AMrhythmic-morning-87313
05/01/2022, 7:33 AMrhythmic-morning-87313
05/01/2022, 9:36 AM./pants run src/ai/backend/manager:server
(a pex_binary()
target which depends on python_sources()
target) or ./pants run src/ai/backend/manager/server.py
, it says importlib.metadata.PackageNotFoundError: No package metadata was found for backend.ai-manager
with the following __init__.py
. How do I make the package version information available in this case?rhythmic-morning-87313
05/01/2022, 9:51 AM--no-run-cleanup
to run
commands, should I manually clean up the temporary dirs? Is there any command to clean up all remaining stuffs at once?rhythmic-morning-87313
05/01/2022, 9:52 AM--no-run-cleanup
, the finalization process seems to interfere with my own cleanup procedures, crashing Python.
Can I keep my program to handle signals transparently?busy-vase-39202
05/01/2022, 6:47 PMicy-hair-30586
05/01/2022, 8:15 PMpython_requirement(
name="fastapi",
requirements=["fastapi==0.75.2"],
)
python_requirement(
name="uvicorn",
requirements=["uvicorn==0.17.6"],
)
Then I can get a package without problems (at least during build, it doesn’t quite run how I want to yet, but that’s another question)
If I update the uvicorn dependency to be uvicorn[standard]==0.17.6
then I see something like this (with different packages failing on each run:
22:13:20.62 [INFO] Completed: Building app/app_binary.pex with 2 requirements: fastapi==0.75.2, uvicorn[standard]==0.17.6
22:13:20.62 [ERROR] 1 Exception encountered:
ProcessExecutionFailure: Process 'Building app/app_binary.pex with 2 requirements: fastapi==0.75.2, uvicorn[standard]==0.17.6' failed with exit code 1.
stdout:
stderr:
ERROR: Could not find a version that satisfies the requirement websockets>=10.0; extra == "standard" (from uvicorn[standard])
ERROR: No matching distribution found for websockets>=10.0; extra == "standard"
What am I missing?high-yak-85899
05/01/2022, 11:28 PMicy-hair-30586
05/02/2022, 7:07 AMpex_binary(
name="app_binary",
execution_mode="venv",
dependencies=[
":app",
"3rdparty/python:uvicorn", # This isn't imported anywhere, so dependency inference doesn't find it.
],
entry_point="main.py",
platforms=["linux_x86_64-cp-3.8.13-cp38m"],
interpreter_constraints=["==3.8.13"]
)
but when I build the image and try to run it, the error is
/app_binary.pex
/usr/bin/env: 'python3.10': No such file or directory
my expectation was that the shebang would pick an interpreter that matches the constraints.
Besides setting shebang explicitly, how can I ensure a proper interpreter gets picked?rhythmic-morning-87313
05/02/2022, 9:05 AMrhythmic-morning-87313
05/02/2022, 1:55 PM./pants
goal?numerous-waitress-55735
05/02/2022, 3:10 PMwide-zoo-86070
05/02/2022, 3:27 PMPEX_ROOT
, PANT_LOCAL_STORE_DIR
and PANTS_NAMED_CACHES_DIR
in our CI. With those, we can see the pex cache are used within builds across a single branch, i.e, after the first builds, the following builds on that branch will re-use the pex cache. The question is, given we config the PEX_ROOT
, PANT_LOCAL_STORE_DIR
and PANTS_NAMED_CACHES_DIR
to be the same place across all build, won’t the cache be shared across all builds and branches? For example, if one build on a branch resolves the ‘python-default’ from build-support/lockfile.txt, can it be shared?cold-soccer-63228
05/02/2022, 4:02 PMgoogleapiclient
Python package when running ./pants test ...
. It seems to be an issue with the underlying pyparsing
module.
I was wondering if anyone has seen anything like this before.
The error I'm getting is as follows.
AttributeError: module 'pyparsing' has no attribute 'downcaseTokens'
Here's the part of the stack trace that seems relevant.
front_porch/modules/common/google_drive/google_drive.py:11: in <module>
from googleapiclient.discovery import build
/Users/hughhan/.cache/pants/named_caches/pex_root/venvs/8dccf2108884fe3898a8bc04279cb74a330a1bbd/e83365d7bd577d2fac6d4ec70eb77f4d4607d634/lib/python3.9/site-packages/googleapiclient/discovery.py:48: in <module>
import httplib2
/Users/hughhan/.cache/pants/named_caches/pex_root/venvs/8dccf2108884fe3898a8bc04279cb74a330a1bbd/e83365d7bd577d2fac6d4ec70eb77f4d4607d634/lib/python3.9/site-packages/httplib2/__init__.py:52: in <module>
from . import auth
/Users/hughhan/.cache/pants/named_caches/pex_root/venvs/8dccf2108884fe3898a8bc04279cb74a330a1bbd/e83365d7bd577d2fac6d4ec70eb77f4d4607d634/lib/python3.9/site-packages/httplib2/auth.py:20: in <module>
auth_param_name = token.copy().setName("auth-param-name").addParseAction(pp.downcaseTokens)
E AttributeError: module 'pyparsing' has no attribute 'downcaseTokens'
busy-vase-39202
05/02/2022, 4:31 PMcold-soccer-63228
05/02/2022, 5:25 PMPipfile.lock
cannot be used as the lockfile? Generating lockfiles via Pants seems to be very slow...
➜ ./pants generate-lockfiles
⠠ 461.47s Determine all Python interpreter versions used by Pytest in your proje
⠠ 461.47s Determine if MyPy should use Python 3.8+ (for lockfile usage)
⠠
brainy-solstice-27042
05/02/2022, 5:39 PMbrainy-solstice-27042
05/02/2022, 5:40 PM--debug
flag but that didn't give me what I neededwitty-crayon-22786
05/02/2022, 8:10 PMcold-soccer-63228
05/02/2022, 8:56 PMBUILD
files via Git?
I noticed that if I have */**/BUILD
in the .gitignore
, then Pants commands will complain that a BUILD
file doesn't exist, even though it does exist in the local filesystem.high-energy-55500
05/03/2022, 12:07 AMhigh-yak-85899
05/03/2022, 5:22 AMexport
to reduce our bootstrap times. This bootstrapping does something like pip install -U -e . -r requirements.txt -c constraints.txt
. Even with a warm pip cache, this takes usually around 2 minutes or so while ./pants export
is only like 15 seconds. The missing details are that the venv written by export
sensibly doesn't have the -e .
install step. Anyone tried to do something like this before?purple-umbrella-89891
05/03/2022, 7:45 AMCOVERAGE_FILE=.coverage.1 pytest -rfs -v --cov=source/mypkg --option1 tests/
COVERAGE_FILE=.coverage.2 pytest -rfs -v --cov=source/mypkg --option2 tests/
COVERAGE_FILE=.coverage.3 pytest -rfs -v --cov=source/mypkg --option3 tests/
coverage combine .coverage.*
coverage report
coverage xml -o coverage.xml
The custom options --option1
, --option2
and --option3
affect both the code paths in the tests and the selection of which tests to run. The subsets running for the three options are to a large extent overlapping, so it is not possible to split them into directories.
Moving to pants, I additionally used tags for the selection of the tests, to avoid the error when a file has no tests selected due to one of the options. The relevant environment is as follows:
# pants.toml
[coverage-py]
report = ["console", "raw"]
# pyproject.toml
[tool.coverage.report]
ignore_errors = true
And the commands look like this:
./pants --tag='+subset1' test --test-use-coverage --coverage-py-output-dir=dist/coverage/1 :: -- --option1
./pants --tag='+subset2' test --test-use-coverage --coverage-py-output-dir=dist/coverage/2 :: -- --option2
./pants --tag='+subset3' test --test-use-coverage --coverage-py-output-dir=dist/coverage/3 :: -- --option3
Here is the main problem: Even though at the end of each one of the commands, the report on the console is accurate, trying to combine or even just report the coverage from the dist/coverage/*/.coverage
files results in 0% coverage, which means I cannot export the combined report to xml.
Also a minor problem, which might be helpful/related, but is solved on its own: If I leave out the ignore_errors = true
in pyproject.toml
, I get the following error, although there is no file with the name config-3.py
in the project:
ProcessExecutionFailure: Process 'Generate Pytest report coverage report.' failed with exit code 1.
stdout:
No source for code: '/tmp/process-executionSiZHX7/config-3.py'.
Aborting report output, consider using -i.
For pants I used version 2.10.0 for experimenting/debugging and just tried 2.11.0, which results in the same behavior.
I would try to create a minimal example of a repo causing this behavior, but since it would take quite a bit of effort to reduce it accordingly, I wanted to ask the community if anything comes to mind.
Thanks in advance!fresh-cat-90827
05/03/2022, 8:38 AM$HOME/.cache/pants
that is shared by multiple builds that happen on the same node (each inside a Docker container with the mounted cache directory) at the same time.rhythmic-morning-87313
05/03/2022, 8:43 AM./pants test
, pyproject.toml
with tool.pytest
section seems not to be applied. Adding explicit dependency from python_tests
target to resource(name="pyproject", source="pyproject.toml")
as //:pyproject
makes the pants engine to crash:
08:40:29.91 [ERROR] panic at 'called `Result::unwrap()` on an `Err` value: PyErr { type: <class 'TypeError'>, value: TypeError("format_exception() got an unexpected keyword argument 'etype'"), traceback: Some(<traceback object at 0xffff7fa3c2c0>) }', src/python.rs:432
08:40:29.91 [ERROR] Please set RUST_BACKTRACE=1, re-run, and then file a bug at <https://github.com/pantsbuild/pants/issues>.
08:40:29.92 [INFO] Filesystem changed during run: retrying `Test` in 500ms...
How do I let my tests recognize pyproject.toml
in the repository root? (It's not used for distribution builds but only to configure tools)rhythmic-morning-87313
05/03/2022, 8:46 AMpytest
without modifying pants.toml
? (e.g., Just temporarily add -s
to capture console outputs in the tests)sparse-lifeguard-95737
05/03/2022, 2:31 PMrequirements.txt
I have:
numpy==1.19.5
opencv-python-headless==4.5.5.62
this works fine with vanilla pip install
, but when I run ./pants generate-lockfiles
I get the failure:
ERROR: Cannot install numpy==1.19.5 and opencv-python-headless==4.5.5.62 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit <https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies>
The conflict is caused by:
The user requested numpy==1.19.5
opencv-python-headless 4.5.5.62 depends on numpy>=1.21.2; python_version >= "3.6" and platform_system == "Darwin" and platform_machine == "arm64"
I checked the setup.py
for that version of opencv-python-headless
and confirmed that the newer numpy version is only required when running on ARM (see here). Is it a mistake that pex lockfile generation is trying to resolve a dependency for platform_machine == "arm64"
when I’m running on an intel mac? or is this the correct behavior because the lockfile is trying to support both intel and m1 macs?calm-ambulance-65371
05/03/2022, 4:18 PM2.11
now, but I'm back to running into the problem of a bunch of these errors:
uuid
Required by:
FingerprintedDistribution(distribution=<redacted> 2022.123.dev0+7d7bc1d951ada7b3f3d312e8850cace595786fdb (/home/noah/.cache/pants/named_caches/pex_root/installed_wheels/f39032808de7e6b03a697160fa392a8859ad782ea7bab0a2b192e58d91398627/<redacted>-2022.123.dev0+7d7bc1d951ada7b3f3d312e8850cace595786fdb-py3-none-any.whl), fingerprint='5c17f902db49407ef6ca4fa477de58d0e1ebf00cbbdd75d4b2770554cd068006')
wide-zoo-86070
05/03/2022, 4:35 PM--changed-dependees
, suppose I have two tests in unit/A_test.py
and unit/B_test.py
and I only modified the A_test.py
. It seem, if I run ./pants --changed-since=origin/master --changed-dependees=transitive test
, the test in B_test.py also got triggered even B_test.py
does not depend on A_test.py
. I am wondering why? it is because they shared the same BUILD file unit/BUILD
?high-yak-85899
05/03/2022, 5:55 PM2.10.1rc0
to 2.11.0
and I'm seeing some funny behavior. When I make the bump and run something simple like ./pants help test
, I get the warning logs about deprecated macros and how to fix (I already have use_deprecated_python_macros = false
from the previous bump from 2.9
to 2.10
). So, I delete that option and run the update-build-files --fix-python-macros
and I get an error saying use_deprecated_python_macros
is already set to false (first issue with the help logs since it says to just delete the option). So, I set to true
and I get
11:53:37.02 [ERROR] 1 Exception encountered:
MappingError: Failed to parse ./BUILD.pants:
__call__() got an unexpected keyword argument 'name'
I take it this is for python_requirements()
so I delete the name field in there and then run it again and I get spammed with
* `python_requirements` in BUILD.pants: add `name="reqs"
11:54:34.40 [ERROR] You must manually add the `name=` field to the following targets. This is not done automatically by the `update-build-files` goal
So I'm in some kind of circular issue here and not sure how to resolve.