high-yak-85899
02/24/2023, 11:40 PMexport
in 2.15?
(3.8.10) ~/devel/monorepo (new-pants)$ ./pants export --resolve=pants-plugins
16:39:20.32 [INFO] Completed: chosen_resolve.name
16:39:20.94 [INFO] Completed: Get interpreter version
Wrote mutable virtualenv for pants-plugins (using Python 3.8.10) to dist/export/python/virtualenvs/pants-plugins
Looks like chosen_resolve.name
isn't unpacked as intended. Happy to move to a ticket if that seems like the case.happy-kitchen-89482
02/24/2023, 11:43 PMhappy-kitchen-89482
02/24/2023, 11:44 PMhigh-yak-85899
02/24/2023, 11:53 PM./pants export --resolve=<some resolve>
, it seems to wipe away any other exports I've done. Is it possible to keep existing exports in tact?high-yak-85899
02/25/2023, 12:15 AMdelightful-kite-93928
02/25/2023, 4:18 PMpants tailor
. Does anyone have a link to a "Migrate to Pants (for dummies)" doc/video?lemon-yak-80782
02/25/2023, 9:35 PMcrooked-lawyer-77407
02/26/2023, 4:54 AMpants build <target>
but even though this is called pantsbuild
there's actually no pants build
but pants package
Just thought this was funnycold-vr-15232
02/26/2023, 10:12 PMbreezy-apple-27122
02/27/2023, 9:00 AMclever-father-91273
02/27/2023, 12:18 PMproject
and utils
. Both contain python code and have their own requirements.txt files. project/requirements.txt
includes utils' requirements: -r ../utils/requirements.txt
since project's code imports utility functions. This setup has been working fine (I have been able to run pants test
command) until I decided to set up the resolves for the two submodules.
When I run pants test
, I'm constantly getting the following error: ModuleNotFoundError: No module named utils
. This comes from one of the `project`'s test scripts which tries to import a function from the utils directory. I have been able to include `utils`' dependencies to `project`'s resolve by using the parametrize
keyword, but I'm unable to include the utils
submodule itself.
Thanks in advance for any help!breezy-apple-27122
02/27/2023, 4:04 PMFailed to resolve requirements from PEX environment @ /root/.pex/unzipped_pexes/ce56906b160237e1254e7999de724a1bdd708b54.
Needed cp311-cp311-manylinux_2_31_aarch64 compatible dependencies for:
1: MarkupSafe>=2.0
Required by:
Jinja2 3.1.2
But this pex had no ProjectName(raw='MarkupSafe', normalized='markupsafe') distributions.
2: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0
Required by:
jsonschema 4.17.3
But this pex had no ProjectName(raw='pyrsistent', normalized='pyrsistent') distributions.
3: numpy
Required by:
altair 4.2.2
streamlit 1.19.0
But this pex had no ProjectName(raw='numpy', normalized='numpy') distributions.
4: pandas>=0.18
Required by:
altair 4.2.2
But this pex had no ProjectName(raw='pandas', normalized='pandas') distributions.
5: pandas>=0.25
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='pandas', normalized='pandas') distributions.
6: pillow>=6.2.0
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='pillow', normalized='pillow') distributions.
7: pyarrow>=4.0
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='pyarrow', normalized='pyarrow') distributions.
8: charset-normalizer<4,>=2
Required by:
requests 2.28.2
But this pex had no ProjectName(raw='charset-normalizer', normalized='charset-normalizer') distributions.
9: numpy>=1.16.4
Required by:
pydeck 0.8.0
But this pex had no ProjectName(raw='numpy', normalized='numpy') distributions.
10: tornado>=6.0.3
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='tornado', normalized='tornado') distributions.
11: watchdog; platform_system != "Darwin"
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='watchdog', normalized='watchdog') distributions.
12: watchdog==2.3.0
But this pex had no ProjectName(raw='watchdog', normalized='watchdog') distributions.
better-sunset-63499
02/27/2023, 4:49 PMaws-cdk-lib
in pexes? After v2.50 it seems to be broken for me. They broke out aws_cdk.asset*
from the main aws_cdk
provided by aws-cdk-lib
and now whenever I try to run the PEX, it's unable to find aws_cdk.asset*
packages.abundant-autumn-67998
02/27/2023, 6:23 PMpex-tools my-pex.pex venv /here
faster?high-yak-85899
02/27/2023, 8:15 PM(3.8.10) ~/devel/monorepo (batching)$ time ./pants test --force ops/unittests/::
....
Wrote test reports to dist/test_results
real 1m16.427s
user 0m0.719s
sys 0m0.073s
Without batching configured
(3.8.10) ~/devel/monorepo (master)$ time ./pants test ops/unittests/::
....
Wrote test reports to dist/test_results
real 7m52.670s
user 0m0.701s
sys 0m0.076s
The docs also made it very clear how best to set up this feature for our needs by using the default flags in our build files.glamorous-accountant-97217
02/27/2023, 9:09 PMinterpreter_constraints = ["CPython>=3.10"]
. i get the error during “Downloading the Pex PEX.” when I run ./pants tailor --check ::
in a github actioncrooked-lawyer-77407
02/27/2023, 9:16 PMexceeded timeout of 60 seconds while waiting for pantsd to start
?silly-queen-7197
02/27/2023, 9:27 PMpex
. We recently integrated pants
into a codebase and pushed some changes to production (we didn't catch these issues in our deployed development environment). In our Dockerfile
we naively ran pants package ::
and then just utilized the pex
files generated without doing anything else.
We have an Argo Workflow
that spins up a bunch of pods (about 10 at launch and then ~ 100 more) and executes commands. We ended up with a lot of these pods stuck in "pod initializing" and a workflow that used to take 15 minutes ended up taking about an hour. Searching through metrics on what changed I found that our use of "ephemeral pod storage" sky rocketed.
I downloaded the Docker images associated with each release and noticed when I ran the pex command and checked via docker container ls -s
I was able to confirm that pex
was using about 500MB of storage rather than 100B (what it was before the change). After following the instructions about [optimizing Docker deploys](https://blog.pantsbuild.org/optimizing-python-docker-deploys-using-pants/) I was able to get disk usage down. After deploying these changes, the workflow is now running smoothly.
To be honest I don't understand the connection between ephemeral pod storage and pods failing to spin up (Argo Workflows was failing to spin up the wait
container even after main
had ran)
I'm glad that blog article exists but looking at pex
documentation I couldn't find anything about PEX_TOOLS
or unpacking into a venv
other than in the recipes area. Am I looking in the wrong place?brave-hair-402
02/27/2023, 9:48 PMsilly-queen-7197
02/28/2023, 2:13 AM./pants :: test --test-use-coverage --print-stacktrace
. After my tests pass I get an error saying invalid syntax. It seems like python3.7 which was used to bootstrap pants doesn't understand my
with (
open(...) as a,
open(...) as b
):
syntax.
I would have expected coverage to use python3.10
as I set
[python]
interpreter_constraints = ["CPython==3.10.*"]
Full Error is
Engine traceback:
in select
in pants.core.goals.test.run_tests
in pants.backend.python.goals.coverage_py.generate_coverage_reports
Traceback (most recent call last):
File "/home/yjabri/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.1_py37/lib/python3.7/site-packages/pants/engine/internals/selectors.py", line 653, in native_engine_generator_send
res = func.send(arg)
File "/home/yjabri/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.1_py37/lib/python3.7/site-packages/pants/backend/python/goals/coverage_py.py", line 572, in generate_coverage_reports
keep_sandboxes=keep_sandboxes,
pants.engine.process.ProcessExecutionFailure: Process 'Generate Pytest report coverage report.' failed with exit code 1.
stdout:
Couldn't parse '/tmp/pants-sandbox-QX6Xdr/foo/tests/bar.py' as Python source: 'invalid syntax' at line 190
stderr:
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
breezy-apple-27122
02/28/2023, 7:19 AMValueError: `[python-bootstrap].search_paths` is configured to use local Python discovery tools, which do not work in DockerEnvironmentTarget runtime environments. To fix this, set the value of `python_bootstrap_search_path` in the `docker_environment` defined at `//:docker` to contain only hardcoded paths or the `<PATH>` special string.
This is good but having this into the examples will avoid back and forth.
Another thing is the plural hint for iterable parameters. Some parameters like environment
and environments
give you a hint if the value is an iterable or a simple string. python_bootstrap_search_path
is singular but its value is an iterable. So it could be python_bootstrap_search_paths
instead.
I will keep posting here any roadblocks I find.quiet-dog-11469
02/28/2023, 8:45 AMbreezy-apple-27122
02/28/2023, 8:48 AMpoetry_requirements(
name="poetry",
module_mapping={
"python-box": ["box"],
"azure-storage-file-datalake": ["azure.storage.filedatalake.DataLakeServiceClient"]
}
)
local_environment(
name="local_linux",
compatible_platforms=["linux_x86_64"],
fallback_environment="docker_linux",
)
docker_environment(
name="docker_linux",
platform="linux_x86_64",
image="python:3.11-slim",
python_bootstrap_search_path=["<PATH>"]
)
src/streamlit/template/BUILD:
python_sources()
pex_binary(
name="bin",
script="streamlit",
dependencies=["./main.py", "//:poetry#watchdog"],
environment="docker_linux"
)
docker_image(name="docker")
src/streamlit/template/Dockerfile:
FROM python:3.11-slim
COPY src.streamlit.template/bin.pex /bin/streamlit
CMD /bin/streamlit
src/streamlit/template/main.py:
import streamlit as st
st.title("My Streamlit App")
st.text("Hello, world!")
st.balloons()
root pants.toml:
[GLOBAL]
pants_version = "2.15.0"
backend_packages = [
"pants.backend.python",
"pants.backend.docker"
]
[anonymous-telemetry]
enabled = false
[python]
tailor_pex_binary_targets = false
interpreter_constraints = ["CPython==3.11.2"]
enable_resolves = true
[python-bootstrap]
search_path = ["<PYENV>"]
[docker]
env_vars = ["DOCKER_CONFIG=%(homedir)s/.docker"]
default_repository = "{parent_directory}/{directory}"
[environments-preview.names]
docker_linux = "//:docker_linux"
local_linux = "//:local_linux"
Shell command: pants run src/streamlit/template:docker
Error Output:
09:41:51.03 [INFO] Completed: Building docker image streamlit/template:latest
Failed to find compatible interpreter on path /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.
Examined the following interpreters:
1.) /usr/local/bin/python3.11 CPython==3.11.2
No interpreter compatible with the requested constraints was found:
Failed to resolve requirements from PEX environment @ /root/.pex/unzipped_pexes/c411c8338ca0b0531952668a33219de7ba52349e.
Needed cp311-cp311-manylinux_2_31_aarch64 compatible dependencies for:
1: MarkupSafe>=2.0
Required by:
Jinja2 3.1.2
But this pex had no ProjectName(raw='MarkupSafe', normalized='markupsafe') distributions.
2: numpy
Required by:
altair 4.2.2
streamlit 1.19.0
But this pex had no ProjectName(raw='numpy', normalized='numpy') distributions.
3: pandas>=0.18
Required by:
altair 4.2.2
But this pex had no ProjectName(raw='pandas', normalized='pandas') distributions.
4: pandas>=0.25
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='pandas', normalized='pandas') distributions.
5: pillow>=6.2.0
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='pillow', normalized='pillow') distributions.
6: pyarrow>=4.0
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='pyarrow', normalized='pyarrow') distributions.
7: charset-normalizer<4,>=2
Required by:
requests 2.28.2
But this pex had no ProjectName(raw='charset-normalizer', normalized='charset-normalizer') distributions.
8: numpy>=1.16.4
Required by:
pydeck 0.8.0
But this pex had no ProjectName(raw='numpy', normalized='numpy') distributions.
9: tornado>=6.0.3
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='tornado', normalized='tornado') distributions.
10: watchdog; platform_system != "Darwin"
Required by:
streamlit 1.19.0
But this pex had no ProjectName(raw='watchdog', normalized='watchdog') distributions.
11: watchdog==2.3.0
But this pex had no ProjectName(raw='watchdog', normalized='watchdog') distributions.
strong-answer-14518
02/28/2023, 9:24 AMextra_type_stubs
in the pants.toml
did the trick, and it’s worth pinning the versions of you extra_types_stubs in the config.
I’m surprised though, as it looks like the stubs specified in the different dependencies universes would never be used by mypy
: how to specify different stubs version for different package versions? For example yesterday, a new version of the pandas-stubs has been released and caused errors to appear (most likely because of the pre-release of pandas==2.0.0rc0
). Let’s image I want to have 2 resolves with different pandas versions for which the stubs are not compatible, how shall I proceed?clever-father-91273
02/28/2023, 10:22 AMdocker_image
in such a way that the build root / context is at the repository's root?
I have the following directory structure:
/
utils
project
sub_dir
Dockerfile
BUILD (with docker_image target)
In the Dockerfiles, I want to be able to COPY utils utils
and COPY project project
and execute code in the container from the root direcotry (e.g. python files might from utils import ...
)
I tried to set dependencies=["project", "utils"]
in docker_image
, but when trying to pants package
I keep getting the error stating that project and utils were not found in Docker build context. What am I doing wrong?breezy-apple-27122
02/28/2023, 2:05 PMhigh-yak-85899
02/28/2023, 8:24 PM./pants run
something indefinitely in a way that doesn't block other pants invocations? I'd like to avoid needing separate package and execution steps if possible.curved-farmer-66180
03/01/2023, 3:22 AMpants export ::
, it hanged. (m1) Is there way to find a problem here?
12:15:05.39 [DEBUG] Completed: pants.backend.python.util_rules.pex.build_pex
12:15:05.39 [DEBUG] Completed: Scheduling: Get interpreter version
12:15:05.39 [DEBUG] Completed: Determine all Python interpreter versions used by Pytest in your project (for `export` goal)
12:15:05.40 [DEBUG] Completed: Scheduling: Building pytest.pex from pytest_default.lock
12:15:05.40 [DEBUG] Completed: pants.backend.python.util_rules.pex.build_pex
12:15:05.40 [DEBUG] Completed: Scheduling: Get interpreter version
12:15:05.52 [DEBUG] Completed: setup_sandbox
When stops
^CTraceback (most recent call last):
File "/Users/szto/.pyenv/versions/3.9.15/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/szto/.pyenv/versions/3.9.15/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/szto/.cache/pants/named_caches/pex_root/unzipped_pexes/404b7939ac9a4cbb33f728a5723c1f4b67d9a803/__main__.py", line 103, in <module>
bootstrap_pex(__entry_point__, execute=__execute__, venv_dir=__venv_dir__)
File "/Users/szto/.cache/pants/named_caches/pex_root/unzipped_pexes/404b7939ac9a4cbb33f728a5723c1f4b67d9a803/.bootstrap/pex/pex_bootstrapper.py", line 599, in bootstrap_pex
pex.PEX(entry_point).execute()
File "/Users/szto/.cache/pants/named_caches/pex_root/unzipped_pexes/404b7939ac9a4cbb33f728a5723c1f4b67d9a803/.bootstrap/pex/pex.py", line 551, in execute
sys.exit(self._wrap_coverage(self._wrap_profiling, self._execute))
File "/Users/szto/.cache/pants/named_caches/pex_root/unzipped_pexes/404b7939ac9a4cbb33f728a5723c1f4b67d9a803/.bootstrap/pex/pex.py", line 458, in _wrap_coverage
return runner(*args)
File "/Users/szto/.cache/pants/named_caches/pex_root/unzipped_pexes/404b7939ac9a4cbb33f728a5723c1f4b67d9a803/.bootstrap/pex/pex.py", line 489, in _wrap_profiling
return runner(*args)
File "/Users/szto/.cache/pants/named_caches/pex_root/unzipped_pexes/404b7939ac9a4cbb33f728a5723c1f4b67d9a803/.bootstrap/pex/pex.py", line 583, in _execute
return self.execute_entry(
File "/Users/szto/.cache/pants/named_caches/pex_root/unzipped_pexes/404b7939ac9a4cbb33f728a5723c1f4b67d9a803/.bootstrap/pex/pex.py", line 775, in execute_entry
return self.execute_module(entry_point.module)
File "/Users/szto/.cache/pants/named_caches/pex_root/unzipped_pexes/404b7939ac9a4cbb33f728a5723c1f4b67d9a803/.bootstrap/pex/pex.py", line 783, in execute_module
runpy.run_module(module_name, run_name="__main__", alter_sys=True)
File "/Users/szto/.pyenv/versions/3.9.15/lib/python3.9/runpy.py", line 225, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/Users/szto/.pyenv/versions/3.9.15/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/Users/szto/.pyenv/versions/3.9.15/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Users/szto/.cache/pants/named_caches/pex_root/installed_wheels/71c50e03e63506d9e56add7cd5a4d6bb9fcc7985f39e7d2e152233fc4d6fd74d/pex-2.1.111-py2.py3-none-any.whl/pex/tools/__main__.py", line 10, in <module>
sys.exit(tools())
File "/Users/szto/.cache/pants/named_caches/pex_root/installed_wheels/71c50e03e63506d9e56add7cd5a4d6bb9fcc7985f39e7d2e152233fc4d6fd74d/pex-2.1.111-py2.py3-none-any.whl/pex/tools/main.py", line 93, in main
result = catch(pex_command.run, pex)
File "/Users/szto/.cache/pants/named_caches/pex_root/installed_wheels/71c50e03e63506d9e56add7cd5a4d6bb9fcc7985f39e7d2e152233fc4d6fd74d/pex-2.1.111-py2.py3-none-any.whl/pex/result.py", line 105, in catch
return func(*args, **kwargs)
File "/Users/szto/.cache/pants/named_caches/pex_root/installed_wheels/71c50e03e63506d9e56add7cd5a4d6bb9fcc7985f39e7d2e152233fc4d6fd74d/pex-2.1.111-py2.py3-none-any.whl/pex/tools/commands/venv.py", line 202, in run
venv.install_pip()
File "/Users/szto/.cache/pants/named_caches/pex_root/installed_wheels/71c50e03e63506d9e56add7cd5a4d6bb9fcc7985f39e7d2e152233fc4d6fd74d/pex-2.1.111-py2.py3-none-any.whl/pex/venv/virtualenv.py", line 352, in install_pip
self._interpreter.execute(args=["-m", "ensurepip", "-U", "--default-pip"])
File "/Users/szto/.cache/pants/named_caches/pex_root/installed_wheels/71c50e03e63506d9e56add7cd5a4d6bb9fcc7985f39e7d2e152233fc4d6fd74d/pex-2.1.111-py2.py3-none-any.whl/pex/interpreter.py", line 1292, in execute
stdout, stderr = Executor.execute(cmd, stdin_payload=stdin_payload, env=env, **kwargs)
File "/Users/szto/.cache/pants/named_caches/pex_root/installed_wheels/71c50e03e63506d9e56add7cd5a4d6bb9fcc7985f39e7d2e152233fc4d6fd74d/pex-2.1.111-py2.py3-none-any.whl/pex/executor.py", line 93, in execute
stdout_raw, stderr_raw = process.communicate(input=stdin_payload)
File "/Users/szto/.pyenv/versions/3.9.15/lib/python3.9/subprocess.py", line 1134, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/Users/szto/.pyenv/versions/3.9.15/lib/python3.9/subprocess.py", line 1979, in _communicate
ready = selector.select(timeout)
File "/Users/szto/.pyenv/versions/3.9.15/lib/python3.9/selectors.py", line 416, in select
fd_event_list = self._selector.poll(timeout)
KeyboardInterrupt
Interrupted by user.
12:21:15.08 [DEBUG] Completed: interactive_process
12:21:15.08 [DEBUG] Async completion is enabled: workunit callbacks will complete in the background.
curved-farmer-66180
03/01/2023, 3:44 AMhigh-yak-85899
03/01/2023, 4:00 AM