Hi Guys, I want do the following, tell me if it’s ...
# development
h
Hi Guys, I want do the following, tell me if it’s possible, I want to create a custom rule named
poetry_requirements_from_lock
that parses the
poetry.lock
file and generates
python_requirement_library
, I couldn’t find any documentation on how to do that. Is this API exported?
h
Hey. @hundreds-father-404 is the expert here, but the "Writing Plugins" docs, starting at https://www.pantsbuild.org/docs/plugins-overview should be helpful?
Can you explain more about what your goal is? Typically we wouldn't generate
python_requirement_library
from a lockfile because the lockfile contains the entire transitive dependency graph, whereas typically you only want
python_requirement_library
targets for the requirements you're allowed to depend on directly - and we already generate those from either
requirements.txt
or from Poetry's
dependencies
in
pyproject.toml
In other words, we distinguish between "these are the direct requirements by code needs" and "this is the transitive dependency closure of those direct requirements" - typically you don't need (or even want) people directly depending on things in the latter that are not in the former. But it sounds like your case is different?
👍 1
c
Regarding using the poetry dependencies from a
pyproject.toml
: https://www.pantsbuild.org/v2.7/docs/python-third-party-dependencies#poetry-integration
👍 1