salmon-barista-63163
06/24/2021, 10:55 PMplain-carpet-73994
06/24/2021, 10:56 PM./pants docker-push something
would build something
, then build an image containing it, and then push it somewhere.salmon-barista-63163
06/24/2021, 10:57 PMbusy-vase-39202
06/24/2021, 11:38 PMmelodic-ram-4612
06/25/2021, 6:44 PMbusy-vase-39202
06/25/2021, 8:06 PMhundreds-father-404
06/25/2021, 8:33 PMpoetry_requirements
macro so that Pants will map your pyproject.toml
into a bunch of python_requirement_library
targets, similar to the python_requirements
macro. See https://github.com/pantsbuild/pants/pull/12174 for some fun parsing code 😄
Will be released very soon in Pants 2.6 🎉late-byte-67016
06/28/2021, 12:51 PMpantsbuild/example-python
updated to a newer pypi release? A fix needed for remote-apis-testing
recently landed in 2.6.0.dev2 & 2.5.1rc3 and I'd love to get it incorporated! :)fresh-cat-90827
06/28/2021, 8:25 PMlist
goal documentation and see https://www.pantsbuild.org/v2.6/docs/reference-list#section-provides. Running
$ ./pants list --list-provides=True ::
does print names from the python_distribution
and from the provides=setup_py()
in the root BUILD
file
//:python_distribution-name setup_py-name
The help says:
List only targets that provide an artifact, displaying the columns specified by --provides-columns.I can’t find docs on
--provides-columns
argument — is it a refactoring leftover or something that is coming that’s not available in the public docs yet?
Many thanks.big-fall-51153
06/28/2021, 9:55 PM~=1.2.3
whereas I'd like it to be ~=1.2
clean-city-64472
06/29/2021, 6:22 PMbusy-vase-39202
06/29/2021, 6:52 PMfresh-cat-90827
06/29/2021, 8:04 PMshy-match-55049
06/29/2021, 11:02 PMPython + Docker + GCP
Monorepo architecture!? Curious to see how others have done this 🙂curved-furniture-94140
06/30/2021, 7:20 AMsrc/project1
src/project2
src/lib/lib1
src/lib/lib2
...
where project{n}
contain independently deployable applications, and lib
contains shared libraries (projects can’t import each other’s code). Each project{n}
has its own Dockerfile
and docker-compose.yml
. Now I probably also need a “global” docker-compose.yml
that is extended by the one in each project. The difficulty now is how to follow Pant’s philosophy in this setup. For example, in pants I can change any file, and it will figure out what things need to be run. But in the setup I just explained, this won’t work, since pants doesn’t know which databases a particular project or library might require.boundless-salesclerk-97604
06/30/2021, 3:42 PMResource temporarily unavailable
Exception - what would be the best way to debug this?happy-kitchen-89482
06/30/2021, 5:50 PMshy-match-55049
06/30/2021, 7:13 PMfresh-cat-90827
06/30/2021, 9:10 PMtox
before using Pants. Pants doesn’t mention tox
in the docs and I didn’t find any related issues on GitHub. The interpreter_constraints
option (docs) will resolve to a single Python interpreter version (so interpreter_constraints = ["CPython==3.6.9", "CPython==3.8.5"]
wouldn’t make sense).
My use case is as follows. I generate two PEX files — one for Python 3.6 and one for Python 3.8. It works out nicely since pex_binary
provides interpreter_constraints parameter, so I have two declarations of pex_binary
(in the root BUILD
file) each having a distinct Python interpreter version constraint. When packaging, I do see that each PEX file (after unpacking for inspection) contains the wheels for the target Python version. I have managed to create a requirements file with pinned transitive 3rd party dependencies with the versions of Python packages that work for both 3.6 and 3.8.
Having two target runtime environments of course implies that it’s required to run tests both against 3.6 and 3.8 interpreter. However, the test
goal works only against a single interpreter version:
[python-setup]
interpreter_constraints = ["CPython==3.8.5"]
Is there any way to run tests against multiple Python interpreters that I’ve missed being mentioned in the docs (without manually switching the Python versions in the pants.toml
)?shy-match-55049
07/01/2021, 2:34 AMalert-airplane-2123
07/01/2021, 4:43 PMpython_requirements
macro) has started including a module whose name clashes with a local module in my workspace, leading to dependency inference warnings like this (and other issues when both modules are used by a target):
22:22:22.84 [WARN] The target src/python/foo/health_score/ios/file_line_count_insight.py:ios_health_score imports `foo.health_score.health_score_check.HealthScoreCheck`, but Pants cannot safely infer a dependency because more than one target owns this module, so it is ambiguous which to use: ['3rdparty/python:foo-sdk', 'src/python/foo/health_score/health_score_check.py:lib'].
(foo-sdk
includes both a foo_sdk
and a foo
module.)
Is there any way exclude a specific module from a package? Some magic with a handwritten python_requirement_library
target perhaps? Or am I better off renaming my local module?powerful-boots-1234
07/01/2021, 9:04 PMpowerful-boots-1234
07/01/2021, 9:05 PM$ ./pants --version
23:01:10.36 [INFO] Initializing scheduler...
23:01:10.52 [INFO] Scheduler initialized.
2.6.0rc0
./project-app/BUILD
./project-app/pyproject.toml
./project-app/src/app.py
poetry_requirements()
pex_binary(
name="project-app-pex",
entry_point="src/app.py",
zip_safe=False,
)
python_tests(
name="tests",
sources=["test_*.py"],
timeout=120,
)
$ ./pants run project-app:project-app-pex -lerror
23:03:12.60 [ERROR] Exception caught: (pants.engine.internals.scheduler.ExecutionError)
File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 234, in _run_inner
return self._perform_run(goals)
File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 173, in _perform_run
return self._perform_run_body(goals, poll=False)
File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 190, in _perform_run_body
return self.graph_session.run_goal_rules(
File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/init/engine_initializer.py", line 135, in run_goal_rules
exit_code = self.scheduler_session.run_goal_rule(
File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 533, in run_goal_rule
self._raise_on_error([t for _, t in throws])
File "/home/ehiggs/.cache/pants/setup/bootstrap-Linux-x86_64/2.6.0rc0_py39/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 501, in _raise_on_error
raise ExecutionError(
Exception message: 1 Exception encountered:
MappingError: Failed to parse project-app/BUILD:
Name 'poetry_requirements' is not defined.
If you expect to see more symbols activated in the below list, refer to (<https://www.pantsbuild.org/v2.6/docs/enabling-backends>) for all available backends to activate.
All registered symbols: ['_python_requirements_file', 'archive', 'files', 'pants_requirement', 'pex_binary', 'pipenv_requirements', 'python_artifact', 'python_distribution', 'python_library', 'python_requirement_library', 'python_requirements', 'python_tests', 'relocated_files', 'resources', 'setup_py', 'target']
hundreds-father-404
07/01/2021, 9:06 PMpowerful-boots-1234
07/01/2021, 9:06 PMpowerful-boots-1234
07/01/2021, 9:08 PM___init___.py
happy-kitchen-89482
07/01/2021, 9:46 PMhappy-kitchen-89482
07/01/2021, 9:47 PMhappy-kitchen-89482
07/01/2021, 9:47 PMechoing-farmer-15630
07/02/2021, 4:26 PMa
(dir structure a/ns/a...
where this ns
contains __init_.py
)_ as well as b and c (which look like b/ns/b..
and c/ns/c...
). root directories a,b,c have SOURCE_ROOT set and a BUILD for python_requirements
, and all three ns/X
directories have a BUILD for python_library
. I will say that b/ns
and c/ns
don't have a BUILD because there are no source files there (including an __init__py
because I didn't want it to conflict with a
).
Okay. AAaaaanyway, I have a few python_test
targets that use b
or c
, and they seem to run OK (the ./pants dependencies
shows b/ns/b/__init__.py
and relevant files, and the tests run).
But I have one irritating test that isn't playing nice: ./pants dependencies
shows b/ns/b/_init_.py
and all files that I think I'm importing, but running the test fails with the equivalent of
module/tests/test_file.py:2: in <module>
from ns.b.submodule.submodule import Thing
E: ModuleNotFoundError: No module named `ns.b`
So I don't quite understand what's gone wrong. I've stared at comparable BUILD files to try and understand what's different. Is there a way to force rebuilding of the test pex just to make sure there's not a caching issue? Or something else I should look at?