Skip to main content
Version: 2.24 (prerelease)

python-thrift


Options specific to generating Python from Thrift using Apache Thrift

Backend: pants.backend.codegen.thrift.apache.python

Config section: [python-thrift]

Basic options

options

--python-thrift-options="['<str>', '<str>', ...]"
PANTS_PYTHON_THRIFT_OPTIONS
pants.toml
[python-thrift]
options = [
'<str>',
'<str>',
...,
]
default: []

Code generation options specific to the Python code generator to pass to the Apache thrift binary via the -gen py argument. See thrift -help for supported values.

Advanced options

infer_runtime_dependency

--[no-]python-thrift-infer-runtime-dependency
PANTS_PYTHON_THRIFT_INFER_RUNTIME_DEPENDENCY
pants.toml
[python-thrift]
infer_runtime_dependency = <bool>
default: True

If True, will add a dependency on a python_requirement target exposing the thrift module (usually from the thrift requirement).

If [python].enable_resolves is set, Pants will only infer dependencies on python_requirement targets that use the same resolve as the particular thrift_source / thrift_source target uses, which is set via its python_resolve field.

Unless this option is disabled, Pants will error if no relevant target is found or more than one is found which causes ambiguity.

Deprecated options

None

None