Skip to main content
Version: 2.18.x

pants_requirements


Generate python_requirement targets for Pants itself to use with Pants plugins.

This is useful when writing plugins so that you can build and test your plugin using Pants.

The generated targets will have the correct version based on the exact version in your pants.toml, and they will work with dependency inference. They're pulled directly from our GitHub releases, using the relevant platform markers.

(If this versioning scheme does not work for you, you can directly create python_requirement targets for pantsbuild.pants and pantsbuild.pants.testutil. We also invite you to share your ideas at https://github.com/pantsbuild/pants/issues/new/choose)

Backend: pants.backend.plugin_development


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.

version_spec

field.type_hint
default: '== 2.18.0rc5'

The PEP 440 version specifier version of Pants to target. E.g. == 2.15.*, or >= 2.16.0, < 2.17.0

testutil

field.type_hint
default: True

If true, include pantsbuild.pants.testutil to write tests for your plugin.

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.