abundant-leather-17386
08/11/2022, 9:09 AMbland-father-19717
08/11/2022, 10:57 AMFROM A
in another docker_image?narrow-judge-15725
08/11/2022, 12:24 PMsteep-controller-23208
08/11/2022, 1:38 PMBuilding ${n} requirements for ${pexfile} from the lockfiles/python-default.lock
, even though the lock does not change.
Is this required process for building pex or is there any way to speeding up this process?
Thank you in advance.bitter-ability-32190
08/11/2022, 4:51 PMBUILD
file LSP. Still hand-waivey, but 🎉bitter-ability-32190
08/11/2022, 5:45 PMcoverage-py
doesn't support lcov
output?clever-ghost-87030
08/11/2022, 10:02 PM./pants generate-lockfiles
in v 2.12 and noticed that the lockfiles generated seem to have this "platform_tag" field in "locked_resolves". From what I can tell, this seems to be dependent on the machine that actually generated the lockfiles. This seems bad from a consistency POV. Is my understanding of this field correct? If so what is it's purpose?brainy-solstice-27042
08/12/2022, 2:35 AM:path/to/target:binary
as the definition for the dependency but that doesn't appear to force pex B to be build before pex A is buildlimited-insurance-37393
08/12/2022, 1:58 PMlib
module as a distribution for publishing to PyPI, and I also have code in a sibling module that depends on the contents of lib
which I want to package separately. The layout looks like:
src/
concourse/
BUILD
lib/
pipelines/
narrow-judge-15725
08/12/2022, 2:41 PMfresh-cat-90827
08/12/2022, 3:03 PMrich-london-74860
08/12/2022, 3:11 PM./pants roots
and ./pants list ::
(or any goal using ::
), then …
1. both commands work locally
2. both work when running in a docker container for the image used in CI/CD
3. in CI/CD, roots
works as expected, and has the same output as 1 and 2 but list
gets the error:
15:09:10.80 [ERROR] 1 Exception encountered:
ResolveError: No targets found for the address glob `::`
Do targets exist in those directories? Maybe run `./pants tailor` to generate BUILD files? See <https://www.pantsbuild.org/v2.12/docs/targets> about targets and BUILD files.
Why might this be different in this case?proud-dentist-22844
08/12/2022, 4:30 PMbumpy-spoon-55438
08/13/2022, 9:26 PMnice-florist-55958
08/14/2022, 4:58 PMtouch -a source.py
), and
• pants: invalidates at the file content (SHA hash) level (e.g., from an echo -e "\n" >>source.py
)?
Besides scanning the logs with -ldebug
option, is there a way to see extra output regarding cache hits from both levels?wide-midnight-78598
08/14/2022, 5:01 PMacceptable-football-32760
08/15/2022, 12:50 PM2.12
]
[UPD2: I tried to parametrize the python_resolve
but then I get another error in 🧵 ]
Hello dear community, I'm in the process of creating two resolves (a long-known problem of having gpu+cpu torch dependency) and decided to go via macros for python_sources
, python_requirements
and the likes -- macros which parametrize them like
def python_sources_custom(**kwargs):
kwargs.pop("resolve", None)
python_sources(resolve=parametrize("gpu", "cpu"), **kwargs)
All uneventful until I hit the grpc proto
generation and it seems that there's something off with them:
• on the one hand, protobuf_sources
target generator does not have anything like resolve
field (github) -- which makes sense provided that proto file is not bound to any specific language and resolve mechanism is python-specific -- so I can't actually parametrize them
• on the other hand, I hit an error for dependency resolver
UnownedDependencyError: Pants cannot infer owners for the following imports in the target some/path/to/file.py@resolve=gpu:
* some.import.of.this.file_pb2_grpc (line: 1)
These imports are not in the resolve used by the target (`gpu`), but they were present in other resolves:
* some.import.of.this.file_pb2_grpc: 'cpu' from some/import/of/this/file.proto
• a.k.a. "despite .proto
file itself being not subject to resolve, pants naturally wants theresulting pb2_grpc.py
file to be resolved"
It seems to be a dead-lock 😅 or am I missing something?rich-london-74860
08/15/2022, 3:58 PMpants.toml
, pants is not really designed to utilize environment variables, everything should be in a file, whether it’s check-in into the repo or a configuration file on the machine. I was able to workaround this in 2 ways.
1. One way I have this working is to use ./pants package
to produce the *.whl
files and then use a twine upload
(which uses environment variables to set the pypi target - TWINE_REPOSITORY_URL
, TWINE_USERNAME
, TWINE_PASSWORD
) to publish those files (For the sake of this question, please assume that only python packages need to be published, meaning this would fulfill all of our needs). However, this does not use ./pants publish
and does not use the repositories
property of the python_distribution
target, which seems wrong to me.
2. Another way I had this working was to write a script that writes ~/.pypirc
based on credentials in environment variables. That script is built into a pex_binary
target and run before ./pants publish
. When ./pants publish
runs, it picks up ~/.pypirc
. However, it seems like pants
is designed to have all files either checked-in, a persisted fixture of the environment (the CI/CD worker instance has a ~/.pypirc
file saved on disk), or the product of a target specified in a BUILD
file. In this case ~/.pypirc
is not any of these, so this feels very hacky to me.rhythmic-airport-91451
08/15/2022, 4:21 PMrhythmic-glass-66959
08/15/2022, 6:39 PMpython_sources
target to the docker_image
dependencies, but when building the docker image, I got an error message that the file does not exist
.boundless-zebra-79556
08/15/2022, 9:01 PM--pull=False
to docker CLI when doing docker_image
. This will come handy when build process is multi-stage and each target can assume one stage of the building process. Seems like a straightforward change and if we are ok with the idea, I would like to take a stab at adding pull
boolean field to docker_image
rule. What do you all think?busy-vase-39202
08/16/2022, 12:20 AMnutritious-minister-3808
08/16/2022, 1:01 PM-i
interactive mode?
There is a script in a docker container that was previously executed using /path/to/venv/bin/python -i script.py arg1 arg2
. Now with pantsbuild, the /path/to/venv
no longer needs to exist because everything else in the container is packaged using pex. I have considered leaving the current venv there as well as possibly using a modification of this recipe to make a new venv but I was wondering if there was some possible trickery with pex that I was overlooking?ancient-breakfast-45303
08/16/2022, 1:44 PMripe-cpu-85141
08/16/2022, 4:04 PM@pytest.fixture(autouse=True)
def dont_do_this(mocker):
mocker.patch("my.module.class.method")
and Pants doesn't seem to add my/module.py
in the dependencies even with
[python-infer]
string_imports = true
Am I missing something or should I manually add those deps in my BUILD file?bitter-ability-32190
08/16/2022, 4:30 PMupdate-build-files
into `fmt`/`fix`.
• Let's say you're formatting your build files with black
. Running ./pants fmt --only=black ::
with `black`en your Python code AND your BUILD
files. How does that feel, as a user? The alternative is to make some "special" key (like build-files-black
or similar), which feels worse to me.
• Do we need/want options for "only BUILD files"/"everything but build files"? Those are possible, but tricky to find a good name for IMO.freezing-lamp-12123
08/16/2022, 5:25 PMrefined-addition-53644
08/16/2022, 7:57 PMcomplete_platforms
option should look like in pex_binary
The docs for pex says
The complete platform can be either a path to a file containing JSON data or else a JSON object literal.On the other hand, docs for pex_binary says
Complete platforms should be addresses oftargets that point to files that contain complete platform JSON as described by Pexfile
fresh-cat-90827
08/16/2022, 9:37 PMplain-truck-80265
08/17/2022, 5:15 AMpants publish
to push Docker images into ECR. It works great, but the problem of ECR is that you must have repo created before you push the iamge (https://github.com/aws/containers-roadmap/issues/853) , otherwise you see couple of retryings. Is there any elagant way how to run some command before pants
do a docker push? Thank you