dazzling-elephant-33766
03/07/2024, 5:46 PMapp.py
import requests
print(requests.__version__)
pyproject.toml
[project]
name = 'test'
dependencies = [
'requests',
'types-requests',
]
BUILD
python_requirements(
name="root",
source="pyproject.toml",
)
python_sources(
name="0",
)
pex_binary(
name="app",
entry_point="app.py",
layout="loose",
)
➜ pants dependencies --transitive app.py
//:root#requests
//:root#types-requests
//pyproject.toml:root
Looking inside the outputted pex binary types-requests
is packaged, (also in dist/app.pex/.deps
)
jq .requirements dist/app.pex/PEX-INFO
[
"requests",
"types-requests"
]
The types aren’t required at all at runtime, only for the mypy
type checking.broad-processor-92400
03/07/2024, 6:31 PM!!
. See https://www.pantsbuild.org/2.19/docs/using-pants/key-concepts/targets-and-build-files#dependencies-field “ignore dependencies” section