curved-television-6568
10/27/2021, 5:08 PMhappy-kitchen-89482
10/27/2021, 8:01 PM:server
since the pex is what the docker image consumes. And the server
target should have a dep on :bar
, since that is what it consumes in turn.happy-kitchen-89482
10/27/2021, 8:02 PMhappy-kitchen-89482
10/27/2021, 8:02 PMbitter-ability-32190
10/27/2021, 8:02 PMfmt
)
• If CODEOWNERS isn't what we expect due to changes in CODEOWNERS.yml, we error on the right command (like lint
?)
• If someone touches CODEOWNERS but not the yml, also error in a command (like lint
)
Any thoughts on this inside of Pants (I presume as a plugin)brash-family-72057
10/27/2021, 8:41 PMbitter-ability-32190
10/27/2021, 8:45 PMpants
have a clean
equivalent? Specifically looking to clean:
• The cache
• Previously leaked tempdirs used for debuggingfresh-cat-90827
10/27/2021, 10:04 PMrequirements.txt
file), I configure pants.toml
to be:
[python-setup]
...
requirement_constraints = "constraints.txt"
resolve_all_constraints = false
When running the tests, I can see this being printed:
Starting: Building requirements.pex with 4 requirements: PyYAML, dataclasses==0.6, marshmallow>=3.5, requests>=2.22
Does it mean that Pants ignores the constraints.txt
file?
I’ve left a dependency out of the constraints.txt
on purpose and got this message, so Pants must be able to find it
The constraints file constraints.txt does not contain entries for the following requirements: elasticsearch
user
10/27/2021, 11:00 PMuser
10/28/2021, 12:08 AMambitious-actor-36781
10/28/2021, 1:34 AM./pants --changed-since=origin/master list
no longer works... on CI.
locally works fine:
╰─➤ git --version
git version 2.30.2
╰─➤ ./pants --changed-since=origin/master list
14:33:17.78 [INFO] Initializing scheduler...
but on ci... fails:
$ git --version
git version 2.20.1
$ ./pants -ldebug --changed-since=$CHANGED_SINCE list
01:32:16.80 [DEBUG] Detected git repository at /builds/infloai/repo on branch None
01:32:16.80 [DEBUG] Executing: git --git-dir=/builds/infloai/repo/.git --work-tree=/builds/infloai/repo diff --name-only HEAD -- /builds/infloai/repo
01:32:16.83 [DEBUG] Executing: git --git-dir=/builds/infloai/repo/.git --work-tree=/builds/infloai/repo diff --name-only origin/master...HEAD -- /builds/infloai/repo
01:32:16.84 [ERROR] git --git-dir=/builds/infloai/repo/.git --work-tree=/builds/infloai/repo diff --name-only origin/master...HEAD -- /builds/infloai/repo failed with exit code 128
(Use --print-stacktrace for more error details and/or --no-process-execution-local-cleanup to inspect chroots. See <https://www.pantsbuild.org/v2.7/docs/troubleshooting> for common issues. Consider reaching out for help: <https://www.pantsbuild.org/v2.7/docs/getting-help.>)
fresh-cat-90827
10/28/2021, 11:28 AMpex_binary
targets in a particular project within a Pants monorepo than doing:
./pants filter --target-type=pex_binary --filter-address-regex="myproject" :: | xargs ./pants package
?curved-television-6568
10/28/2021, 12:03 PMdocker_image
to the pex binary :server
as Benjy suggested, then run ./pants -ldebug package bar:docker
and check for the log that reads "Packages for Docker image: …"
should tell you what the pex binary name is that you can use.stale-nightfall-29801
10/28/2021, 1:34 PMstale-nightfall-29801
10/28/2021, 1:34 PMpex
binary in this:stale-nightfall-29801
10/28/2021, 1:36 PMdocker_image(
name='docker_server',
dependencies=[":bar"],
sources=["Dockerfile"]
)
stale-nightfall-29801
10/28/2021, 1:40 PMcurved-television-6568
10/28/2021, 1:43 PMdependencies=[":bar"],
to dependencies=[":server"]
which is the name of your pex binary target.curved-television-6568
10/28/2021, 1:44 PMcurved-television-6568
10/28/2021, 1:45 PMbitter-ability-32190
10/28/2021, 4:10 PMpants
is running & using for it's internal rules?
I just noticed if I run pants
from within/without some virtual env I have, it'll toggle between 2.7 (system-default) or 3.8 (virtual environment version)loud-laptop-17949
10/28/2021, 5:15 PM--changed-since
in our CI system and and get this error
Error: 6.70 [ERROR] git --git-dir=/home/runner/work/color/color/.git --work-tree=/home/runner/work/color/color diff --name-only master...HEAD -- /home/runner/work/color/color failed with exit code 128
.
Not sure how to debug this further without a more detailed error message?brash-baker-91190
10/28/2021, 5:19 PMTraceback (most recent call last):
File "/home/maier/.cache/pants/setup/bootstrap-Linux-x86_64/2.8.0rc0_py37/lib/python3.7/site-packages/pants/engine/internals/selectors.py", line 711, in native_engine_generator_send
res = func.send(arg)
File "/home/maier/.cache/pants/setup/bootstrap-Linux-x86_64/2.8.0rc0_py37/lib/python3.7/site-packages/pants/backend/python/util_rules/pex.py", line 441, in build_pex
resolve_name,
File "/home/maier/.cache/pants/setup/bootstrap-Linux-x86_64/2.8.0rc0_py37/lib/python3.7/site-packages/pants/backend/python/util_rules/lockfile_metadata.py", line 126, in from_lockfile
concrete_class = _concrete_metadata_classes[metadata["version"]]
KeyError: 'version'
This is when I'm trying to run ./pants update-build-files
to update things. Has anyone run into this before?brash-baker-91190
10/28/2021, 5:22 PMbrash-baker-91190
10/28/2021, 8:55 PMexecution_mode="zipapp"
with 2.7.1rc0 seems to fix the issue.
I'm not a Python packaging expert by a long shot, so I'm not entirely sure how this distinction would have such a big effect. Has anybody else seen this? Is there additional information I could provide that might be useful here? Thanks in advance 🙇busy-vase-39202
10/28/2021, 8:59 PMfresh-cat-90827
10/28/2021, 10:12 PMpkg_resources
to get the version of the package at the runtime (to be put into some logs/reports — to tell what version was used for producing the outputs).
from pkg_resources import get_distribution
get_distribution("my_project").version
Now, the package is not installed any longer as a wheel and instead is run as a PEX file (and of course it doesn’t have a “version” any longer). What approach do people take when they need to access the version dynamically when running the code? I see https://github.com/pantsbuild/pants/blob/main/src/python/pants/version.py#L13-L18 but curious what other clever tricks others have came up with 🙂ambitious-actor-36781
10/29/2021, 12:19 AM--pytest-args="--pdb"
automatically gave pants the right set of flags to workclean-city-64472
10/29/2021, 3:45 AMpex_binary(name="manage", entry_point="manage.py", dependencies=["src/mysite:mysite", "src/polls:polls"], restartable=True)
VS
pex_binary(
name="manage",
entry_point="manage.py",
dependencies=[
"src/mysite:mysite",
"src/polls:polls"
],
restartable=True
)
I much prefer the second one - it makes diffs so much more readable. Guessing this is configurable if I look for the option but maybe we want to override the defaults on Black for this use case out of the box?ambitious-actor-36781
10/29/2021, 4:52 AM