Skip to main content
Version: 2.5 (deprecated)

python-infer


Options controlling which dependencies will be inferred for Python targets.

Backend: ``

Config section: [python-infer]

Basic options

conftests

--[no-]python-infer-conftests
PANTS_PYTHON_INFER_CONFTESTS
pants.toml
[python-infer]
conftests = <bool>
default: True

Infer a test target's dependencies on any conftest.py files in the current directory and ancestor directories.

entry_points

--[no-]python-infer-entry-points
PANTS_PYTHON_INFER_ENTRY_POINTS
pants.toml
[python-infer]
entry_points = <bool>
default: True

Infer dependencies on binary targets' entry points, e.g. pex_binary's entry_point field and python_awslambda's handler field.

imports

--[no-]python-infer-imports
PANTS_PYTHON_INFER_IMPORTS
pants.toml
[python-infer]
imports = <bool>
default: True

Infer a target's imported dependencies by parsing import statements from sources.

inits

--[no-]python-infer-inits
PANTS_PYTHON_INFER_INITS
pants.toml
[python-infer]
inits = <bool>
default: False

Infer a target's dependencies on any init.py files existing for the packages it is located in (recursively upward in the directory structure).

Even if this is disabled, Pants will still include any ancestor init.py files, only they will not be 'proper' dependencies, e.g. they will not show up in ./pants dependencies and their own dependencies will not be used.

If you have empty __init__.py files, it's safe to leave this option off; otherwise, you should enable this option.

string_imports

--[no-]python-infer-string-imports
PANTS_PYTHON_INFER_STRING_IMPORTS
pants.toml
[python-infer]
string_imports = <bool>
default: False

Infer a target's dependencies based on strings that look like dynamic dependencies, such as Django settings files expressing dependencies as strings. To ignore any false positives, put !{bad_address} in the dependencies field of your target.

Advanced options

None

Deprecated options

None

None