wide-zoo-86070
03/30/2022, 6:10 PMdependencies:
- python=3.9.5
My question is, to use pants, do I have to put interpreter_constraints = [“==3.9.*“]. Or I can put interpreter_constraints = [“>=3.6.*“] (for example). I guess, my question becomes, when pants run my codes, will it get (somehow : ) ) python39 instead of python36? If yes, how to make it do it? or it wont, it will just use the interpreter it found.echoing-farmer-15630
03/30/2022, 7:33 PMstderr:
ERROR: Package 'aiofiles' requires a different Python: 3.10.2 not in '<4.0,>=3.6'
...neither of which makes sense to me (it shouldn't be resolving with 3.10, and 3.10.2 is in fact between 3.6 and 4.0...)hundreds-father-404
03/30/2022, 7:36 PMechoing-farmer-15630
03/30/2022, 7:41 PMechoing-farmer-15630
03/30/2022, 7:42 PMechoing-farmer-15630
03/30/2022, 7:46 PMProcess 'Generate lockfile for python-default' failed with exit code 1.
echoing-farmer-15630
03/30/2022, 7:47 PM/tmp/process-executionKTQOsz for "Generate lockfile for python-default"
echoing-farmer-15630
03/30/2022, 7:49 PM/tmp/process-executionKTQOsz
❯ grep python __run.sh
/home/vputz/.pyenv/versions/3.10.2/bin/python ./pex --tmpdir .tmp lock ...
happy-kitchen-89482
03/30/2022, 7:54 PMhappy-kitchen-89482
03/30/2022, 7:54 PMhundreds-father-404
03/30/2022, 8:01 PMechoing-farmer-15630
03/30/2022, 8:41 PMinterpreter_constraints
is ["CPython==3.9.*"]
, resolves_to_interpreter_constraints="{'python-default': ['==3.9.*']}"
, and yet trying
./pants --no-process-cleanup generate-lockfiles --generate-lockfiles-resolve="['python-default']"
...gets me that ERROR: Package 'aiofiles' requires a different Python: 3.10.2 not in '<4.0,>=3.6'
error.
The resulting execution still referenced something in my ~/.cache/pants directory so I nuked that, ./.pants.d
and .pids
and started from scratch.... same thing.
Weird. I'll try it with rc1 tomorrow (late over here). Very strange.busy-vase-39202
03/30/2022, 11:11 PMfreezing-area-97131
03/31/2022, 3:13 AM[WARN] /home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.23.0_py36/lib/python3.6/site-packages/pex/pep425tags.py:274: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
**** Failed to install importlib_metadata-4.11.3 (caused by: NonZeroExit("received exit code 1 during execution of `['/usr/bin/python2.7', '-s', '-', 'bdist_wheel', '--dist-dir=/tmp/tmpwfro9psz']` while trying to execute `['/usr/bin/python2.7', '-s', '-', 'bdist_wheel', '--dist-dir=/tmp/tmpwfro9psz']`",)
):
stdout:
stderr:
Traceback (most recent call last):
File "<stdin>", line 13, in <module>
IOError: [Errno 2] No such file or directory: 'setup.py'
Thanks @happy-kitchen-89482 for pointing out I should fix the importlib-metadata
version to 2.1.3
. But I don’t know which package depends on it. How do I pin the version? I added importlib-metadata==2.1.3
in requirement.txt, but it did not work.rapid-exabyte-76685
03/31/2022, 7:28 AMlist
to show the tags that have been applied to targets/files?ambitious-actor-36781
03/31/2022, 8:46 PMpackage
rapid-exabyte-76685
04/01/2022, 1:49 AMpython_tests
in the directory that has the tests in question... 🧵
python_tests(
name="test",
source=[
"test_*.py",
"!test_that_is_deadlocking1.py",
"!test_that_is_deadlocking2.py"
]
)
python_tests(
name="deadlocking_tests",
source=[
"test_that_is_deadlocking1.py",
"test_that_is_deadlocking2.py"
]
)
freezing-area-97131
04/01/2022, 5:48 AM1.23.0
.
./pants --version
works fine, and also ./pants test ...
works fine.
But I encountered a weird bug. I found out that some of my unit tests got run twice, and that caused error.
The folder structure has a __init__.py
and the BUILD
file is like this:
python_tests(
name='xxxxx',
sources=globs('*.py'),
dependencies=[ ... ],
)
I guess that’s why the same file get run two times.
And due to some cache or memory issue, the variables in the first run were not cleaned up, so when the second run start, the value was not as expected, so the assertion failed.
This didn’t happen in previous version. Is it due to some upgrade issue?
I fixed it by deleting the __init__.py
file, but I then thought modify BUILD
file might work as well (?echoing-farmer-15630
04/01/2022, 9:49 AM1976.7s Generate lockfile for python-default
I eventually gave up after those 30 minutes and took out lockfile_generator="pex"
and poetry spit out a 212k lockfile in 25 sec.
Admittedly I have a pretty unclean setup (I'm trying to generate requirements from what was my old constraints.txt file, which represents a pip freeze
of the project, so it's sort of generating a lockfile from a lockfile). But that difference was pretty striking and if the new pex-based JSON-style lockfiles are faster to use after generation, I'd love to make the switch. Any suggestions as to what may be going on?freezing-area-97131
04/01/2022, 10:53 AM1.25.0
, and got this error when running ./pants test …
. How do I find out which packages cause this conflict?
Exception message: Could not satisfy all requirements for pytest<4.7,>=4.6.6:
pytest<4.7,>=4.6.6, pytest<5.4,>=5.3.5
little-easter-51691
04/01/2022, 3:21 PMwide-zoo-86070
04/01/2022, 3:33 PMproject_a/test_helloworld/unit/translator_test.py succeeded in 0.61s (cached locally).
sometime it is
project_a/test_helloworld/unit/translator_test.py succeeded in 0.61s (memoized).
high-yak-85899
04/01/2022, 5:46 PMrapid-exabyte-76685
04/02/2022, 6:47 AMHOME/.cache/pants/
cache directories? 🧵billions-bear-56484
04/02/2022, 2:40 PMpex_binary(
name="alembic",
script="alembic",
dependencies=[
":alembic_requirements",
],
)
My goal is to have something like this:
pex_binary(
name="makemigrations",
script="alembic -n accounts revision --autogenerate",
// or entry_point="alembic -n accounts revision --autogenerate",
dependencies=[
":alembic_requirements",
],
)
Thanks and have a great weekend 🎉freezing-area-97131
04/03/2022, 7:11 PM./pants --version
works fine, but when I build my binary, I encounter this error:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python2.7 /tmp/tmp35l8p0cf/.deps/pip/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpPhYaZM
cwd: /tmp/pip-download-Ku1TIN/gevent
Complete output (10 lines):
Traceback (most recent call last):
File "/tmp/tmp35l8p0cf/.deps/pip/pip/_vendor/pep517/_in_process.py", line 257, in <module>
main()
File "/tmp/tmp35l8p0cf/.deps/pip/pip/_vendor/pep517/_in_process.py", line 240, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/tmp/tmp35l8p0cf/.deps/pip/pip/_vendor/pep517/_in_process.py", line 85, in get_requires_for_build_wheel
backend = _build_backend()
File "/tmp/tmp35l8p0cf/.deps/pip/pip/_vendor/pep517/_in_process.py", line 76, in _build_backend
obj = getattr(obj, path_part)
AttributeError: 'module' object has no attribute '__legacy__'
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2.7 /tmp/tmp35l8p0cf/.deps/pip/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpPhYaZM Check the logs for full command output.
19:05:57 [DEBUG] pants.process.lock:pid=7609: releasing lock: <pants.process.lock.OwnerPrintingInterProcessFileLock object at 0x7d76780ecd68>
Waiting for background workers to finish.
12:05:57 00:32 [complete]
FAILURE
timestamp: 2022-04-03T12:05:57.308688
Exception caught: (pex.resolver.Unsatisfiable)
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/bin/pants", line 8, in <module>
sys.exit(main())
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/pants_loader.py", line 94, in main
PantsLoader.run()
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/pants_loader.py", line 90, in run
cls.load_and_execute(entrypoint)
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/pants_loader.py", line 83, in load_and_execute
entrypoint_main()
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/pants_exe.py", line 32, in main
PantsRunner(start_time=start_time).run()
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/pants_runner.py", line 115, in run
return runner.run()
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/local_pants_runner.py", line 293, in run
self._run()
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/local_pants_runner.py", line 389, in _run
goal_runner_result = self._maybe_run_v1()
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/local_pants_runner.py", line 330, in _maybe_run_v1
self._exiter,
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/goal_runner.py", line 230, in run
return self._run_goals()
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/goal_runner.py", line 201, in _run_goals
result = self._execute_engine()
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/bin/goal_runner.py", line 189, in _execute_engine
result = engine.execute(self._context, self._goals)
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/engine/legacy_engine.py", line 21, in execute
self.attempt(context, goals)
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/engine/round_engine.py", line 252, in attempt
goal_executor.attempt(explain)
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/engine/round_engine.py", line 50, in attempt
task.execute()
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/backend/python/tasks/resolve_requirements.py", line 29, in execute
pex = self.resolve_requirements(interpreter, self.context.targets(has_python_requirements))
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/backend/python/tasks/resolve_requirements_task_base.py", line 96, in resolve_requirements
pex_builder.add_requirement_libs_from(req_libs, platforms=platforms)
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/python/pex_build_util.py", line 202, in add_requirement_libs_from
self.add_resolved_requirements(reqs, platforms=platforms)
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/python/pex_build_util.py", line 275, in add_resolved_requirements
distributions = self.resolve_distributions(reqs, platforms=platforms)
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/python/pex_build_util.py", line 251, in resolve_distributions
self._builder.interpreter, list(deduped_reqs), platforms, list(find_links),
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pants/python/pex_build_util.py", line 339, in _resolve_multi
manylinux=python_setup.manylinux,
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pex/resolver.py", line 722, in resolve
return list(resolve_request.resolve_distributions(ignore_errors=ignore_errors))
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pex/resolver.py", line 521, in resolve_distributions
raise_type=Unsatisfiable):
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pex/resolver.py", line 392, in _run_parallel
max_jobs=self._max_parallel_jobs
File "/home/cedriczheng/.cache/pants/setup/bootstrap-Linux-x86_64/1.26.0_py37/lib/python3.7/site-packages/pex/jobs.py", line 219, in execute_parallel
raise error
Looks like a python2 syntax error again, though I have no idea how to fix this. Thanks!rapid-exabyte-76685
04/04/2022, 5:30 AMrefined-addition-53644
04/04/2022, 9:19 AMpyproject.toml
) python projects using multiple lockfiles "resolves"? I guess the issue could be if these projects have some common third party dependencies. We have a monorepo but it contains multiple python packages generated using poetry which have their own dependencies.bitter-ability-32190
04/04/2022, 3:39 PMpip-compile
)
• An easy way to make sure the packaging is consistent and portable (pex_binary
)
◦ With macros to make this easy for devs to declare
• A consistent and portable way to invoke the tool (./pants run ...
)busy-vase-39202
04/04/2022, 4:16 PM