Hello guys, We're trying to integrate pantsbuild f...
# general
s
Hello guys, We're trying to integrate pantsbuild for one of our data projects (Using pyspark). The project already uses poetry, and I'm trying to create pants lockfile from the existing poetry lockfile. But somehow, pants cannot parse the lockfile and I get this error after I run:
Copy code
pants generate-lockfiles
ValueError: Invalid requirement '[[package]]' in poetry.lock at line 3: Parse error at "'[[packag'": Expected W:(0-9A-Za-z)
My configuration is as follows: pants.toml
Copy code
[GLOBAL]
pants_version = "2.24.0"
backend_packages = [
    "pants.backend.python",
    "pants.backend.experimental.python",
    "pants.backend.experimental.python.lint.ruff.check",
    "pants.backend.experimental.python.lint.ruff.format",
]

[source]
root_patterns = ["/"]

[python]
interpreter_constraints = [">=3.10"]
default_resolve = "poetry"
enable_resolves = true

[python.resolves]
poetry = "poetry.lock"

[python-infer]
imports = true
string_imports = true

[python-repos]
indexes = [
    "<https://nexus.company.org/repository/pypi-group/simple>",
    "<https://pypi.org/simple>",
]
BUILD file at the top level of project:
Copy code
poetry_requirements(
    name="poetry",
)
And my poetry.lock file starts like this:
Copy code
[[package]]
name = "altair"
version = "4.2.2"
description = "Altair: A declarative statistical visualization library for Python."
optional = false
python-versions = ">=3.7"
files = [
    {file = "altair-4.2.2-py3-none-any.whl", hash = "sha256:8b45ebeaf8557f2d760c5c77b79f02ae12aee7c46c27c06014febab6f849bc87"},
    {file = "altair-4.2.2.tar.gz", hash = "sha256:39399a267c49b30d102c10411e67ab26374156a84b1aeb9fcd15140429ba49c5"},
]

[package.dependencies]
..........
........
Did you experience this parse error issue? Thx in advance!
r
pants doesn't support
poetry.lock
. You will either have to write your own plugin or switch to pants supported lockfile https://www.pantsbuild.org/2.23/docs/python/overview/lockfiles
h
Pants can generate its own lockfile from poetry requirements, but it doesn’t use an existing poetry lockfile
s
Ah OK, thank you guys. I somehow assumed poetry lock would also work. Now able to create the pants lock file thank you!