Skip to content

atomraymaker/sam-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS SAM Python Cookiecutter

A cookie cutter template for AWS SAM Python.

  • pipenv
  • pytest
  • black
  • pylint
  • mypy
  • pytest-pythonpath

Usage

sam init --location gh:atomraymaker/sam-python

Configuration

iSort

Isort is enabled on save in vscode settings by:

"editor.codeActionsOnSave": {
    "source.organizeImports": true,
}

Configuration is customized in isort.cfg to be consistent with black as per these docs (search for isort)

Venv

Using PIPENV_VENV_IN_PROJECT=true will create a .venv in the project folder. There is vscode config to reference the project python, black, pylint, and mypy rather than any global installs of these.

pytest-pythonpath

Due to how SAM packages code, it can be difficult to get imports to work in unit tests and also when deployed. Referencing CodeUri: app causes SAM to package everythin in the app directory. It doesn't include the app directory, anything in there ends up at the top level when deployed. This means that from app import module does not work when deployed, but import module doesn't work locally since it is nested in the app folder. Using pytest-pythonpath fixes this by moving everything in app to the top level, emulating the deployed state.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages