how do i use poetry for custom lockfiles for tools...
# general
b
how do i use poetry for custom lockfiles for tools? checked https://www.pantsbuild.org/2.20/docs/python/overview/lockfiles#lockfiles-for-tools already
i noticed my tooling was giving different errors with normal dev env and pants, and with keep-sandboxes i saw pants was using ruff=0.2.1 and a different version of pyright
I added the following to my pants.toml:
Copy code
[python]
enable_resolves = true
default_resolve = "poetry"
interpreter_constraints = ["==3.10.*"]

[python.resolves]
poetry = "python/path/to/poetry.lock"

[ruff]
install_from_resolve = "poetry"

[pyright]
install_from_resolve = "poetry"
and got
ValueError: Invalid requirement '[[package]]' in python/path/to/poetry.lock at line 3: Parse error at "'[[packag'": Expected W:(0-9A-Za-z)
s
pants can't read poetry.lock, it only works with it's own lockfile. You need to create it with
pants generate-lockfiles
b
thanks, i generated
3rdparty/python/default.lock
Copy code
[python]
enable_resolves = true
interpreter_constraints = ["==3.10.*"]

[python.resolves]
python-default = "3rdparty/python/default.lock"

[ruff]
install_from_resolve = "python-default"

[pyright]
install_from_resolve = "python-default"
but getting
Copy code
Engine traceback:
  in `check` goal

ValueError: python-default is not a named NodeJS resolve. This project contains no resolves.
s
Lockfiles for different languages are not compatible, pyright is written in JavaScript
😅 1