curved-manchester-66006
01/06/2023, 12:39 AMcurved-television-6568
01/06/2023, 2:24 AMdazzling-elephant-33766
01/06/2023, 12:32 PMservice/a/test/test_a.py
service/a/test/test_b.py
service/a/test/test_c.py
Will re-use the same DB.
Since pants runs each pytest in a separate process I had to create a unique DB name for each and run any initial migrations xN times. This overhead unfortunately makes the tests slower than they were before, even with parallel execution.
Is thereβs any mechanism to force pytest to run tests in a single process? Passing --debug
still appears to run the DB setup/teardown once per test file. Whereas ideally Iβd like it to run once for the whole suite.busy-vase-39202
01/06/2023, 2:10 PMfaint-dress-64989
01/06/2023, 3:29 PMloud-laptop-89838
01/06/2023, 4:00 PMexport
, then my interpreter should be updated? Just wondering what everyone is using as a workflow.
And what about separating requirements for different areas of the repo? E.g. do you have a top level requirements file, then one in each module? Are you using pyproject.toml
? Again, in each module? Or just one for the whole repo.plain-night-51324
01/06/2023, 9:29 PM./pants --changed-since=HEAD test
but default to changed-sincegreen-match-66337
01/07/2023, 1:53 PMgreen-match-66337
01/07/2023, 1:57 PMgreen-match-66337
01/07/2023, 2:01 PMprehistoric-motorcycle-70707
01/08/2023, 4:50 AMcryptography
library, and as I understand it, AWS Lambdas require a specific binary for that (and probably other) libraries. I was able to resolve that pre-Pants by following the instructions on this Github issue, but Im struggling to figure out how to get that working with the python_awslambda
target in Pants.
Pre-Pants I can run this pip command to fetch the correct binary pip install --platform manylinux2014_x86_64 --implementation cp --python 3.9 --only-binary=:all: --upgrade --target ./ cryptography==38.0.1
. But I dont understand how to translate this information to Pants and Pex. Im doing my best to understand, but pretty much everything Im doing is a stab in the dark π
I assume I need to do something with the complete_platforms
argument in the python_awslambda
target. So I created a file
target to a lambda_platform.json
file, and provided that to the complete_platform
argument. The json looks like this:
{
"marker_environment": {
"platform_release": "manylinux2014_x86_64",
"implementation_name": "cp",
"python_version": "3.9"
},
"compatible_tags": [
"cp39-abi3-manylinux2014_x86_64"
]
}
The package goal prints the correct platform file, however if I look at the cryptography dist info in the generated lambda, the WHEEL
file differs from what is generated when I run the pip command, and it doesnt seem to include the manylinux2014_x86_64
platform. So it doesnt appear to have worked.
Does anyone have any advice or thoughts here? Am I on the right track?
(Side note, changing the lambda_platform.json contents doesnt trigger a new package. I would've thought Pants would re-build if that dependency changed)bored-energy-25252
01/08/2023, 5:00 PMmodern-monkey-78364
01/09/2023, 7:21 AM--no-binary=protobuf
in my requirements.txt file to resolve this issue. But unfortunately, after adding this, I am not able to decode some of my protobuf objects at runtime, and hence I am removing this part. But after removing one of my test case doesnβt run at all. It keeps showing something like:
[INFO] Long running tasks:
Run Pytest for src/backend/unit_test.py:tests
So, looking at some help in debugging this, as the new commit has no other change except removal and --no-binary=protobuf and subsequent change in pytest_lockfile.txt after running ./pants generate-lockfiles --resolve=pytest
.breezy-agent-54573
01/09/2023, 12:08 PMexperimental_shell_command(
name="generate_external_client_sources",
command='echo $PWD; docker run --rm -v ${PWD}/..:/local openapitools/openapi-generator-cli:v6.0.1 generate -i /local/external_brain_swagger.yaml -o /local/ -g python --package-name brain_client.external --additional-properties="generateSourceCodeOnly=True"',
tools=["bash", "docker"],
outputs=["external/"],
dependencies=["Brain:generate_external_swagger"],
)
experimental_shell_command(
name="generate_internal_client_sources",
command='echo $PWD; docker run --rm -v ${PWD}/..:/local openapitools/openapi-generator-cli:v6.0.1 generate -i /local/internal_brain_swagger.yaml -o /local/ -g python --package-name brain_client.internal --additional-properties="generateSourceCodeOnly=True"',
tools=["bash", "docker"],
outputs=["internal/"],
dependencies=["Brain:generate_internal_swagger"],
)
python_sources(
name="brain_client",
dependencies=[
":generate_external_client_sources",
":generate_internal_client_sources",
],
)
icy-umbrella-50644
01/09/2023, 5:12 PMchilly-tailor-75063
01/09/2023, 5:21 PM./pants lint ::
it reports a bunch of E0401: Unable to import
errors for my own custom modules.chilly-tailor-75063
01/09/2023, 5:21 PMprehistoric-wire-35783
01/09/2023, 7:09 PM./pants check
behave equivalently to mypy --install-types --non-interactive
?
Reading through the past chats, I think the answer is no, but I just wanted to double check. I presume the current solution was put in place to create the pex environment. While is not bad, it would be nice if it can support install type stubs on the fly for minimal maintenance...freezing-lamp-12123
01/09/2023, 9:07 PMaloof-appointment-30987
01/10/2023, 1:03 AMgo_binary
?
I've confirmed that if I build using
env GOOS=linux GOARCH=arm go build .
then I create a file
target that references the binary result of the above command and copy that file into a Dockerfile
image and run using ./pants run path/to/project:docker_image
The docker image executes the binary as expected.
If I instead copy the output of go_binary
into the Dockerfile
image, I get the failure exec /app: exec format error
This indicates the go binary is built for the wrong platform.
I've tried
env GOOS=linux GOARCH=arm ./pants run path/to/project:docker
without success.fresh-cat-90827
01/10/2023, 7:01 AMpants.toml
file. Is there any special case where an option that represents a collection won't be supporting the following types π§΅prehistoric-wire-35783
01/10/2023, 11:38 AMException: Snapshot failed: Failed to digest inputs: Throw { val: Failed to watch filesystem for `/some/path`: Error { kind: MaxFilesWatch, paths: ["/some/path"] }, python_traceback: "Traceback (no traceback):\n <pants native internals>\nException: Failed to watch filesystem for `/some/path`: Error { kind: MaxFilesWatch, paths: [\"/some/path\"] }", engine_traceback: ["digest_file"] }
abundant-analyst-12845
01/10/2023, 11:55 AMpoetry.lock
file. should the python.resolves
block point to the existing lock file like common = poetry.lock
or more like common = "3rdparty/python/common.lock"
am hoping to use this global poetry file to manage many "sub-projects" which will host lambdaechoing-farmer-15630
01/10/2023, 2:17 PMpants
, the dependency analyzer got too good π
Silly problem: I'm trying to extract a subset of a library which tried to hide its dependencies by putting imports under if
statements, which I think used to work (but I may be wrong) ie something like:
def hide_imports(library: str):
if library == "numpy":
import numpy as result
elif library == "pandas":
import pandas as result
return result
but pants
cannot be fooled:
β― ./pants dependencies --no-dependencies-transitive src/.../test.py
//:root_requirements#numpy
//:root_requirements#pandas
...
(the situation is more complex with internal dependencies, but you get the idea; what if we wanted to build a library which only included numpy
as a dependency and would be ok if someone called hide_imports("pandas")
?)
Is there any way to build a python_distribution
or pex_binary
with "only obvious" dependencies enclosed or expressly excluding some dependencies? Trying to build a subset of a library for a client without exposing more IP than necessary.refined-addition-53644
01/10/2023, 3:12 PM16:09:38.20 [ERROR] Completed: Run Pytest - tests/test_main.py failed (exit code -11).
abundant-analyst-12845
01/10/2023, 3:12 PMpants tailor ::
only generate BUILD files for directories mentioned within root_pattern block instead of everythingbrash-student-40401
01/10/2023, 3:24 PM./pants publish src/services/app/lambdas/svc1/Dockerfile
is failing with
stderr:
COPY failed: file not found in build context or excluded by .dockerignore: stat src/services/app/lambdas/svc1/requirements.txt: file does not exist
Anything referenced in that directory, which does in fact exist, is failing. What's the proper format for referencing stuff in the Dockerfile?glamorous-nail-59544
01/10/2023, 4:03 PMmakemigrations
I am getting
django.db.migrations.exceptions.NodeNotFoundError: Migration app.0010_auto_20211020_1418 dependencies reference nonexistent parent node ('matching', '0009_auto-20211015')
I have double checked dependencies and everything is configured correctly AFAIK with the right dependencies showing.
The error is showing for a different migration file everytime I run it, so it is not a problem with one specific migration file.happy-kitchen-89482
01/10/2023, 4:23 PM./pants dependencies path/to/manage.py
do you see `matching`'s migrations in there?busy-vase-39202
01/10/2023, 8:05 PM