happy-kitchen-89482
01/02/2023, 6:47 PMhappy-kitchen-89482
01/02/2023, 6:48 PM./pants run path/to:target_name
for a pex_binary target, it will rebuild the pex every time and run ithappy-kitchen-89482
01/02/2023, 6:48 PM./pants run path/to/manage.py
it will be much much fasterhappy-kitchen-89482
01/02/2023, 6:48 PM--loop
?many-engine-6796
01/02/2023, 7:03 PMrestartable
concept, but it seems that I misconfigure something or itβs not that powerful as I thought it is, because it restarts the app on every change in the repo not inputs only. Details in the thread π§΅.green-match-66337
01/02/2023, 11:05 PMred-pilot-83886
01/03/2023, 1:27 AMabundant-leather-17386
01/03/2023, 3:16 PMcurved-manchester-66006
01/03/2023, 5:34 PMtest
directory (I think this is pretty typical!) and there is also a utility file located in the test directory that is a dependence of the tests and not a test itself (this seems debatable as a practice, but I think should work?). I'm seeing different behavior with sys.path
when the utility class is in a parent vs-grandparent directory of the tests.
$ tree test/
test/
βββ BUILD
βββ __init__.py
βββ test_util.py <--- utility class, not actually a test
βββ unit
βββ BUILD
βββ __init__.py
βββ scripts
β βββ BUILD
β βββ test_some_more_stuff.py <-- this target can *not* import test.test_util
βββ test_some_stuff.py <-- this target can import test.test_util
π§΅busy-vase-39202
01/03/2023, 6:17 PMbusy-vase-39202
01/03/2023, 6:24 PMwitty-byte-13646
01/03/2023, 7:15 PMplain-night-51324
01/04/2023, 4:06 AM./pants tailor ::
in my python repo and got many BUILD files (pants v2.14), but they all contain a single line python_sources()
with nothing else in it.
I am comparing to the official python repo which has slightly more stuff in it. So is that single line all I need in almost all cases? It seems that name field has a default and if I donβt have it specified.curved-manchester-66006
01/04/2023, 4:59 AMfoo
, or python3.10 and resolver bar
. (Said resolvers already have [python.resolves_to_interpreter_constraints]
)I then have a set of tests I want to parameterize to verify both cases actually work. In other words I want to run with (resolve=foo, interpreter_constraints=python3.7) and (resolve=bar, interpreter_constraints=python3.10) but not (foo && python3.10) or (bar && python3.7). I tired to do something like:
__defaults__(all=dict(
resolve=parametrize("foo", "bar"),
interpreter_constraints=parametrize(py3_7=["CPython>=3.7.1,<3.8"], py3_10=["CPython==3.10.*"])
But that generates the full matrix and pants yells with a InvalidFieldException
about interpreter_constraints
subsets. Is there a way to pair the parametrize or otherwise generate less than the full set of permutations?
I read https://github.com/pantsbuild/pants/issues/14863 and https://pantsbuild.slack.com/archives/C046T6T9U/p1671723858955379 and I'm not sure if I should take the current state of constraints+resolves as "confusing but works" or "can't do what I want yet"
(Thank you everyone for answering so many questions!)happy-kitchen-89482
01/04/2023, 7:39 AMcurved-policeman-2796
01/04/2023, 10:37 AMrequirements.txt
format? It looks like ./pants dependencies
used to do this with --type=3rdparty
(see ) but that option seems to have disappeared.high-magician-46188
01/04/2023, 2:11 PMplain-night-51324
01/04/2023, 6:55 PM./pants generate-lockfile
how do we improve the workflow? Convert it to poetry? (it doesnβt seem to support monorepo) Do I still need to go through this process? it seems pants does not support a --check option currently for lockfiles so the lockfile and my requirements could go out of date.famous-river-94971
01/04/2023, 8:50 PMpants
for a monorepo of AWS Cloud Development Kit (CDK), an infrastructure as code tool, projects. I've got a decent prototype set up, and it looks like the --changed-since
flag is working great. It's identifying "targets" that should be redeployed when they change.
I'm struggling to figure out the best way to run a shell command on targets that have changed. For instance, this command is properly identifying code that has changed:
ξ° ./pants --changed-since=HEAD --changed-dependees=transitive --filter-tag-regex='^cdk_app$' list
aws/projects/project_1:project_1
aws/projects/project_1/app.py
aws/projects/project_1/stack.py
Now I'd like to run a single command in project_1
(e.g., cd aws/projects/project_1 && ./my-script.sh
), but I'm not sure how to best do this. In this case my-script
would call out to the CDK binary to do the actual deployment π§΅chilly-tailor-75063
01/04/2023, 9:22 PM./pant fmt ::
multiple times in a row, it reports that changes were made each time. Why is that?chilly-tailor-75063
01/04/2023, 9:23 PM./pants lint ::
immediately after a
./pants fmt ::
It reports that black failed, even though it succeeded immediately prior. Why does that happen?high-yak-85899
01/05/2023, 12:05 AMplain-night-51324
01/05/2023, 12:13 AM./pants test <single-file>
to work:
Got errors that it canβt find 3rd party libraries like sqlalchemy, google.protobuf, factory (see inside)acoustic-fall-92482
01/05/2023, 12:19 AMtest
goal on pants 2.14, arm64, python 3.11. Seems there is an issue building httptools wheel. Any help would be appreciated. Thanks!average-exabyte-61568
01/05/2023, 1:48 PM[~/pants]$ /bin/bash -c "$(curl -fsSL <https://static.pantsbuild.org/setup/one_step_setup.sh>)"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1176k 100 1176k 0 0 4468k 0 --:--:-- --:--:-- --:--:-- 4632k
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 162 100 162 0 0 465 0 --:--:-- --:--:-- --:--:-- 465
100 19427 100 19427 0 0 46206 0 --:--:-- --:--:-- --:--:-- 46206
Bootstrapping Pants using /Users/xyz/.pyenv/shims/python3.9
Creating the virtualenv PEX.
Downloading the Pex PEX.
SHA256 fingerprint of <https://github.com/pantsbuild/pex/releases/download/v2.1.103/pex> verified.
Installing pantsbuild.pants==2.14.0 into a virtual environment at /Users/xyz/.cache/pants/setup/bootstrap-Darwin-arm64/2.14.0_py39
Traceback (most recent call last):
File "/Users/xyz/.cache/pants/setup/bootstrap-Darwin-arm64/pants.Spxdr9/install/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
ModuleNotFoundError: No module named 'pip._internal'
glamorous-nail-59544
01/05/2023, 3:28 PM--changed-since=
in github actions when the same Test-Build workflow is triggered for both PRs and Push events?abundant-autumn-67998
01/05/2023, 5:20 PM--complete-platform=cp.json
with --resolve-local-platforms
. Say I have compatible_tags: ['a', 'b']
in my cp.json
and I'm trying to build an sdist. Also assume my current platform can build b
tagged wheels. I expect the build to work but it fails. Using the latest pex 2.1.119.
However if I move b
to the front of the list compatible_tags: ['b', 'a']
, the same command works. This seems like a bug? Or am I missing something about how compatible tags are supposed to work?early-jelly-10468
01/05/2023, 6:21 PMroot
βββ service_1
β βββ app_code_1/
β β βββ module_123.py
β βββ tests/
β β βββ conftest.py
β β βββ test_app_code_1
β β βββ test_module_123.py
β βββ conftest.py
β βββ requirements.txt
βββ service_2
β βββ app_code_1/
β β βββ module_123.py
β βββ tests/
β β βββ conftest.py
β β βββ test_app_code_1
β β βββ test_module_123.py
β βββ conftest.py
β βββ requirements.txt
βββ n...
Our code is laid out in this manner (omitting the pants files) with each service in its own directory and a separate directory for tests and the application code.
If I run a ./pants test ::
it successfully picks up all the tests from each service, but they all fail due to missing 3rd party imports. I ran ./pants --filter-target-type=python_requirement list ::
and it looks like it is finding all the imports from the requirements.txt
projects/service_1:reqs#pytest
projects/service_1:reqs#etc
n...
Makes me think something about how our code is organized is preventing the tests from running using the requirements file. I was also expecting that I would be able to do something like ./pants test /service_1/:
but that does not pickup the test directory contained inside the service, further making me think the organization is messing it up.
Any guidance or direction would be helpful, I've been poking around the settings/configurations for about a day and haven't made any headway π. Thanks for anyone's timefamous-river-94971
01/05/2023, 7:36 PMexperimental_run_shell_commands
were identified as changed:
ξ° ./pants --changed-since=HEAD --changed-dependees=transitive --filter-tag-regex='^cdk$' list
aws/projects/project_1:cdk
aws/projects/project_2:cdk
But if I try to run
them, I get an error:
ξ° ./pants --changed-since=HEAD --changed-dependees=transitive --filter-tag-regex='^cdk$' run
12:32:43.46 [ERROR] 1 Exception encountered:
TooManyTargetsException: The `run` goal only works with one valid target, but was given multiple valid targets:
* aws/projects/project_1:cdk
* aws/projects/project_2:cdk
Please select one of these targets to run.
I can hack something with xargs
like this:
export PANTS_CONCURRENT=True && ./pants --changed-since=HEAD --changed-dependees=transitive --filter-tag-regex='^cdk$' list | xargs -L1 -P 2 ./pants run
but I was wondering if there's a "better"/more pants
-y way to do this?plain-night-51324
01/05/2023, 8:49 PMBUILD
and dependencies
? I have a directory full of json, i had to specify each one using file(name=.., source=..)
and then python tests I use all of these files, so I had a dependencies=[β¦]
. tried wildcard in dependencies and got UnsupportedWildcardError