Skip to content

Extract initial common code into common directory#300

Merged
isabeleliassen merged 31 commits intocsg-org:developmentfrom
InspiringApps:feat/common-code-layer
Nov 8, 2024
Merged

Extract initial common code into common directory#300
isabeleliassen merged 31 commits intocsg-org:developmentfrom
InspiringApps:feat/common-code-layer

Conversation

@landonshumway-ia
Copy link
Collaborator

@landonshumway-ia landonshumway-ia commented Nov 5, 2024

As part of #271 , this ticket addresses a technical need of sharing common code across all of our lambda functions. We have opted to use a lambda layer for this. As part of this change, all of the common schema, client, and config files have been extracted into a common-python directory, which we use to create the lambda layer in the persistent stack. For local development/testing, we reference this common directory in our unit tests by updating the PYTHONPATH env var to reference it, which matches the behavior we should expect when the lambda function is deployed with the layer attached to it.

It's important to note that CDK doesn't support including layers when running hook tests, so we have determined to remove the test hook from the bundle step. We currently run the tests as part of the PR review phase, which must
pass in order for the code to be merged, so we still ensure passing unit test coverage for all of our components.

Requirements List

  • no new requirements for deploying these changes

Description List

  • Extracted common python lambda code into common-python directory
  • Added lambda layer resource with reference to it in every v1 api python lambda function

Testing List

  • yarn test:unit:all should run without errors or warnings
  • yarn serve should run without errors or warnings
  • yarn build should run without errors or warnings
  • For API configuration changes: CDK tests added/updated in backend/compact-connect/tests/unit/test_api.py
  • Code review

Closes #271

@landonshumway-ia landonshumway-ia marked this pull request as ready for review November 6, 2024 22:47
@landonshumway-ia landonshumway-ia force-pushed the feat/common-code-layer branch 2 times, most recently from 0d7c1f9 to de3c004 Compare November 7, 2024 20:52
Copy link
Contributor

@jusdino jusdino left a comment

Choose a reason for hiding this comment

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

So glad you got to this! I found a couple of improvements to make.

Since we now have a slightly more complex environmental set-up situation, we should probably revise our discussion of tests to match.

Copy link
Contributor

@jusdino jusdino left a comment

Choose a reason for hiding this comment

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

Looks good!

@landonshumway-ia
Copy link
Collaborator Author

@jlkravitz This is ready for your review. Thanks.

jlkravitz
jlkravitz previously approved these changes Nov 8, 2024
Copy link
Collaborator

@jlkravitz jlkravitz left a comment

Choose a reason for hiding this comment

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

Looks great!

@isabeleliassen Good to merge.

isabeleliassen
isabeleliassen previously approved these changes Nov 8, 2024
@isabeleliassen isabeleliassen merged commit a94cd61 into csg-org:development Nov 8, 2024
@jusdino jusdino deleted the feat/common-code-layer branch January 24, 2025 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract common Python code into a Lambda Layer

4 participants