breezy-bear-13848
05/14/2023, 2:24 PMcrooked-breakfast-19365
05/15/2023, 11:38 AMfuture-oxygen-10553
05/15/2023, 2:00 PMdocker build
command generated by a docker image
target? For some reasons I’m installing dependencies into my image with pip
. I’d like to be able to cache those layers in the GitHub Actions cache, but to do that I need to set the --cache-to
and --cache-from
options on the CLI. See: https://docs.docker.com/build/cache/backends/local/ Is that possible in the BUILD
or pants.toml
file? I didn’t see an option that looked like a generic args
thing, although I do see the appropriate mixin classes in backend/docker/target_types.py
gentle-tailor-79858
05/15/2023, 2:45 PMincremental adoption
method to get pants into one of our internal repositories. @hundreds-father-404 was kind enough to get me started with an example plugin. I'm moving my questions here though to not bog them down too much. The example plugin exists in its own repo, and I have a seperate target repo I'd like to start integrating pants into, I'm thinking I start a new branch in the target repo and add the pants.toml, but I've got a couple questions
1. When I set up my pants.toml and spell out the new plugin, is pants "system aware" of my plugin? Do I need to add the plugin to a "pants environment" or something to that effect?
2. When I run pants the first time in a repo it initializes some things in the project right? Is there anything that gets generated I need to commit.
I'm thinking I should just try this but I'm so new to pants I don't want to break anything about the "pants install". I assume that's not a problem really but better safe to ask first 🙂cold-soccer-63228
05/15/2023, 3:42 PM./pants fix
run formatters that would’ve been invoked via ./pants fmt
?
Another way to ask the question: if I first run ./pants fix
, will running ./pants fmt
afterwards be a no-op?curved-microphone-39455
05/15/2023, 3:42 PMpants.toml
looks like this
[GLOBAL]
pants_version = "2.15.0"
backend_packages = [
"pants.backend.docker",
"pants.backend.python",
"pants.backend.python.lint.flake8",
]
remote_cache_read = true
remote_cache_write = true
remote_store_address = "<grpcs://remote.buildbuddy.io>"
remote_store_headers = "{'x-buildbuddy-api-key': '<token>'}"
remote_instance_name = "main"
remote_store_chunk_upload_timeout_seconds = 3600
When I add the keys for the remote_execution
I see errors and stuff that actually trying to do something with the remote host, but for caching only, nothing is happening (even if I put a random remote_store_address
)billions-printer-97253
05/15/2023, 4:29 PMpants run :cli
it will rebuild all the package each time I just change the source code.swift-river-73520
05/15/2023, 8:50 PMconftest.py
in the same way pytest does, even if a test target doesn't refer to any fixtures in conftest.py
? I am transitioning a repo to use pants, and when I run a target that doesn't use any fixtures it still seems to want to include the conftest file and all its dependencies. Is the only way around this to put the test in a folder that doesn't have conftest.py in one of its parent folders?
for example the tests are structured like this:
tests/
tests/confest.py
tests/foo/bar/test_file.py #doesn't refer to any fixtures in tests/conftest.pypurple-plastic-57801
05/15/2023, 8:50 PMrun_shell_command
with a shell script? I can't seem to get it to load a .sh file next to the BUILD filebrainy-solstice-27042
05/15/2023, 9:32 PMpurple-plastic-57801
05/16/2023, 12:07 AMpurple-plastic-57801
05/16/2023, 12:38 AMsystem_binary(
name="git",
binary_name="git",
)
Leads to
pants run .build:build-libcamera
17:37:36.50 [INFO] Completed: Testing candidate for `git` at `/bin/git`
17:37:36.50 [INFO] Completed: Testing candidate for `git` at `/usr/bin/git`
17:37:36.51 [ERROR] 1 Exception encountered:
Engine traceback:
in `run` goal
ValueError: Could not find a binary with name `git`. The following paths were searched: /usr/bin, /bin, /usr/local/bin, /opt/homebrew/bin.
But..
which git
/usr/bin/git
purple-plastic-57801
05/16/2023, 1:01 AMrun_shell_command
.. it is to build a c library with ninja and link it with ldconfig.
If I have
system_binary(
name="git",
binary_name="git",
fingerprint_args=["version"],
)
adhoc_tool(
name = "meson",
runnable=".build/requirements:reqs-libcamera#meson",
)
run_shell_command(
name="libcamera",
command="./libcamera.sh",
runnable_dependencies=[".build/requirements:reqs-libcamera#meson", ":git"]
)
shell_sources(name="shell-scripts")
Where libcamera.sh is
#!/usr/bin/env bash
rm -rf .lc_build_temp
mkdir -p .lc_build_temp
cd .lc_build_temp \
&& git clone <https://github.com/bloop/libcamera.git> \
&& cd libcamera \
&& git checkout v0.0.4 \
&& meson setup build \
&& ninja -C build
cd .lc_build_temp/libcamera && sudo ninja -C build install
sudo ldconfig || echo "Finished ldconfig"
rm -rf .lc_build_temp
It totally works up until it needs a sudo password 🤔 Anyway to have it ask me?clever-father-91273
05/16/2023, 10:22 AMbitter-orange-16997
05/16/2023, 1:43 PMaverage-breakfast-91545
05/16/2023, 3:02 PMdocker_environment(
name="aws_lambda_python39",
platform="linux_x86_64",
image="public.ecr.aws/lambda/python:3.9",
)
pex_binary(
name="flagger",
layout="zipapp",
inherit_path="fallback",
dependencies=["src/dz/anomaly_flagger/handler.py"],
environment="aws_lambda_python39",
)
pants package is failing with
Failed to create Docker execution in container: RequestTimeoutError
I am able to to docker run --platform=linux/x86_64 public.ecr.aws/lambda/python:3.9
on the machine, and I've got no clue what request is timing out, nor why. Any idea how to proceed?purple-plastic-57801
05/16/2023, 3:13 PMrun_shell_command
"foo". Is there anyway I can say that foo must run before bar? Or do I need to use shell_command with outputs?high-yak-85899
05/16/2023, 5:20 PM./pants help <my macro>
curved-television-6568
05/16/2023, 6:26 PMlemon-noon-33245
05/16/2023, 8:09 PMadhoc_tool
target? I’m using pnpm
as a system_binary
and I need to pass an argument to the build script. Since I can only do that by using environment variables, I was hoping to be able to add it somehow to system_binary
or adhoc_tool
.faint-businessperson-86903
05/16/2023, 10:06 PMpurple-plastic-57801
05/17/2023, 1:36 AMnpm test
I have npm run build| and npm start working 😃clever-father-91273
05/17/2023, 8:47 AMpants.base.exceptions.BackendConfigurationError: Failed to load the pants.core.register backend: ImportError("urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with LibreSSL 2.8.3. See: <https://github.com/urllib3/urllib3/issues/2168>")
Seems to be related to breaking changes in urllib3==2.x
, but downgrading it to 1.x
doesn't help. The error appears when I try to run any pants
command using a binary created before this urrlib update. How do I fix it? Thanks!clever-father-91273
05/17/2023, 11:19 AMpants package
, I'm getting the following error:
#3 [internal] load metadata for <http://docker.io/tensorflow/tensorflow:2.9.1-gpu|docker.io/tensorflow/tensorflow:2.9.1-gpu>
#3 sha256:8d3bd1ccb65ab89bd2786298e6e6e88a2a5e6f1a26f13dec1757448577beca32
Failed to fire hook: while creating logrus local file hook: user: Current requires cgo or $USER, $HOME set in environment
[2023-05-17T11:16:32.965266000Z][docker-credential-desktop][F] get system info: exec: "sw_vers": executable file not found in $PATH
[goroutine 1 [running, locked to thread]:
[common/pkg/system.init.0()
[ common/pkg/system/os_info.go:32 +0x1bc
#3 ERROR: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: ``
[internal] load metadata for <http://docker.io/tensorflow/tensorflow:2.9.1-gpu|docker.io/tensorflow/tensorflow:2.9.1-gpu>:
failed to solve with frontend dockerfile.v0: failed to create LLB definition: rpc error: code = Unknown desc = error getting credentials - err: exit status 1, out: ``
This happens for every docker image I'm trying to build, the tensorflow above is just an example. The corresponding docker build
command to build the same works fine.
How do I fix it? Thanks!future-oxygen-10553
05/17/2023, 5:37 PMmatrix
on GitHub Actions. However, the keys for the lmdb store are based on the git sha which means they conflict and my caches aren’t merged properly. Is there any way to merge these appropriately or do I just need to convince my company to buy a remote caching service? 😄ripe-gigabyte-88964
05/17/2023, 6:48 PMincalculable-intern-62551
05/18/2023, 8:48 AMFastAPI
application packed into a pex executable. It uses SQLAlchemy
+ Alembic
. In my native dev environment, I'd use alembic to make migration files and apply the migration before starting the app. But since the pex only has one entrypoint which is the main function of the fastapi app, I'm not so sure how to ensure migrations are applied before the app starts up in production.. any ideas?incalculable-intern-62551
05/18/2023, 9:39 AMhallowed-dream-58085
05/18/2023, 1:51 PMpants
after get-pants.sh
) the pants
command returns the code 1 and docker will crash due to the non 0 return. However, it seems that the command run successfully. I do get however the No goals specified.
which could be the code 1?
Is this expected? If yes, why does it return that code?
Did others managed to install pants and initialize it successfully inside docker?curved-microphone-39455
05/18/2023, 3:20 PMpants -ldebug package ...
I get the [DEBUG] spawned local process as Some(2605) for Process { argv: ["/usr/bin/docker", "build" ...
message and then ⠓ 79.65s Building docker image
during the build Process, is there a way to expose the logs to see the steps and the layers of the build to see what is taking time and how I can optimize it ? Thanks in advance.