bored-art-40741
03/21/2021, 9:15 PMbored-art-40741
03/21/2021, 9:16 PMbored-art-40741
03/21/2021, 9:18 PMmaster
-> main
migration? On https://github.com/pantsbuild/pants, "Go to file" gives me a 404, which makes sense since it's redirecting to https://github.com/pantsbuild/pants/find/masterbored-art-40741
03/21/2021, 9:32 PMlemon-computer-36981
03/22/2021, 10:52 AMpantsbuild
in mind).
I found a couple example repos, e.g.
https://github.com/pantsbuild/example-python
https://github.com/pmatev/demo-python-monorepo
But I have a couple other questions, that I'll ask here. If someone can advise that'd be awesome š
Is it ok to have inter-project source code dependencies, or is it better to extract all shared source code to some /lib/
projects?
Is it better to keep projects in /root/projects/
or just lay them all out in /root/
?
How well does PyCharm work with a monorepo project structure? Is it simple enough to resolve import paths, virtualenvs per project etc.curved-television-6568
03/22/2021, 1:45 PM$ ./pants dependencies src/xx/core/data:tests
src/xx/core/data/factory_test.py:tests
src/xx/core/data/manifest.py
src/xx/core/data/manifest_test.py:tests
src/xx/core/data/metadata.py
src/xx/core/data/spec.py
src/xx:deal
expected a few more there, as Iāve added import
statements in the factory_test.py file.. and, right enough, after killing pantsd
and running again, they show up:
$ ./pants dependencies src/xx/core/data:tests
14:45:07.09 [INFO] initializing scheduler...
14:45:07.69 [INFO] scheduler initialized.
src/xx/core/data/factory_test.py:tests
src/xx/core/data/manifest.py
src/xx/core/data/manifest_test.py:tests
src/xx/core/data/metadata.py
src/xx/core/data/spec.py
src/xx:deal
src/xx:hypothesis-jsonschema
src/xx:marshmallow-jsonschema
This is on pants:
$ ./pants --version
2.4.0.dev3
fancy-motherboard-46804
03/22/2021, 4:49 PMpants
. However, Iām tearing my hair out (or would be, if I had any) over a mystery problem in which pants
just refuses to find a file during tests that tox has no trouble finding.
I have a structure that looks like:
services/svcA/X.py
services/svcA/Y.py
services/svcA/Z.py
services/svcA/tests/test_X.py
services/svcA/tests/test_Y.py
services/svcA/tests/test_Z.py
Inside all three test files, they import the corresponding file, i.e. inside test_X.py
there is a statement import X
, inside test_Y.py
we have import Y
, and the same for Z.
However, when I run the tests:
./pants test services/svc::
2 out of the 3 sets of tests (X
and Y
) pass, while the third fails with an import error, `No module named Z
. However, tox
passes all three tests and find Z
just fine.clean-night-52582
03/22/2021, 5:20 PMError storing versioned key \"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20\": MDB_MAP_FULL: Environment mapsize limit reached
when running a full build in pants. Is there a way to increase the size of this map? The node I have this running in has 48Gi
in memory which should be enough.happy-kitchen-89482
03/22/2021, 7:16 PMuser
03/22/2021, 7:17 PMrapid-bird-79300
03/23/2021, 12:23 AM2 minutes and 5 seconds
)
⢠container without cache (>12 minutes
)
⢠host with cache (1 minute and 11 seconds
)
⢠container with cache (2 minute and 17 seconds
)
⦠mounted via -v $HOME/.cache/pants:/build/.cache/pants
It feels like it's related to IO performance of the container but not 100% sure. Any ideas why running fresh in a container with no cache takes so long? Or do others have experience they can share when running pants with docker?hundreds-father-404
03/23/2021, 7:21 AMwitty-crayon-22786
03/23/2021, 4:05 PMbusy-vase-39202
03/23/2021, 4:47 PMfierce-plastic-71129
03/23/2021, 7:17 PM--changed-parent
and --changed-include-dependees
). Is there a way to compute precisely the targets that have been impacted by a change?happy-kitchen-89482
03/24/2021, 4:22 AMhappy-kitchen-89482
03/24/2021, 4:22 AMhappy-kitchen-89482
03/24/2021, 4:22 AMuser
03/24/2021, 4:23 AMechoing-farmer-15630
03/24/2021, 5:14 PMmytarget@ <git+ssh://git>@github.com:/myorg/myrepo.git@myhash
line in a requirements.txt
file, but doing ./pants test ...
results in a
ERROR: Command errored out with exit status 128: git clone -q 'ssh://****@github.com:/myorg/myrepo.git' /tmp/process-executionkhgvsl/.tmp/pip-download-1qlw9fjv/mytarget Check the logs for full command output.
...but copying/pasting the git clone
command works just fine in the same shell (with ssh-agent); it's just not being passed to pants. Indeed the log report is
Complete output (5 lines):
<mailto:git@github.com|git@github.com>: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
----------------------------------------
...so that seems to be the problem, but I'm flummoxed. I apologize if this is an obvious question; I looked under "Installing from version control or local files" to get the basic format, but searching for "private repository", "ssh", "publickey" etc didn't help on the docs site.
What am I missing?busy-garden-86305
03/24/2021, 5:24 PM./pants typecheck ::
. The error is ProcessExecutionFailure: Process 'Building requirements.pex with 24 requirements
because it is trying to install two conflicting versions of a third party package. One version is defined in the 3rdparty directory, the other is defined in an individual library's BUILD file. The typecheck goal works fine when addressing individual targets and other goals (like test) work fine when addressing all targets (./pants test ::
).
For a bit more of a concrete example, project_a
uses third_party_lib==0.5.0
while project_b
, project_c
, and project_d
use third_party_lib==1.0.0
. project_a/BUILD
contains a python_requirement_library
called old_third_party_lib
and its python_library
depends on that target. If I run ./pants typecheck ::
it seems to try to build a single requirements.pex
containing all of the requirements for all of the targets which is where the third_party_lib
conflict happens.
For now I can probably just run typecheck on each target individually (or split based on dependees or whatever) but I'd like to be able to sell the ease of ./pants typecheck ::
to my teammates when I present this to them. Any ideas?happy-wall-50469
03/24/2021, 5:43 PMCompiling with an SDK that doesn't seem to exist: /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
Please check your Xcode installation
these are the available SDKs on the user machinne
$ ls -lrt /Library/Developer/CommandLineTools/SDKsĀ
total 0
drwxr-xr-x 8 root wheel 256 Jul 9 2020 MacOSX10.15.sdk
drwxr-xr-x 7 root wheel 224 Nov 30 07:33 MacOSX11.1.sdk
lrwxr-xr-x 1 root wheel 14 Dec 23 09:54 MacOSX.sdk -> MacOSX11.1.sdk
Seems like some caching issue somewhere, any leads?
pants -v 1.11.0
fancy-stone-87037
03/24/2021, 8:07 PMechoing-farmer-15630
03/24/2021, 8:33 PM.pants test
a directory full of, well, tests. The BUILD
has sources=["***/**.py"
and includes all the test files. Except that there are a couple of files in there without actual tests; they're imported by the test files.
Running the test target works, but those files print === no tests ran in 0.01s ===
and are listed by pants as "failed", ie
⯠./pants test --force some/file/without/tests.py
/home/vputz/.cache/pants/setup/bootstrap-Linux-x86_64/2.4.0.dev2+gitd46197d0_py38
15:29:46.22 [INFO] initializing scheduler...
15:29:46.55 [INFO] scheduler initialized.
š some/file/without/tests.py:../../tests failed.
within an appropriate venv,
⯠pytest some/file/without/tests.py
======================================================== test session starts =========================================================
platform linux -- Python 3.9.0+, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /root/dir/wotever
plugins: some-plugins
collected 0 items
======================================================= no tests ran in 0.01s ========================================================
How can I avoid a "failed" with a "no tests ran" result--or skip the test running on files without tests (while still including them for dependencies)? If I .pants test the_actual_test_target
it runs all the tests but lists the files without tests as "failed" (and thus the test target fails). If I pytest
the directory representing the test target it doesn't even pick out the files without tests.happy-kitchen-89482
03/25/2021, 3:26 PMmany-agent-62725
03/25/2021, 6:28 PMpants.toml
file:
[python-setup]
interpreter_constraints = ["CPython>=3.8"]
requirement_constraints = "3rdparty/constraints.txt"
We also have the constraints file.
In the CI pipeline, we are executing the following commands:
./pants --version
./pants --changed-since=origin/master lint
./pants --changed-since=origin/master --changed-dependees=transitive test
However, when ./pants --version
is executed, the lock file is not considered. Instead, the lock file is just used when ./pants test
is being executed, according to the logs:
./pants --changed-since=origin/master --changed-dependees=transitive test
[INFO] Starting: Resolving 3rdparty/constraints.txt
[INFO] Starting: Building pytest.pex with 3 requirements: pytest-cov>=2.10.1,<2.11, pytest>=6.0.1,<6.1, zipp==2.1.0
[INFO] Completed: Building pytest.pex with 3 requirements: pytest-cov>=2.10.1,<2.11, pytest>=6.0.1,<6.1, zipp==2.1.0
[INFO] Long running tasks:
Resolving 3rdparty/constraints.txt
[INFO] Long running tasks:
Resolving 3rdparty/constraints.txt
[INFO] Completed: Resolving 3rdparty/constraints.txt
This behaviour can be observed with the following dependency:
constraints.txt
cryptography==3.4.4
./pants --version
Collecting cryptography>=1.3.4
Downloading cryptography-3.4.7.tar.gz (546 kB)
Is this the expected behaviour? Because I was expecting the lock file to pin a specific version, so that we can have reproducible builds.witty-crayon-22786
03/25/2021, 8:18 PMuser
03/25/2021, 10:36 PMwitty-crayon-22786
03/26/2021, 12:20 AMcurved-television-6568
03/26/2021, 2:57 PM