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

fix(aws-lambda-python): export poetry dependencies without hashes #22351

Merged
merged 21 commits into from
Oct 7, 2022

Conversation

a-bigelow
Copy link
Contributor

@a-bigelow a-bigelow commented Oct 4, 2022

Export poetry dependencies without hashes to prevent bundling failures when a dependency provides a hash. Without this flag, users relying on the Poetry python dependency manager need to manually export their own requirements.txt file, as described in #14201

Fixes #19232


All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Oct 4, 2022

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Oct 4, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team October 4, 2022 20:43
@TheRealAmazonKendra
Copy link
Contributor

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Oct 4, 2022

update

✅ Branch has been successfully updated

Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

@a-bigelow
Copy link
Contributor Author

Looks like tests are failing in a different module now. aws-lambda-python unit tests are passing on my end. As for integration tests, I will look and see if I can find a reason to update them -- integ.function.poetry is showing as UNCHANGED after packaging with the new poetry flag.

@a-bigelow
Copy link
Contributor Author

Based on comments here, it seems like changes to assets are out of scope for the integration tests, so I would like to request an exemption on that front:

https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-lambda-python/test/integ.function.poetry.ts#L44-L45

const integ = new IntegTest(app, 'poetry', {
  testCases: [testCase],
  // disabling update workflow because we don't want to include the assets in the snapshot
  // python bundling changes the asset hash pretty frequently
  stackUpdateWorkflow: false,
});

@a-bigelow
Copy link
Contributor Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Oct 4, 2022

update

✅ Branch has been successfully updated

@corymhall
Copy link
Contributor

integ.function.poetry is showing as UNCHANGED after packaging with the new poetry flag.

Can you run the test with --force to force the test to run even though the snapshot doesn't have a diff?

yarn integ integ.function.poetry --force

@aws-cdk-automation aws-cdk-automation dismissed their stale review October 5, 2022 19:31

✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.

@a-bigelow a-bigelow requested a review from corymhall October 5, 2022 20:08
packages/@aws-cdk/aws-lambda-python/lib/packaging.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed corymhall’s stale review October 6, 2022 13:41

Pull request has been modified.

@a-bigelow a-bigelow requested a review from corymhall October 6, 2022 14:20
@a-bigelow
Copy link
Contributor Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Oct 7, 2022

update

✅ Branch has been successfully updated

@a-bigelow
Copy link
Contributor Author

My only lingering question here is whether --without-hashes should be default behavior. Evaluating hash integrity is itself an "opt-in" activity. Alternatively, I can refactor this to be based on a poetryIncludeHashes prop and flip the logic in Packaging.withPoetry()

Copy link
Contributor

@corymhall corymhall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the methods! I just have one minor nit.

packages/@aws-cdk/aws-lambda-python/lib/packaging.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed corymhall’s stale review October 7, 2022 13:05

Pull request has been modified.

a-bigelow and others added 2 commits October 7, 2022 09:13
… into poetry-no-hashes

� Conflicts:
�	packages/@aws-cdk/aws-lambda-python/lib/packaging.ts
@a-bigelow
Copy link
Contributor Author

Changing default behavior to --without-hashes, per side discussion with Cory.

@a-bigelow a-bigelow requested a review from corymhall October 7, 2022 15:00
@mergify
Copy link
Contributor

mergify bot commented Oct 7, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 8223c70
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 76482f6 into aws:main Oct 7, 2022
@mergify
Copy link
Contributor

mergify bot commented Oct 7, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

arewa pushed a commit to arewa/aws-cdk that referenced this pull request Oct 8, 2022
…s#22351)

Export poetry dependencies without hashes to prevent bundling failures when a dependency provides a hash. Without this flag, users relying on the Poetry python dependency manager need to manually export their own `requirements.txt` file, as described in aws#14201

Fixes aws#19232

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@a-bigelow a-bigelow deleted the poetry-no-hashes branch October 11, 2022 19:57
homakk pushed a commit to homakk/aws-cdk that referenced this pull request Dec 1, 2022
…s#22351)

Export poetry dependencies without hashes to prevent bundling failures when a dependency provides a hash. Without this flag, users relying on the Poetry python dependency manager need to manually export their own `requirements.txt` file, as described in aws#14201

Fixes aws#19232

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
4 participants