Skip to main content
Version: 2.16.x (deprecated)

poetry_requirements


Generate a python_requirement for each entry in a Poetry pyproject.toml.

Backend: pants.backend.python


tags

field.type_hint
required

Arbitrary strings to describe a target.

For example, you may tag some test targets with 'integration_test' so that you could run scie-pants-linux-x86_64 --tag='integration_test' test :: to only run on targets with that tag.

description

field.type_hint
required

A human-readable description of the target.

Use scie-pants-linux-x86_64 list --documented :: to see all targets with descriptions.

module_mapping

field.type_hint
default: FrozenDict({})

A mapping of requirement names to a list of the modules they provide.

For example, {"ansicolors": ["colors"]}.

Any unspecified requirements will use a default. See the modules field from the python_requirement target for more information.

type_stubs_module_mapping

field.type_hint
default: FrozenDict({})

A mapping of type-stub requirement names to a list of the modules they provide.

For example, {"types-requests": ["requests"]}.

If the requirement is not specified and its name looks like a type stub, Pants will use a default. See the type_stub_modules field from the python_requirement target for more information.

source

field.type_hint
default: 'pyproject.toml'

A single file that belongs to this target.

Path is relative to the BUILD file's directory, e.g. source='example.ext'.

overrides

field.type_hint
required

Override the field values for generated python_requirement targets.

Expects a dictionary of requirements to a dictionary for the overrides. You may either use a string for a single requirement, or a string tuple for multiple requirements. Each override is a dictionary of field names to the overridden value.

For example:

overrides={
"django": {"dependencies": ["#setuptools"]]},
"ansicolors": {"description": "pretty colors"]},
("ansicolors, "django"): {"tags": ["overridden"]},
}

Every overridden requirement is validated to be generated by this target.

You can specify the same requirement in multiple keys, so long as you don't override the same field more than one time for the requirement.

resolve

field.type_hint
required

The resolve from [python].resolves that this requirement is included in.

If not defined, will default to [python].default_resolve.

When generating a lockfile for a particular resolve via the generate-lockfiles goal, it will include all requirements that are declared with that resolve. First-party targets like python_source and pex_binary then declare which resolve they use via their resolve field; so, for your first-party code to use a particular python_requirement target, that requirement must be included in the resolve used by that code.