Skip to main content

Poetry plugin to work with AWS's SAM serverless tool

Project description

Description

CLI tool to run the sam build on a poetry-based project.

AWS's SAM made use of a requirements.txt file for third party dependency management. This method is limiting in comparison to other tools such as Poetry that manage sub-dependencies' versions through a lock file. This poetry plugin deploys a serverless app through SAM with dependencies being managed through Poetry.

Created by Pinnacle Solutions Group, www.pinnsg.com.

Set up

This plugin is dependent on having aws-sam-cli locally. AWS has a doc page an aws-sam-cli with the installation instructions at this url: aws-sam-cli installation

To install in the same environment as the poetry on your system:

pip install poetry
poetry self add poetry-aws-sam

This will add sam as a command in poetry. If you run poetry list, you will see sam as an option amongst the commands. You can then call poetry sam --help for options in running sam in your poetry project.

The plugin replaces the sam build command.

Sam deployment steps

sam build
sam package
sam deploy

Deployment steps using poetry-aws-sam:

poetry sam --without-hashes
sam package
sam deploy

History

The plugin was created while Pinnacle Solutions Group was working with one of its clients on a projects built on aws serverless resources. The client used SAM for its serverless management. The company ended a vendor's contract, which led to the team not having a repository for its package whl's. The team shifted to using poetry and installing its packages from a github url. With the change to poetry, the team needed to update how it interacted with SAM. This plugin was created by Pinnacle Solutions Group to meet that need.

Working on poetry-aws-sam

Common Actions - justfile

There is a justfile for just commands. It is like make with improvements. You can read about installation and usage here: just - github

  • show all the commands by running only just: just
  • set up git hooks through the pre-commit project: just pre-commit-setup
  • run the unit tests: just tests

Install locally to test iteratively

python -m venv .venv
source .venv/bin/activate
pip install -e .
just sam # same as: .venv/bin/poetry sam

This will set up a virtual env and have the sam ready as a plugin

pypi deployment

The master.yml workflow will deploy to pypi. This means that the project version in pyproject.toml will need to be increased when merging into the master branch.

A good dev flow:

  • create new branch
  • update version number of project
    • can use poetry version minor to increase the minor version
  • with code update, create pull request to merge into master
  • approve pull request and then merge into master
  • the workflow will then deploy to pypi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poetry_aws_sam-1.4.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

poetry_aws_sam-1.4.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file poetry_aws_sam-1.4.2.tar.gz.

File metadata

  • Download URL: poetry_aws_sam-1.4.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for poetry_aws_sam-1.4.2.tar.gz
Algorithm Hash digest
SHA256 ba03a738c8d0030667ca5dadd337cc2ee5b9326464ab6e01d72aa3621b84c3fc
MD5 ce881fe8b3f01e836b072e6ae34106c7
BLAKE2b-256 2a51ebf06e07c32f6f897a48528b0a662c346bbdde67ee54fd889be5d8bfbff0

See more details on using hashes here.

Provenance

The following attestation bundles were made for poetry_aws_sam-1.4.2.tar.gz:

Publisher: master.yml on upjohnc/poetry-aws-sam

Attestations:

File details

Details for the file poetry_aws_sam-1.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for poetry_aws_sam-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bf1095a6e87c778f150962ed5bc068ec3b7227485aa299b2a84db9d2371c10c1
MD5 35342c67d274b3270f892c67aaa2c2a5
BLAKE2b-256 8cc8cdf7381ea4c8f5bd0ef3e382ba295f61ee247fbf5592f2c7d26fa9609f0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for poetry_aws_sam-1.4.2-py3-none-any.whl:

Publisher: master.yml on upjohnc/poetry-aws-sam

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page