lively-king-98806
07/28/2022, 3:12 PMpython_test(s)
. The docs state that runtime_package_dependencies
puts the packaged resources into chroot. If the runtime_package_dependencies
is a docker_image
, is there a way to get the image name/tag that was created?cold-soccer-63228
07/28/2022, 3:32 PM15:27:54.17 [INFO] Initializing scheduler...
15:27:54.43 [INFO] Scheduler initialized.
15:28:38.57 [ERROR] 1 Exception encountered:
Exception: Snapshot failed: Failed to digest inputs: Throw { val: Failed to watch filesystem for `/builds/path/to/file.py`: Error { kind: MaxFilesWatch, paths: ["/builds/path/to/file.py] }, python_traceback: "Traceback (no traceback):\n <pants native internals>\nException: Failed to watch filesystem for `/builds/path/to/file.py`: Error { kind: MaxFilesWatch, paths: [\"/builds/path/to/file.py\"] }", engine_traceback: ["digest_file"] }
Has anyone seen this type of error before? I’m running ./pants list ::
on a Gitlab CI/CD job.
This is what my pants.ci.toml
looks like.
[GLOBAL]
pantsd = false
watch_filesystem = false
local_store_dir = ".cache/pants/lmdb_store"
named_caches_dir = ".cache/pants/named_caches"
process_execution_local_parallelism = 8
creamy-ghost-8929
07/28/2022, 5:35 PMopen
), so inside the build file, I defined the docker file:
docker_image(
name="gpu",
dependencies = ["docker:base_docker_gpu", "train/semantic_segmentation"],
instructions = [
"FROM base_docker_gpu",
"COPY train.semantic_segmentation/train.pex /bin",
"COPY train/semantic_segmentation/config /root/",
]
)
But the copy instruction fails (./pants package docker/semantic_segmentation:gpu
): COPY failed: file not found in build context or excluded by .dockerignore: stat train/semantic_segmentation/config: file does not exist
I tired to add the config folder as a target with the files target:
files(
name="semantic_segmentation_config",
sources=["config/*/*", "config/*.yaml", "config/*/*.yaml"],
)
So, what would be the right way to add the config/ folder to my docker image using?cold-soccer-63228
07/28/2022, 6:48 PM.cache/pants/named_caches
?
I noticed that this directory is extremely large (on the order of gigabytes), and caching it is somewhat expensive because it takes a long time to download (and upload) this cachehappy-kitchen-89482
07/28/2022, 6:53 PMbitter-ability-32190
07/29/2022, 12:43 AMripe-cpu-85141
07/29/2022, 3:11 AM__init__.py
).
In the end, though, everything is packaged in a single wheel, and the whole hierarchy forms a coherent app.
./pants tailor
creates a `BUILD`file per package/directory.
Is that necessary or should I have a single `BUILD`file on top with a target like python_sources(sources=["**/*.py"])
instead?cool-yacht-37128
07/29/2022, 3:28 AMpants.toml:
[python]
interpreter_constraints = [“>=3.9.2,<=3.9.13”]The above generated a shebang of:
#!/usr/bin/env python3.10
If I run pants in the generated venv python-default I get #!/usr/bin/env python3.9
but I didn’t expect I needed to run pants in the generated venv for it to decide which shebang to use.rhythmic-glass-66959
07/29/2022, 1:08 PMpants
script? Or maybe an already built Pants Docker image (I can't seem to find one)? I ask because we are using Concourse CI and I want to create a Docker image with Pants pre-installed.adamant-oil-53479
07/29/2022, 4:14 PM./pants tailor
to CICD), but gitignore recommendations don’t specify BUILD files so I’m afraid I’ve missed something 🙂ripe-cpu-85141
07/29/2022, 4:27 PM./pants test a/test_file.py
on my python/pytest repo and that call pulls a dozen of third-party dependencies, which looks "normal" to me.
The problem is that the test doesn't exec. It takes around 80 seconds to build requirements.pex
and then seems to loop forever when trying to build pytest_runner.pex
before my machine goes out of memory.
I'm not sure what I did wrong or how to debug that 😕flat-zoo-31952
07/29/2022, 6:50 PMripe-cpu-85141
07/29/2022, 7:58 PMa
├── ba
│ ├── __init__.py
│ └── resources.py
├── bb
│ ├── __init__.py
│ └── resources.py
├── bc
│ ├── __init__.py
│ └── resources.py
├── bd
│ ├── __init__.py
│ └── resources.py
├── be
│ ├── __init__.py
│ └── resources.py
├── bf
│ ├── __init__.py
│ └── resources.py
└── __init__.py
a/__init__.py
uses importlib.import_module
to load all the resources.py
files under it (done to do auto-registration on a factory).
This isn't picked up by the pants' inference system.
I thought to have a/BUILD
with something like
python_sources(
overrides={
"__init__.py": {
"dependencies": ["*/**/*.py"]
}
}
)
But pants is complaining.
I'm not sure I can use glob on dependencies
anyway.
Therefore, I'm not sure how to handle that situation.
Can you guys tell me if my approach is ok and what is missing to make it works?flat-zoo-31952
07/29/2022, 9:00 PMTYPE_CHECKING
deps, while another goes with the default and uses them?curved-farmer-66180
07/30/2022, 6:57 AM ./pants run payhere/app_services/hero_cx/manage.py -- runserver
Traceback (most recent call last):
File "/Users/szto/.pyenv/versions/3.7.12/lib/python3.7/logging/config.py", line 384, in resolve
found = self.importer(used)
ModuleNotFoundError: No module named 'log_request_id'
The above exception was the direct cause of the following exception:
I could not see the 3rd party lib from dependencies.
./pants dependencies payhere/app_services/hero_cx/manage.py
payhere/app_services/hero_cx/__init__.py:lib
payhere/app_services/hero_cx/gunicorn.py:lib
payhere/app_services/hero_cx/manage.py:lib
payhere/app_services/hero_cx/settings.py:lib
payhere/app_services/hero_cx/urls.py:lib
payhere/app_services/util/app_service.py
payhere/hero_cx/__init__.py
payhere/hero_cx/apps.py
payhere/hero_cx/swagger.py
payhere/sellers/__init__.py
payhere/sellers/apps.py
payhere/sellers/forms.py
payhere/sellers/signals.py
payhere/sellers/swagger.py
payhere/sellers/tasks.py
payhere/sellers/views.py
Here is my BUILD file
python_sources(
name="lib",
dependencies=[
"payhere/hero_cx",
"payhere/sellers"
]
)
pex_binary(
name="gunicorn",
entry_point="gunicorn.py",
dependencies=[
":lib",
],
restartable=True,
)
pex_binary(
name="manage",
entry_point="manage.py",
dependencies=[
":lib",
],
restartable=True,
)
great-diamond-82230
07/30/2022, 8:55 PMexport-codegen
produces the java:
dist/codegen/src/thrift/thrift_example/thriftjava/Person.java
but with both java and scala enabled, it produces only the scala:
dist/codegen/src/thrift/thrift_example/thriftscala/Person.scala
https://github.com/mgedigian-etsy/pants-jvm-codegen/compare/codegen?expand=1ripe-cpu-85141
07/31/2022, 2:28 AMshy-advantage-49800
07/31/2022, 4:54 AMpants.toml
schema definition? With that I can have autocomplete on VSCode 🥺fierce-keyboard-91032
07/31/2022, 8:33 AMmake_migration
) in a Pants repository. I need to do this outside of the sandbox, since they generate some new files for the codebase.
Looking at #12129 and previous discussions, it seems people were working on adding a run_in_sandbox
flag to pex_binary
, but it got reverted in #15849.
What would be the recommended way to do this now?wide-midnight-78598
07/31/2022, 2:51 PMcurved-farmer-66180
07/31/2022, 5:42 PMroot
L config
L settings
L test.py
L projects
L app
L tests
L test_app.py
To test test_app.py, I need to add pytest config file to config.settings.test, but test couldn’t get the location. Anyone can help me?
BUILD file
python_sources(
name="lib",
dependencies=[
"config",
]
)
python_tests(
name="tests",
dependencies=[
":lib",
],
)
Errors
File "/Users/szto/.cache/pants/named_caches/pex_root/venvs/s/a852a762/venv/lib/python3.7/site-packages/pytest_django/plugin.py", line 183, in _handle_import_error
raise ImportError(msg)
ImportError: No module named 'config.settings.test'
worried-painter-31382
07/31/2022, 9:52 PMpytest <module>
with ./pants test <module>::
in our github actions.happy-horse-36146
07/31/2022, 11:20 PMcool-yacht-37128
08/01/2022, 4:14 AMfresh-cat-90827
08/01/2022, 1:02 PM./pants tailor ::
on a new repository and got:
13:56:24.86 [ERROR] 1 Exception encountered:
ValueError: The tailor goal only accepts literal directories as arguments, but you specified: ::. You can also specify no arguments to run against the entire repository.
Running ./pants tailor
works fine. The command with the ::
target is provided in the docs: Generate BUILD files. Is this expected or is it an issue? Perhaps the semantics of the command has changed in a recent version and docs need to be updated?prehistoric-afternoon-67621
08/01/2022, 2:05 PMfrom google.protobuf.internal import builder as _builder
E ImportError: cannot import name 'builder' from 'google.protobuf.internal'
I'm using protobuf==3.19.4
in the project. Unfortunately I have a requirement in the project that requires protobuf<3.20
(due to Tensorflow) so I can't bump this.
Anyone have any suggestions? 🙏average-balloon-31442
08/01/2022, 3:20 PMworkspace.go
, but not in go.mod
Every lib has own go.mod
.
I have found this https://github.com/pantsbuild/pants/issues/13114#issuecomment-1185321565 comment and not sure, that I’m getting the point. Right now, I cannot build/run the service, because the lib
is not found.
I have tried with
go_third_party_package(
name="psykhe-common",
import_path="go/lib/common",
)
but go_third_party_package
is expected to be generated from go.mod
file.
Note: for now, Pants only supports repositories using a singleDoes it mean that I cannot use pants for managing GO projects because I have more than 1. Please comment on #13114 if you need support for greater than onego.mod
so that we can prioritize adding support.go.mod
go.mod
file in the monorepo?freezing-area-97131
08/01/2022, 4:50 PM1.17.0
. Recently I got dependency issue when building the pex.
...
import attr
File "/xxx/.pants.d/test/pytest-prep/CPython-2.7.12/0ef27f900708c3ec08d3ddb7bff04c4eaa061e2c/.deps/attrs-22.1.0-py2.py3-none-any.whl/attr/__init__.py", line 8, in <module>
from . import converters, exceptions, filters, setters, validators
File "/xxx/.pants.d/test/pytest-prep/CPython-2.7.12/0ef27f900708c3ec08d3ddb7bff04c4eaa061e2c/.deps/attrs-22.1.0-py2.py3-none-any.whl/attr/converters.py", line 10, in <module>
from ._compat import _AnnotationExtractor
File "/xxx/.pants.d/test/pytest-prep/CPython-2.7.12/0ef27f900708c3ec08d3ddb7bff04c4eaa061e2c/.deps/attrs-22.1.0-py2.py3-none-any.whl/attr/_compat.py", line 11, in <module>
from collections.abc import Mapping, Sequence # noqa
ImportError: No module named abc
I have investigated and find out the error comes from the package attrs , it recently updated and not supports python 2.7 anymore, so I have to peg its version to previous one 21.4.0
I have set the BUILD
file like this:
python_requirement_library(
name='attrs',
requirements=[
python_requirement(name='attrs', requirement='attrs==21.4.0'),
],
dependencies=[
':coverage',
],
)
But when I run test or build pex, I still got the same error, and when I look into the .pants.d/python-setup/resolved_requirements/CPython-2.7.12/
, there is still attrs-22.1.0-py2.py3-none-any.whl
installed, not the 21.4.0
What should I do ? Can anyone help me~? Thanks a lot!ripe-cpu-85141
08/01/2022, 6:55 PMpip install pants
but it doesn't seem to be in that package.flaky-artist-57016
08/01/2022, 9:03 PMpants
is using when I call ./pants test ::
for example. When I run the test command with -ldebug
it appears (I could be wrong) that pants
is spawning multiple processes with different versions of Python that I have installed--even if I remove them from my PATH
.
For example:
16:42:45.42 [DEBUG] spawned local process as Some(23549) for Process { argv: ["/Users/username/miniconda3_py3.8/envs/io-env/bin/python"...
...
16:42:45.43 [DEBUG] spawned local process as Some(23550) for Process { argv: ["/Users/username/.pyenv/versions/3.8.13/bin/python"...
...
16:42:45.43 [DEBUG] spawned local process as Some(23551) for Process { argv: ["/Users/username/.pyenv/versions/3.10.4/bin/python"...
...
What is going on there?