Last active
September 6, 2025 09:46
-
-
Save jphastings/4112cb8752085ba3469261fbf6a6f3cc to your computer and use it in GitHub Desktop.
Output from pants peek, for a lambda built with python & poetry. No details of the python runtime anywhere in `pants peek` output π
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[GLOBAL] | |
pants_version = "2.27.0" | |
backend_packages = [ | |
"pants.backend.build_files.fmt.black", | |
"pants.backend.build_files.fmt.ruff", | |
"pants.backend.python.lint.black", | |
"pants.backend.python.lint.pyupgrade", | |
"pants.backend.experimental.python.lint.ruff.check", | |
"pants.backend.experimental.python.lint.ruff.format", | |
# "pants.backend.python.lint.bandit", # TODO: figure out how to disable B101 for tests | |
"pants.backend.awslambda.python", | |
"pants.backend.python", | |
"pants.backend.experimental.adhoc", | |
] | |
[python] | |
interpreter_constraints = ["==3.13.*"] | |
enable_resolves = true | |
resolves = { python-default = "python-default.lock" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python_sources( | |
name="lambda", | |
) | |
python_aws_lambda_function( | |
handler="lambda_function.py:handler", | |
) | |
poetry_requirements( | |
name="poetry", | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tool.poetry] | |
name = "whatever" | |
version = "0.1.0" | |
package-mode = false | |
[tool.poetry.dependencies] | |
python = "^3.13" | |
boto3 = "^1.40" | |
[tool.poetry.group.dev.dependencies] | |
pytest = "^8.4" | |
black = "^25.1" | |
ruff = "^0.12" | |
[build-system] | |
requires = ["poetry-core"] | |
build-backend = "poetry.core.masonry.api" | |
[tool.ruff] | |
line-length = 88 | |
target-version = "py313" | |
[tool.black] | |
line-length = 88 | |
target-version = ["py313"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"address": "src/lambdas/whatever:whatever", | |
"target_type": "python_aws_lambda_function", | |
"architecture": "x86_64", | |
"complete_platforms": null, | |
"dependencies": [ | |
"src/lambdas/whatever/lambda_function.py:lambda" | |
], | |
"dependencies_raw": null, | |
"description": null, | |
"environment": "__local__", | |
"goals": [ | |
"package" | |
], | |
"handler": "lambda_function.py:handler", | |
"include_requirements": true, | |
"layout": "flat-zipped", | |
"output_path": "${spec_path_normalized}/${target_name_normalized}${file_suffix}", | |
"pex3_venv_create_extra_args": [], | |
"pex_build_extra_args": [], | |
"resolve": null, | |
"runtime": null, | |
"tags": null | |
}, | |
{ | |
"address": "src/lambdas/whatever:poetry#black", | |
"target_type": "python_requirement", | |
"_find_links": [], | |
"dependencies": [ | |
"//python-default.lock:_python-default_lockfile", | |
"src/lambdas/whatever/pyproject.toml:poetry" | |
], | |
"dependencies_raw": [ | |
"src/lambdas/whatever/pyproject.toml:poetry", | |
"python-default.lock:_python-default_lockfile" | |
], | |
"description": null, | |
"entry_point": null, | |
"goals": [ | |
"run" | |
], | |
"modules": null, | |
"requirements": [ | |
"black<26.0.0,>=25.1" | |
], | |
"resolve": null, | |
"tags": null, | |
"type_stub_modules": null | |
}, | |
{ | |
"address": "src/lambdas/whatever:poetry#boto3", | |
"target_type": "python_requirement", | |
"_find_links": [], | |
"dependencies": [ | |
"//python-default.lock:_python-default_lockfile", | |
"src/lambdas/whatever/pyproject.toml:poetry" | |
], | |
"dependencies_raw": [ | |
"src/lambdas/whatever/pyproject.toml:poetry", | |
"python-default.lock:_python-default_lockfile" | |
], | |
"description": null, | |
"entry_point": null, | |
"goals": [ | |
"run" | |
], | |
"modules": null, | |
"requirements": [ | |
"boto3<2.0.0,>=1.40" | |
], | |
"resolve": null, | |
"tags": null, | |
"type_stub_modules": null | |
}, | |
{ | |
"address": "src/lambdas/whatever:poetry#pytest", | |
"target_type": "python_requirement", | |
"_find_links": [], | |
"dependencies": [ | |
"//python-default.lock:_python-default_lockfile", | |
"src/lambdas/whatever/pyproject.toml:poetry" | |
], | |
"dependencies_raw": [ | |
"src/lambdas/whatever/pyproject.toml:poetry", | |
"python-default.lock:_python-default_lockfile" | |
], | |
"description": null, | |
"entry_point": null, | |
"goals": [ | |
"run" | |
], | |
"modules": null, | |
"requirements": [ | |
"pytest<9.0.0,>=8.4" | |
], | |
"resolve": null, | |
"tags": null, | |
"type_stub_modules": null | |
}, | |
{ | |
"address": "src/lambdas/whatever:poetry#ruff", | |
"target_type": "python_requirement", | |
"_find_links": [], | |
"dependencies": [ | |
"//python-default.lock:_python-default_lockfile", | |
"src/lambdas/whatever/pyproject.toml:poetry" | |
], | |
"dependencies_raw": [ | |
"src/lambdas/whatever/pyproject.toml:poetry", | |
"python-default.lock:_python-default_lockfile" | |
], | |
"description": null, | |
"entry_point": null, | |
"goals": [ | |
"run" | |
], | |
"modules": null, | |
"requirements": [ | |
"ruff<0.13.0,>=0.12" | |
], | |
"resolve": null, | |
"tags": null, | |
"type_stub_modules": null | |
}, | |
{ | |
"address": "src/lambdas/whatever/lambda_function.py:lambda", | |
"target_type": "python_source", | |
"dependencies": [ | |
"src/lambdas/whatever:poetry#boto3", | |
], | |
"dependencies_raw": null, | |
"description": null, | |
"goals": [ | |
"run" | |
], | |
"interpreter_constraints": null, | |
"resolve": null, | |
"restartable": false, | |
"run_goal_use_sandbox": null, | |
"skip_black": false, | |
"skip_pyupgrade": false, | |
"skip_ruff": false, | |
"skip_ruff_check": false, | |
"skip_ruff_format": false, | |
"source_raw": "lambda_function.py", | |
"sources": [ | |
"src/lambdas/whatever/lambda_function.py" | |
], | |
"sources_fingerprint": "f3148d1eeb8bb1bc585c405ea0e67a02ab5d08c787679b85dfa53502674b971b", | |
"tags": null | |
}, | |
{ | |
"address": "src/lambdas/whatever/pyproject.toml:poetry", | |
"target_type": "_generator_sources_helper", | |
"dependencies": [], | |
"description": null, | |
"source_raw": "pyproject.toml", | |
"sources": [ | |
"src/lambdas/whatever/pyproject.toml" | |
], | |
"sources_fingerprint": "3916c407d1e5550a83967d6ea2fc60e9b38e72c9fe5110b085d99916f3fc364c", | |
"tags": null | |
} | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is what I'd like to be able to do, pull the handler, runtime and architecture directly from the output of pants. | |
locals { | |
lambda_base = "../dist/src.lambdas.whatever/whatever" | |
lambda_config = jsondecode(file("${lambda_base}.json")) | |
} | |
resource "aws_lambda_function" "whatever_lambda" { | |
function_name = "whatever_lambda" | |
handler = local.lambda_config.handler | |
runtime = local.lambda_config.runtime | |
architectures = [local.lambda_config.architecture] | |
filename = "${lambda_base}.zip" | |
source_code_hash = filebase64sha256("${lambda_base}.zip") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment