fresh-continent-76371
11/09/2022, 9:48 PMjava -Xmx500M -cp "/usr/local/lib/antlr-4.9.3-complete.jar:.:/usr/local/lib/antlr-4.9.3-complete.jar" org.antlr.v4.Tool
At a simple level this is experimental_shell_command
,
am I correct in thinking i can get Pants to "supply" the JVM, and the antlr dependency.
adding the jvm backend, gives me the jvm_artifact(...)
to pull antlr,
How do i make the "jvm" a tool / dependency to the experimental_shell_command
or is there a "java run" type target instead ?curved-manchester-66006
11/10/2022, 1:33 AMdry-nightfall-26819
11/10/2022, 3:50 AMpoetry install --no-root
or whatever the equivalent command is (forgive me, going off the top of my head)
2. During merge request pipelines, the pipeline adds the current state of the repo to the container
3. (today) we run poetry install --sync
in the container
a. This allows any new dependencies to be added dynamically
b. old dependencies to be removed
c. Installs the library under test
d. Is faster than a "clean" build because poetry knows that several of the dependencies are already installed in the virtual environment
4. We then run linting/security scanning/ tests / etc
We'd really like to be able to replicate the above with pants, while keeping the benefits of how pants normally operates (with the hermetic execution, dep inference, etc)
I tried building a pex and working with that, but i'm running into a few issues (with and without the pex; it's all a bit messy atm while i've been trying to debug / explore):
• pants repl ::
(just used for my interactive testing) in the container fails with a message saying manulinux versions of the dependent libraries are not available
◦ This is technically true; they aren't (it's numpy and such + a few custom deps we don't currently build manylinux versions of)
◦ What i'd expect / want to happen is for pants to automatically build the required wheels from the sdist (which is available on the private mirror, and pants is also able to reach pypi)
◦ Oddly, I think this might be working if I do something like ./pants test ::
in that it does exactly what i'd expect (build the whls from sdist) but I don't know that it's actually baking/caching the whl files into the image as opposed to re-downloading them
• ./pants export ::
does indeed work, and if I source ./path/to/venv/bin/activate
and python -i; import my_library; import my_library_dep_that_won't_work_with_repl
that all works as expected.
Additionally, my question at a high level is how can I bake the required whl files into the image so that they are available and will be used and also support ./pants downloading and using new deps as needed in the pipeline?
And how can I prove / verify that they are actually there / being used?
I thought I might need to run ./pants (re?)generate-lockfiles
but after opening them up they actually aren't platform specific (which was a duh! moment once I realized it)
For what it's worth, I was seeing the above (no manylinux versions available) messages both with and without the pex_build.
I kind of suspect this is something related to how i'm doing things (probably wrongly, although i've been pouring over the (well-written!) docs)? So happy to provide a minimal example once I have some time 🙂
I think in current state I arguably could just ignore the issues with ./pants repl ::
in the container because I believe ./pants test ::
and ./pants package
etc are working? but I don't want to just ignore it since it seems like this is something that should work.
Also, with current state, i'm not certain that it isn't re-downloading the whl files on each new command; is there info about how/where pants caches the whl files it uses?
Can someone confirm if pants is creating a separate .pex for each command / sub-portion of each command?
• This actually would make a lot of sense for the hermetic execution reasons, and appears to be what's happening given the output messagesadamant-piano-24321
11/10/2022, 7:52 AMalembic.ini
file is not being included in the pex runtime.
I have attempted to explicitly include the ini file using the file and resource pattern.
Still not managing to get this right.
Any advice?hundreds-carpet-28072
11/10/2022, 1:59 PMmodule_mapping={
"ansicolors": ["colors"]
}
### get ^ when given ^
glamorous-accountant-97217
11/10/2022, 2:17 PMpython_requirement(
name="snowflake-connector",
requirements=["snowflake-connector-python[pandas]==2.7.11"],
modules=["snowflake"],
)
until recently I was able to build my package with pants, but now i’m getting No matching distribution found for snowflake-connector-python[pandas]==2.7.11
. i don’t know what’s changedbright-pilot-85305
11/10/2022, 4:08 PMcurved-manchester-66006
11/10/2022, 4:12 PMgenerate-lockfiles
failing with
ERROR: Could not find a version that satisfies the requirement awswrangler==2.16.1
ERROR: No matching distribution found for awswrangler==2.16.1
Since that version clearly exists https://pypi.org/project/awswrangler/2.16.1/#historybitter-ability-32190
11/10/2022, 6:10 PMexperimental_shell_command
to rerun?
I'm seeing it run essentially every daemon restart, which isn't ideal.
🧵rapid-bird-79300
11/10/2022, 6:53 PM[2022-11-10T18:49:23Z] 18:49:23.75 [WARN] Error storing process execution result to local cache: Error storing fingerprints ["000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20", "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20", "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20", "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20", "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20"]: MDB_CURSOR_FULL: Internal error - cursor stack limit reached - ignoring and continuing
the only major change I can think of is we pull the cache in our lint step. Not sure if that somehow impacted.gentle-painting-24549
11/10/2022, 7:11 PMbored-glass-58755
11/10/2022, 7:32 PMpython_distribution
target but the package
goal is failing. Following is the trail of the debug output:
14:26:04.48 [DEBUG] Completed: Resolve transitive targets
14:26:14.43 [DEBUG] Completed: Downloading: <https://github.com/protocolbuffers/protobuf/releases/download/v3.20.1/protoc-3.20.1-osx-aarch_64.zip> (2.58 MB)
14:26:14.43 [DEBUG] Completed: pants.core.util_rules.external_tool.download_external_tool
14:26:14.43 [DEBUG] Completed: Generate Python from Protobuf
14:26:14.43 [DEBUG] Completed: pants.backend.python.util_rules.python_sources.prepare_python_sources
14:26:14.43 [DEBUG] Completed: pants.backend.python.util_rules.python_sources.strip_python_sources
14:26:14.43 [DEBUG] Completed: pants.backend.python.util_rules.python_sources.prepare_python_sources
14:26:14.43 [DEBUG] Canceled: pants.backend.python.util_rules.python_sources.strip_python_sources
`142614.43 [DEBUG] Completed: package
goal`
14:26:14.43 [DEBUG] computed 1 nodes in 10.502206 seconds. there are 262 total nodes.
14:26:14.43 [ERROR] 1 Exception encountered:
Exception: Error downloading file: error sending request for url (<https://github.com/protocolbuffers/protobuf/releases/download/v3.20.1/protoc-3.20.1-osx-aarch_64.zip>): error trying to connect: proxy authentication required
I have tried adding the subsystem subprocess-environment
with proxy variables in pants.toml
but the error remains the same. I am using python 3.9 on an M1 Mac. My question is if the debug output says that package goal completed, why and what is it failing for?broad-processor-92400
11/10/2022, 10:56 PM./pants check ::
runs 10x faster when there's a small change to python code), thank you! However, I noticed that there seems to be a single cache.db
file per python verison in ~/.cache/pants/named_caches/mypy_cache/
. Does that mean a single cache is used for all invocations of mypy via pants?
E.g. I've got multiple check-outs of our internal company repo (sharing a cache seems to make sense between them...), but also the pants repo, and sharing a cache between the pants and our internal one seems a bit unexpected?few-arm-93065
11/10/2022, 11:01 PM~/.cache/pants/lmdb_store
~/.cache/pants/named_caches
~/.cache/pip
yet, I still see these errors.
ProcessExecutionFailure: Process 'Building src.stages.fragment_counts/exe.pex with 9 requirements: boto3==1.21.45, confluent-kafka[avro]==1.8.2, cryptography==3.4.8, overrides==6.1.0, redis[hiredis]==4.3.4, toml==0.10.2, typeguard==2.13.3, types-redis==4.3.20, types-toml==0.10.1' failed with exit code 1.
stdout:
stderr:
ERROR: Could not find a version that satisfies the requirement boto3==1.21.45
ERROR: No matching distribution found for boto3==1.21.45
pid 1910 -> /home/runner/.cache/pants/named_caches/pex_root/venvs/97c49a45855c8337ed6c7437a8f9bce7e5f12e07/15ba0a31f835e32f40e40a07c519d52e41260cdc/pex --disable-pip-version-check --no-python-version-warning --exists-action a --isolated -q --cache-dir /home/runner/.cache/pants/named_caches/pex_root --log /tmp/process-execution74ifxC/.tmp/tmpa2vp83vp/pip.log download --dest /tmp/process-execution74ifxC/.tmp/tmpddxwdbv9/opt.hostedtoolcache.Python.3.9.15.x64.bin.python3.9 boto3==1.21.45 confluent-kafka[avro]==1.8.2 cryptography==3.4.8 overrides==6.1.0 redis[hiredis]==4.3.4 toml==0.10.2 typeguard==2.13.3 types-redis==4.3.20 types-toml==0.10.1 --index-url ***((our-artifactory-redacted))/artifactory/api/pypi/sw-pypi/simple --retries 5 --timeout 15 exited with 1 and STDERR:
None
Any advice on how I could go about fixing this?shy-advantage-49800
11/11/2022, 4:16 PMpy.typed
?shy-advantage-49800
11/11/2022, 4:43 PMpython2
compatibility on the wheel? 🤔shy-advantage-49800
11/11/2022, 9:41 PMshy-advantage-49800
11/11/2022, 9:49 PM22:47:26.30 [WARN] Pants cannot infer owners for the following imports in the target tests/test_http.py:run:
* tests.response.Response (line: 11)
If you do not expect an import to be inferrable, add `# pants: no-infer-dep` to the import line. Otherwise, see <https://www.pantsbuild.org/v2.14/docs/troubleshooting#import-errors-and-missing-dependencies> for common problems.
tall-battery-32825
11/11/2022, 10:24 PM[python-infer].assets = true
to detect a dependency on assets that are loaded from a folder like so:
root_dir = "path/to/directory/with/data/files/"
for filename in os.listdir(root_dir):
with open(root_dir + filename) as f:
...
Or would I have to open each file explicitly?shy-advantage-49800
11/11/2022, 10:32 PM❯ ./pants test tests
23:31:26.61 [INFO] Completed: Building pytest_runner.pex
23:31:26.61 [ERROR] 1 Exception encountered:
ProcessExecutionFailure: Process 'Building pytest_runner.pex' failed with exit code 1.
stdout:
stderr:
Failed to resolve requirements from PEX environment @ /home/marcelo/.cache/pants/named_caches/pex_root/unzipped_pexes/c7d8fc40ba3f3ee9dda9538e11bcfa4f1046db26.
Needed cp37-cp37m-manylinux_2_31_x86_64 compatible dependencies for:
1: httptools>=0.5.0
Required by:
uvicorn-trailers 0.0.0
But this pex had no ProjectName(raw='httptools', normalized='httptools') distributions.
2: uvicorn>=0.19.0
Required by:
uvicorn-trailers 0.0.0
But this pex had no ProjectName(raw='uvicorn', normalized='uvicorn') distributions.
🤔bright-pilot-85305
11/12/2022, 12:24 AMshy-advantage-49800
11/12/2022, 8:24 AMshy-advantage-49800
11/12/2022, 9:24 AMpyproject.toml
and python_distribution
, any feedback on this https://github.com/Kludex/uvicorn-extensions?shy-advantage-49800
11/12/2022, 1:57 PMshy-advantage-49800
11/12/2022, 2:00 PMpyproject.toml
, the tests works anyway ... 🤔 Can't pants make sure that I've included them in the METADATA
or something like that?shy-advantage-49800
11/12/2022, 2:07 PMclever-crayon-70731
11/13/2022, 11:24 AMstubs
directory.
I have a line like mypy_path = $MYPY_CONFIG_FILE_DIR/stubs
in my config file and when I run MyPy by itself, then it uses them.
However, when I run pants check
then it does not.
Pants is definitely using the same MyPy config file, though.
Does anyone happen to have any ideas on how to track down the cause?clever-crayon-70731
11/13/2022, 11:25 AMshy-advantage-49800
11/13/2022, 5:42 PMpyproject.toml
to set the configuration for flake8
. I'm unable. Even changing the config = "pyproject.toml
, and adding extra_requirements.add = ["Flake8-pyproject"]
doesn't let me do that. 😢rhythmic-morning-87313
11/13/2022, 7:03 PMpants_requirements
from the pants.backend.plugin_development
backend causes failure on ./pants-local export ::
(where pants itself is built from source) because there is no binary wheel for Linux aarch64. Is it possible to make it to look at the source directory that it is built from?
18:53:32.67 [ERROR] 1 Exception encountered:
ProcessExecutionFailure: Process 'Building 2 requirements for requirements.pex from the tools/pants-plugins.lock resolve: pantsbuild.pants.testutil<2.15,>=2.14.0a0, pantsbuild.pants<2.15,>=2.14.0a0' failed with exit code 1.
stdout:
stderr:
Failed to resolve compatible artifacts from lock tools/pants-plugins.lock for 1 target:
1. /home/joongi/.pyenv/versions/3.9.10/bin/python3.9:
Failed to resolve all requirements for cp39-cp39-manylinux_2_31_aarch64 interpreter at /home/joongi/.pyenv/versions/3.9.10/bin/python3.9 from tools/pants-plugins.lock:
Configured with:
build: True
use_wheel: True
Dependency on pantsbuild-pants not satisfied, 1 incompatible candidate found:
1.) pantsbuild-pants 2.14 does not have any compatible artifacts:
<https://files.pythonhosted.org/packages/71/bc/6662a9cc8cff3e2d4a116d33859c98c3295f45e93189096ca84b6f554a45/pantsbuild.pants-2.14.0-cp39-cp39-manylinux2014_x86_64.whl>
<https://files.pythonhosted.org/packages/4e/fe/f46438d974b4d19b32728f3823f63ae05397ee7da064d9c2284272f351bc/pantsbuild.pants-2.14.0-cp38-cp38-manylinux2014_x86_64.whl>
<https://files.pythonhosted.org/packages/65/4b/959230b5a72b177c1ef2c9dc6bdb7214fb429b39d694c7c85363bde4814f/pantsbuild.pants-2.14.0-cp37-cp37m-manylinux2014_x86_64.whl>
<https://files.pythonhosted.org/packages/68/48/b8df6c443d06187663b27d4e88c8ef8b1ba2916e225c78ab1b4b032c7072/pantsbuild.pants-2.14.0-cp39-cp39-macosx_10_16_x86_64.whl>
<https://files.pythonhosted.org/packages/68/71/50d1567ce077b3dc8acf0d9a11e8878ece1d031f3bd432412da558381cd7/pantsbuild.pants-2.14.0-cp38-cp38-macosx_11_0_x86_64.whl>
<https://files.pythonhosted.org/packages/80/f9/f485c7a71d2adc937620c0d61fc4818da5ac92b968f6ea5dbffe280f29b7/pantsbuild.pants-2.14.0-cp39-cp39-macosx_11_0_arm64.whl>
<https://files.pythonhosted.org/packages/92/6c/bd8b17ff1df4931ea0358c2475307f22259461df8f96a92db85ab8809c9c/pantsbuild.pants-2.14.0-cp37-cp37m-macosx_10_16_x86_64.whl>
<https://files.pythonhosted.org/packages/9b/e9/c00b331432f789bfb8c10b5489f19245edaf8ba9c5140cc5584530fded5c/pantsbuild.pants-2.14.0-cp39-cp39-macosx_10_15_x86_64.whl>
<https://files.pythonhosted.org/packages/b6/f0/c3bb663441bf2dc30846690396a858c021a1fb02a4fa4c85af0f66cc041e/pantsbuild.pants-2.14.0-cp37-cp37m-macosx_10_15_x86_64.whl>
<https://files.pythonhosted.org/packages/db/2d/3319dc26b7d372bbc3ddd096222613b36ba7fc428c4ba14ee012c0e700b9/pantsbuild.pants-2.14.0-cp38-cp38-macosx_10_15_x86_64.whl>
requirers:
via: pantsbuild.pants<2.15,>=2.14.0a0
via: pantsbuild.pants.testutil<2.15,>=2.14.0a0 -> pantsbuild.pants==2.14.0