https://pantsbuild.org/ logo
#general
Title
# general
p

polite-angle-19513

08/06/2021, 9:45 PM
Good Friday all! I'm using poetry for module management. I've placed poetry_requirements() in the projects BUILD. From the digging I've done this is to effectively create a python_requirement_library inline from the tool.poetry.dependencies entries. What I'm getting however is incomplete. Given [tool.poetry.dependencies] backoff = ">=1.10.0" boto3 = ">=1.18.11" botocore = ">=1.21.11" Running ~mondo$ ./pants -ldebug --pex-verbosity=4 package src/python/hank_ai_aws:dist Expected Wheel METADATA ... Classifier: Typing :: Typed Requires-Dist: backoff (>=1.10.0") Requires-Dist: boto3 (>=1.18.11) Requires-Dist: botocore (>=1.21.11) Requires-Dist: hank-ai-lib (==0.0.1) this is a first party module Actual Wheel METADATA ... Classifier: Typing :: Typed Requires-Dist: boto3 (>=1.18.11) Requires-Dist: hank-ai-lib (==0.0.1) Gist Debug Output Looking in the output I don't see any references to python_requirement_library nor poetry_requirements. https://gist.github.com/james-crocker/b1ec7fe1f2f837f3a1a336a2e2f6c2b4 Thank you for your time.
h

hundreds-father-404

08/06/2021, 11:06 PM
Hey James, couple things you can try: •
./pants list ::
to see all targets in your project, including what is created by the macro •
./pants dependencies --transitive path/to:python_distribution_tgt
to see what will get included in it I suspect what's happening is
botocore
is a transitive dep of
boto3
and it's not being imported directly? That would be confirmed by it not showing up in
dependencies
output. If that's the case, and you still want the dep in your generated wheel, you can explicitly add
//:botocore
to the
dependencies
field of the
python_distribution
p

polite-angle-19513

08/09/2021, 11:51 AM
Hello, thanks for the assist. Here are the results. ./pants list :: src/python/hank_ai_aws src/python/hank_ai_aws:backoff src/python/hank_ai_aws:black src/python/hank_ai_aws:boto3 src/python/hank_ai_aws:botocore src/python/hank_ai_aws:dist src/python/hank_ai_aws:loguru src/python/hank_ai_aws:mypy src/python/hank_ai_aws:pip src/python/hank_ai_aws:pylint src/python/hank_ai_aws:pyproject.toml src/python/hank_ai_aws:pytest src/python/hank_ai_aws:tqdm src/python/hank_ai_aws/aws
./pants dependencies --transitive src/python/hank_ai_aws src/python/hank_ai_aws/aws/codeartifact.py src/python/hank_ai_aws/aws/configure.py src/python/hank_ai_aws/aws/ec2_auto_scaling.py src/python/hank_ai_aws/aws/elastic_container_registry.py src/python/hank_ai_aws/aws/elastic_container_service.py src/python/hank_ai_aws/aws/session_client_resource.py src/python/hank_ai_aws/aws/simple_queue_service.py (contains import backoff) src/python/hank_ai_aws/base.py src/python/hank_ai_aws:boto3 src/python/hank_ai_aws:pyproject.toml src/python/hank_ai_core/sys_utils.py
pyproject.toml [tool.poetry.dependencies] backoff = ">=1.10.0" boto3 = ">=1.18.11" botocore = ">=1.21.11" loguru = ">=0.5.3" python = "^3.8" tqdm = ">=4.62.0" [tool.poetry.dev-dependencies] black = ">=21.7b0" mypy = ">=0.910" pip = ">=21.2.2" # pkg_resources = ">=0.0.0" pylint = ">=2.9.6" pytest = ">=6.2.4"
src/python/hank_ai_aws/BUILD poetry_requirements() python_library( interpreter_constraints=[">=3.8"], ) python_distribution( name="dist", dependencies=[ ":hank_ai_aws", ], provides=setup_py( name="hank-ai-aws", version="0.0.1", description="Hank AI AWS resource support for Hank AI projects.", long_description_path="README.md", url="https://github.com/aws-codeartifact/src/python/hank-ai-aws/", download_url="https://aws:$CODEARTIFACT_AUTH_TOKEN@hank-ai-dev-531771080719.d.codeartifact.us-east-1.amazonaws.com/pypi/hank-ai-dev/simple/hank-ai-aws", author="Hank AI, Inc.", author_email="sysadmin@hank.ai", license="MIT", platforms=[ "any", ], classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Other Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries :: Python Modules", "Typing :: Typed", ], ), setup_py_commands=["bdist_wheel", "--python-tag", "py38"], )
src/python/hank_ai_aws/aws/BUILD python_library()
h

hundreds-father-404

08/12/2021, 11:02 PM
Sorry for my delay in looking at this @polite-angle-19513! It looks like Pants is indeed creating the
python_requirement_library
targets for
botocore
, which you can see when running
./pants list ::
But, that is not being seen as a "direct dependency" of your code because I imagine you're not importing it? You can force it to be a direct dep by adding to the
dependencies
field of whatever
python_library
is using it, Something like:
Copy code
python_library(dependencies=['src/python/hank_ai_aws:botocore'])