quick-iron-62162
11/17/2022, 3:10 PMpyproject.toml
the following:
exclude = '''
/(
| \.git
| \.mypy_cache
| \.venv
| migrations
| protos
)/
'''
but running ./pants lint ::
it does not skip them (while running black .
it does).
We also tried writing the following in the root BUILD file:
python_sources(
name="migrations",
skip_black=True,
sources=["**/migrations/*.py"]
)
but it didn’t work.
We know we can put the skip_black=True
in each of the BUILD
files inside all migrations
folders but this would require us to add it every time we have a new migrations
folder, which is a bit of a pain.
Can you help us?purple-umbrella-89891
11/17/2022, 3:44 PMpants.toml
so that e.g. pytest
uses the python-default.lock
file and I get an error because the lockfile includes more packages, although there are no conflicts. Setting --python-invalid-lockfile-behavior=ignore
does work, but it would miss any conflicts or missing packages.
Any good/elegant ideas getting around this?
PS. Here is the error:
16:21:43.92 [ERROR] 1 Exception encountered:
InvalidLockfileError: You are using the lockfile at pants.lock to install the tool `pytest`, but it is not compatible with your configuration:
- You have set different requirements than those used to generate the lockfile. You can fix this by updating `[pytest].version` and/or `[pytest].extra_requirements`, or by using a new custom lockfile.
In the lockfile, but not in the input requirements: [...lots of unrelated dependencies...]
To regenerate your lockfile based on your current configuration, run `./pants generate-lockfiles --resolve=pytest`.
refined-addition-53644
11/17/2022, 4:09 PMERROR [deps 4/4] RUN PEX_TOOLS=1 /usr/local/bin/python3.9 ./infra_plan_batch_job.pex venv --scope=deps --compile ./infra_plan_batch_job
------
> [deps 4/4] RUN PEX_TOOLS=1 /usr/local/bin/python3.9 ./infra_plan_batch_job.pex venv --scope=deps --compile ./infra_plan_batch_job:
#19 33.66 received exit code 1 during execution of `['/usr/local/bin/python3.9', '-s', '-E', '-m', 'compileall', './infra_plan_batch_job']` while trying to execute `['/usr/local/bin/python3.9', '-s', '-E', '-m', 'compileall', './infra_plan_batch_job']`
------
executor failed running [/bin/sh -c PEX_TOOLS=1 /usr/local/bin/python3.9 ./infra_plan_batch_job.pex venv --scope=deps --compile ./infra_plan_batch_job]: exit code: 1
It’s inspired from this
https://pex.readthedocs.io/en/latest/recipes.html#pex-app-in-a-containerclever-gigabyte-29368
11/17/2022, 5:12 PMpip install
to install the problematic libraries with no issue. Any suggestions?
ERROR: Could not find a version that satisfies the requirement omniduct==1.1.17
ERROR: No matching distribution found for omniduct==1.1.17
pex.environment.ResolveError: Failed to resolve requirements from PEX environment @ /Users/user.name/.pex/unzipped_pexes/402fc598cf404ed654017be0d7c53443d79fa859.
Needed macosx_13_0_x86_64-cp-37-cp37m compatible dependencies for:
1: importlib-metadata>=0.12; python_version < "3.8"
Required by:
FingerprintedDistribution(distribution=virtualenv 20.4.7 (/Users/kennethdai/.pex/installed_wheels/bb8d0ead30325881e415ac3e7cbc9080574690a5/virtualenv-20.4.7-py2.py3-none-any.whl), fingerprint='eeaf01de2c4bc1e22cee1a14fd3358ca9251c0c2')
But this pex had no 'importlib-metadata' distributions.
happy-kitchen-89482
11/17/2022, 5:20 PMclever-gigabyte-29368
11/17/2022, 5:22 PMclever-gigabyte-29368
11/17/2022, 5:22 PMfaint-waitress-55925
11/17/2022, 5:22 PMcurved-television-6568
11/17/2022, 5:26 PMclever-gigabyte-29368
11/17/2022, 5:27 PMclever-gigabyte-29368
11/17/2022, 5:27 PMclever-gigabyte-29368
11/17/2022, 5:28 PMcurved-television-6568
11/17/2022, 5:30 PMhappy-kitchen-89482
11/17/2022, 5:30 PMclever-gigabyte-29368
11/17/2022, 5:34 PMclever-gigabyte-29368
11/17/2022, 5:34 PMNo matching distribution found for omniduct==1.1.17
is a more common problem and blocking multiple users. Could you please help?happy-kitchen-89482
11/17/2022, 5:47 PMhappy-kitchen-89482
11/17/2022, 5:59 PMclever-gigabyte-29368
11/17/2022, 6:03 PMpip install omniduct==1.1.17
works but pants complain No matching distribution found for omniduct==1.1.17
, is there a way for us to find out the difference between the two? I guess pants invokes pip under the hood, so understanding how pants exactly uses pip could be a starting point?ripe-cpu-85141
11/17/2022, 7:40 PMhappy-kitchen-89482
11/17/2022, 8:29 PMhappy-kitchen-89482
11/17/2022, 8:30 PM--no-process-cleanup
, that will keep the sandbox directories, so you can cd into them and see more detailshappy-kitchen-89482
11/17/2022, 8:33 PMhappy-kitchen-89482
11/17/2022, 8:38 PMcold-vr-15232
11/17/2022, 9:03 PMrich-london-74860
11/17/2022, 9:44 PM./pants dependencies --filter-target-type=<target_type> <some_target>
applies the filter to some_target
, not the list of dependencies, which I find very unintuitive.
For example, in directory db/sample_project_1
I have a BUILD
that looks like this:
python_sources(
name="lib",
sources=["*.py"],
dependencies=["3rdparty:dbr-9.1-reqs", "db/shared:lib"],
resolve="databricks",
tags=["model"]
)
When I call ./pants dependencies db/sample_project_1/__init__.py:lib
I get the following:
3rdparty/requirements-dbr-9.1.txt:dbr-9.1-reqs
3rdparty:dbr-9.1-reqs#boto3
3rdparty:dbr-9.1-reqs#pandas
3rdparty:dbr-9.1-reqs#scikit-learn
3rdparty:dbr-9.1-reqs#scipy
db/shared/__init__.py:lib
db/shared/config.py:lib
db/shared/runner.py:lib
db/shared:reqs#request
db/notebook_utils/__init__.py:lib
which is what I expect.
If I do ./pants dependencies db/sample_project_1/__init__.py:lib --filter-target-type="python_source"
, then I get the exact same output.
If I do ./pants dependencies db/sample_project_1/__init__.py:lib --filter-target-type="python_requirement"
, then I get nothing.
It appears that this is because db/sample_project_1/__init__.py:lib
itself is a python_source
I can see how this behavior might be expected if the goal is to filter targets from a glob (e.g. only get dependencies for python_source
in ::
), but it seems rather unintuitive to me.
The question I want to answer here is: “which of this files dependencies are 3rd party requirements vs other sources” and it looks like the best way to do that is something like:
./pants list --filter-target-type=python_requirement $(./pants dependencies db/sample_project_1/__init__.py:lib | tr '\n' ' ')
On a related note, it would be really nice if it was possible to use --output-file
in append-mode.clever-gigabyte-29368
11/17/2022, 11:08 PMno matching distribution found for pantsbuild.pants=2.13.0
clever-gigabyte-29368
11/17/2022, 11:08 PMPants is running pex, which runs pip 20.3.4 under the hoodis that codified somewhere?
happy-kitchen-89482
11/17/2022, 11:23 PMhappy-kitchen-89482
11/17/2022, 11:24 PM-ldebug
and post as much relevant debug info as possible