Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support complete_platforms for python_awslambda. #14532

Merged
merged 1 commit into from
Feb 18, 2022

Conversation

jsirois
Copy link
Contributor

@jsirois jsirois commented Feb 18, 2022

Instead of (or in addition to) specifying a runtime for a
python_awslambda, you can now specify complete_platforms. This
allows creating a lambdex when an abbreviated platform string does not
provide enough information to evaluate environment markers during the
requirement resolution phase of building the lambdex.

[ci skip-rust]
[ci skip-build-wheels]

Instead of (or in addition to) specifying a `runtime` for a
`python_awslambda`, you can now specify `complete_platforms`. This
allows creating a lambdex when an abbreviated platform string does not
provide enough information to evaluate environment markers during the
requirement resolution phase of building the lambdex.

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@jsirois jsirois added this to the 2.10.x milestone Feb 18, 2022
@jsirois
Copy link
Contributor Author

jsirois commented Feb 18, 2022

Just like #14530 and #14526, this is a new feature, but the intention is to cherry-pick to 2.10.x to provide a solution for those who get borked by poetry export and python_full_version issues in the user lock file soft launch.

@jsirois jsirois merged commit b46a02f into pantsbuild:main Feb 18, 2022
@jsirois jsirois deleted the complete_platforms/lambdas/AWS branch February 18, 2022 06:38
jsirois added a commit to jsirois/pants that referenced this pull request Feb 18, 2022
Instead of (or in addition to) specifying a `runtime` for a
`python_awslambda`, you can now specify `complete_platforms`. This
allows creating a lambdex when an abbreviated platform string does not
provide enough information to evaluate environment markers during the
requirement resolution phase of building the lambdex.

(cherry picked from commit b46a02f)

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
jsirois added a commit that referenced this pull request Feb 18, 2022
…da`. (Cherry-picks of #14532 & #14469) (#14533)

There are two cherry-picks. The goal is #14532 and #14469 comes along to make that a clean pick.

1.) #14532:
---
Instead of (or in addition to) specifying a `runtime` for a
`python_awslambda`, you can now specify `complete_platforms`. This
allows creating a lambdex when an abbreviated platform string does not
provide enough information to evaluate environment markers during the
requirement resolution phase of building the lambdex.

(cherry picked from commit b46a02f)

2.) #14469
---
PR #13894 added `include_requirements:bool` flag to exclude third-party deps from `pex_binary` artifacts.

I have a similar need for `python_awslambda` builds, which already is using the `pex_binary` Request rule. This PR adds a `include_requirements` field to `python_awslambda` (default=True, not changing current behavior) and passes that to `PexFromTargetsRequest`.

Some alternatives to this feature suggested in slack [full thread here](https://pantsbuild.slack.com/archives/C01CQHVDMMW/p1644844772442459):
1. transitive excludes with `!!`: https://www.pantsbuild.org/docs/targets#dependencies-field on specific dependencies
2. reusing the same lambdex zip and alter the `LAMBDEX_ENTRY_POINT` on the functions themselves: https://github.com/pantsbuild/lambdex#controlling-runtime-execution

Alternative 1 requires adding a new exclusion every time a new third-party dep is added to any of your in-repo dependencies, meaning extra work & extra config.

Alternative 2 does not allow the use of [Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) to upload expensive/large/slow-changing deps once, and redeploy only your first-party changes.

(cherry picked from commit 82d4270)
alonsodomin pushed a commit to alonsodomin/pants that referenced this pull request Feb 25, 2022
Instead of (or in addition to) specifying a `runtime` for a
`python_awslambda`, you can now specify `complete_platforms`. This
allows creating a lambdex when an abbreviated platform string does not
provide enough information to evaluate environment markers during the
requirement resolution phase of building the lambdex.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants