curved-microphone-39455
01/12/2023, 11:21 PMpsycopg2
that is not installed correctly.
I have Service A
that have Library A
installed with poetry add -e ../../libraries/a
and this lib have the psycopg2-binary
in the pyproject.toml
, if I try to run poetry run python run.py
which is the entrypoint of my Service A
everything run perfectly, but when I do ./pants run src/services/a/run.py
I get everytime... (same when I build a Docker container with ./pants package
the container image is done ok but when I run it same error)
File "/home/cerberus/.cache/pants/named_caches/pex_root/venvs/s/71f9e365/venv/lib/python3.10/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 811, in dbapi
import psycopg2
ModuleNotFoundError: No module named 'psycopg2'
in my BUILD
file in Library A
I have tested every possible combination of module_mapping
and overrides
to try to make it works.fancy-daybreak-62348
01/13/2023, 12:19 AMdocker login
, but for some reason pants is not inheriting the auth context. I have [docker].env_vars
set to DOCKER_CONFIG=%(homedir)s/.docker
but for some reason its not getting itbored-energy-25252
01/13/2023, 5:13 AMdeploy_jar
https://github.com/pantsbuild/pants/issues/17790 , I failed to exclude Apache Spark.
Am I doing something wrong or it is not supported in Pants?What is the deploy_jar
equiv of sbt package
and sbt assembly
?abundant-analyst-12845
01/13/2023, 10:50 AMpyproject.toml
[tool.poetry.scripts]
[tool.black]
line-length = 120
[tool.isort]
profile = "black"
multi_line_output = 3 # Vertical Hanging Indent
line_length = 120
from_first = true
and a tox.ini
file containing something like this
[tox]
envlist = lint, pytest-ci, mypy, vulture
skipdist = true
[testenv:lint]
basepython = python3.9
allowlist_externals=*
list_dependencies_command=echo
commands =
flake8 lambdas
pylint lambdas --rcfile=.pylintrc
will pants pick up these configuration or there something I can do so it respects any of these configurationsglamorous-nail-59544
01/13/2023, 12:18 PMworkers = 1
threads = 8
timeout = 0
abundant-analyst-12845
01/13/2023, 2:02 PMconfetest.py
files. As am adopting pants from a monlith repo to a mon-repo. I wondered anyone either
• copying the conftest.file into each root_pattern where its required
◦ this would cause heavy duplication, which might be ok if the conftest file stays consistent
• having a shared folder that is also known by pants containing a conftest file and using symlink for the other packages to point to it.
• does pants have some magic that makes that easier
◦ with the potential option of overriding or enhancing package specific conftets.
sorry if this is open endedprehistoric-afternoon-67621
01/13/2023, 3:49 PMgifted-agency-25998
01/13/2023, 5:26 PMpants
into our CI/CD (GitHub Actions) and I would like to use changed-since=origin/main
for example, but within a module within the repo - e.g. products/productA
but it doesn't let me 😞
Error: 5.99 [ERROR] You used `--changed-since` at the same time as using target arguments. Please use only one.
My intention was to set up separate workflows for each of the products. I see the value in doing it without limiting it, but the problem I currently have is that the IaC deployments need to go to different accounts for each product and it's currently configured at the github workflow level.
Do I have an option other than to use approach #2 from the pants documentation of removing the --changed-since
related flags?
Medium term, I plan on integrating the iac credentials into the build system rather than relying on the CI/CD pipeline which seems to be the superior solution.chilly-holiday-77415
01/13/2023, 6:21 PM./pants package ::
in an AWS codebuild container. Following that thread, I’ve managed to use complete_platforms to build and test inside a local dev container, and added pex3 interpreter inspect --markers --tags
for both the codebuild container (where it builds in CI) and for my dev container (for local dev).
I still get the same error in Lambda though - am I doing something wrong, or do I need to build for the lambda’s runtime container too in complete_platforms?
flat-zoo-31952
01/13/2023, 7:03 PM// This lockfile was autogenerated by Pants. To regenerate, run:
//
// /home/jreed/devel/aiven/aiven-core/pants generate-lockfiles --resolve=pylint
I'd rather it just say ./pants
tbh. Is that possible?straight-action-80318
01/14/2023, 7:59 PM./pants check path/to/dir
just gives me error: Cannot find implementation or library stub for module named
errors for all my imports. Running the actual ./pants run
seems to work just fine.
Do I need to setup mypy somehow to correctly understand the structure of my pants workspace? For example explicitly putting the root or something in the options?rich-kite-32423
01/14/2023, 9:20 PMbroad-processor-92400
01/16/2023, 5:37 AM./pants run ...
and [subprocess-environment]
interact in inconsistent ways, is this intentional/expected? https://gist.github.com/huonw/3e6ebe4c9a4037a31655fce34eea357d
1. ./pants run ./main.py
(running a python source directly) sets the env vars from [subprocess-environment]
2. ./pants run //:pex
(running a pex_binary
) does not set the env varsthousands-france-27863
01/16/2023, 11:20 AMmelodic-carpenter-39613
01/16/2023, 2:04 PM./pants package ...
which either ends in one of two scenarios:
1. Running with ./pants package
results in a nasty traceback stating that the pantsd process was killed during the run
Traceback (most recent call last):
File "/home/liam/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/bin/pants", line 8, in <module>
sys.exit(main())
File "/home/liam/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 112, in main
PantsLoader.main()
File "/home/liam/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 108, in main
cls.run_default_entrypoint()
File "/home/liam/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/pants_loader.py", line 90, in run_default_entrypoint
exit_code = runner.run(start_time)
File "/home/liam/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/pants_runner.py", line 89, in run
return remote_runner.run(start_time)
File "/home/liam/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/remote_pants_runner.py", line 117, in run
return self._connect_and_execute(pantsd_handle, start_time)
File "/home/liam/.cache/pants/setup/bootstrap-Linux-x86_64/2.14.0_py39/lib/python3.9/site-packages/pants/bin/remote_pants_runner.py", line 151, in _connect_and_execute
return PyNailgunClient(port, executor).execute(command, args, modified_env)
native_engine.PantsdClientException: The pantsd process was killed during the run.
If this was not intentionally done by you, Pants may have been killed by the operating system due to memory overconsumption (i.e. OOM-killed). You can set the global option `--pantsd-max-memory-usage` to reduce Pantsd's memory consumption by retaining less in its in-memory cache (run `./pants help-advanced global`). You can also disable pantsd with the global option `--no-pantsd` to avoid persisting memory across Pants runs, although you will miss out on additional caching.
If neither of those help, please consider filing a GitHub issue or reaching out on Slack so that we can investigate the possible memory overconsumption (<https://www.pantsbuild.org/docs/getting-help>).
Re-running with ./pants --pantsd-max-memory-usage=8GiB package ...
had no affect on the outcome however and running with /usr/bin/time -v
prefixing the aforementioned command gives an output which suggests a maximum of ~48MB was used (free -h
suggests there is 10Gi
memory available on my WSL Ubuntu system).
2. Running with ./pants --no-pantsd package ...
(as suggested by the error message from point 1) results in different message:
/github/home/.cargo/git/checkouts/lmdb-rs-369bfd26153a2575/6ae7a55/lmdb-sys/lmdb/libraries/liblmdb/m:2432: Assertion 'mp->mp_pgno != pgno' failed in mdb_page_touch()
Aborted
Does anyone have experience with the above type of problem? How would I go about debugging the root cause behind the issue?
Any help would be most appreciated 🙏 😃curved-microphone-39455
01/16/2023, 3:55 PMgunicorn gevent psycogreen
as requirements from poetry only when building my Docker Image. Currently I have added them in another poetry group which appear to include the dependencies when building the Docker image but I can't make it work with the pex_binary
target, tested to specify the entry_point
or the script
in pex_binary
but I keep getting error message.
Currently my build look like this
python_sources()
poetry_requirements(
name="poetry"
)
pex_binary(
name = "binary",
entry_point = "run.py",
layout = "packed",
execution_mode = "venv",
)
docker_image(
name = "img",
registries = ["<http://docker.io|docker.io>"],
repository = "repo/service",
image_tags = ["{build_args.RELEASE_VERSION}"]
)
My Dockerfile looks like this
FROM python:3.10-slim
ARG RELEASE_VERSION=latest
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python3-dev \
libpq-dev \
&& apt-get clean autoclean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb \
COPY src.services.service/binary.pex /bin/app
ENV CONSUL [h=consul-svc,t=None]
EXPOSE 5001
CMD ["python", "/bin/app"]
This is working for development purpose, but we need gunicorn
in production
I was reading this https://pex.readthedocs.io/en/v2.1.43/recipes.html#gunicorn-and-pex but I don't see how I can reproduce this through Pants!
Thanks 🙂aloof-appointment-30987
01/16/2023, 4:50 PMconfluent-kafka-go
I'm having trouble building a go module that requires <http://github.com/confluentinc/confluent-kafka-go|github.com/confluentinc/confluent-kafka-go>
I'm using pants_version = "2.15.0rc1"
I have a single go.mod
file defined at the repos root.
When I attempt to run the go app
./pants run apps/go/greeter_en:greeter_en
I get the following error:
Engine traceback:
in `run` goal
in Package Go binary - apps/go/greeter_en:greeter_en
in Compile with Go - apps/go/greeter_en:go-package
in Compile with Go - <http://optios.com/pantsbuild/example-golang/libraries/go/greeter|optios.com/pantsbuild/example-golang/libraries/go/greeter>
in Compile with Go - <http://github.com/confluentinc/confluent-kafka-go/kafka|github.com/confluentinc/confluent-kafka-go/kafka>
ProcessExecutionFailure: Process 'Generate Go and C files from CGo files.' failed with exit code 1.
stdout:
stderr:
In file included from /private/var/folders/_d/zt8y2x055597l63bhdztp82c0000gn/T/pants-sandbox-Pjctus/gopath/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.2/kafka/00version.go:24:
gopath/pkg/mod/github.com/confluentinc/confluent-kafka-go@v1.9.2/kafka/select_rdkafka.h:26:10: fatal error: 'librdkafka_vendor/rdkafka.h' file not found
#include "librdkafka_vendor/rdkafka.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I can build and run the app using go tools.
from the repos root:
go mod tidy
cd apps/go/greeter_en
go build .
./greeter_en
The attached project demonstrates the above behavior.flaky-artist-57016
01/16/2023, 7:14 PMconda
environment. This means we have to add python_requirement
entries for all third-party dependencies used by goals like test
and package
to our root BUILD
file or python_infer
throws UnownedDependencyError
. I’d like to run ./pants dependencies
on our tests to check that Pants can infer all the third-party dependencies successfully. What is the best way to do this?steep-match-53634
01/16/2023, 11:15 PMsteep-match-53634
01/16/2023, 11:15 PMmysqlclient
that requires building a C library, but as Pants kinda pushes you to use pex, I'm ending up with building it not on the system that will actually run the app, and of course I'm getting a 'missing .so' error at run time. How do you solve this problem in a Pants setup? Maybe there's a way to add a dependency on top of existing pex? Or how do I prebulid a proper variant of mysqlclient
and make sure Pants includes it specifically (or platform dependent)? I tried building a pex_binary
with complete_platforms
that include my system's and container system's output of pex3 interpreter inspect --markers --tags
, but it fails with 'No matching distribution' for both.steep-match-53634
01/16/2023, 11:16 PMsteep-match-53634
01/16/2023, 11:16 PM$PEX_ROOT/unzipped_pexes/<some hash>
, and I can technically search the archive for the exact name, but it will be easier to just have it as a constant.cool-yacht-37128
01/17/2023, 3:34 AMpants run some.py
which has no relationship with any go code results in a lengthy Go module download. Am I doing something obviously wrong, or is this the expected behaviour?gifted-cricket-25440
01/17/2023, 7:58 AM./pants generate-lockfiles
And it generates a lot of errors, like
org.typelevel:cats-effect_2.13:2.0.0 or 2.1.4 or 2.3.0-M1 or 2.3.1 or 2.5.0 or 2.5.1 or 2.5.4 or 2.5.5 or 3.3.14 wanted by
co.fs2:fs2-core_2.13:2.5.6 wants 2.3.0-M1
├─ co.fs2:fs2-io_2.13:3.3.0 wants co.fs2:fs2-core_2.13:3.3.0
│ └─ org.http4s:http4s-core_2.13:0.23.16
│ ├─ org.http4s:http4s-ember-core_2.13:0.23.16
│ │ └─ org.http4s:http4s-ember-server_2.13:0.23.16
│ └─ org.http4s:http4s-server_2.13:0.23.16
│ └─ org.http4s:http4s-ember-server_2.13:0.23.16
Scala compiler is ok, as it different projects. Issues only with pants. Maybe I missed something in docs, but Are there any variants to use different versions of one dependency in one repo?adventurous-journalist-72920
01/17/2023, 9:46 AMbreaking
command (more info here -> https://docs.buf.build/breaking/overview) within Buf backend, should I:
1. add a second command in lint goal (https://github.com/pantsbuild/pants/tree/main/src/python/pants/backend/codegen/protobuf/lint/buf)? or
2. add it to check goal? or
3. it should be a separate plugin?
So far I don’t know how I could achieve solution 1 since there’s already a command buf lint behind the lint goal. Solution 2 seems more convenient and makes sense as it deals with type compatibility (see usage here https://docs.buf.build/breaking/usage).
Any opinion? Thanks!breezy-computer-30480
01/17/2023, 11:43 AM--debug
flag to run the pyspark tests in sequence.
Is it possible to control the number of tests that can run in parallel ?gifted-cricket-25440
01/17/2023, 12:02 PM[jvm.resolves]
non-default-resolve = "3rdparty/jvm/defaultV2.lock"
?
Thank you in advance!glamorous-cpu-22971
01/17/2023, 3:59 PMpytest
in the dependencies
parameter of a python_tests
target?
python_tests(
dependencies = [
"tests/my/special/test:lib",
"3rdparty/python:pytest", # <-- I have test sources that `import pytest` so I think the type checker wants to see an explicit dependency stated here…
],
)
polite-garden-50641
01/17/2023, 4:05 PM./pants dependencies <path to python test file>
polite-garden-50641
01/17/2023, 4:06 PM