Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python/
strategy:
max-parallel: 4
matrix:
Expand All @@ -28,15 +31,8 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
make dev
working-directory: ./python/
run: make dev
- name: Formatting and Linting
run: |
make lint
working-directory: ./python/
run: make lint
- name: Test with pytest
run: |
make test
working-directory: ./python/
run: make test
35 changes: 35 additions & 0 deletions .github/workflows/python_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Powertools Python Docs

on:
pull_request:
branches:
- master
paths:
- "python/**"
push:
branches:
- master
paths:
- "python/**"

jobs:
docs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python/
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.8"
- name: Install dependencies
run: make dev
- name: build docs
run: make docs
- name: deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: python/docs/aws_lambda_powertools/
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# Lambda Powertools

![PackageStatus](https://img.shields.io/static/v1?label=status&message=beta&color=blueviolet?style=flat-square) ![PythonSupport](https://img.shields.io/static/v1?label=python&message=3.6%20|%203.7|%203.8&color=blue?style=flat-square&logo=python)
![Python Build](https://github.com/awslabs/aws-lambda-powertools/workflows/Powertools%20Python/badge.svg?branch=master)

A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier.

## Tenets

* **AWS Lambda only** – We optimise for AWS Lambda function environments only. Utilities might work with web frameworks and non-Lambda environments, though they are not officially supported.
* **Eases the adoption of best practices** – The main priority of the utilities is to facilitate best practices adoption, as defined in the AWS Well-Architected Serverless Lens; all other functionality is optional.
* **Keep it lean** – Additional dependencies are carefully considered for security and ease of maintenance, and prevent negatively impacting startup time.
* **We strive for backwards compatibility** – New features and changes should keep backwards compatibility. If a breaking change cannot be avoided, the deprecation and migration process should be clearly defined.
* **We work backwards from the community** – We aim to strike a balance of what would work best for 80% of customers. Emerging practices are considered and discussed via Requests for Comment (RFCs)
* **Idiomatic** – Utilities follow programming language idioms and language-specific best practices.

_`*` Core utilities are Tracer, Logger and Metrics. Optional utilities may vary across languages._

## Powertools available

* [Python - Beta](./python/README.md)
Expand Down
3 changes: 1 addition & 2 deletions python/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
exclude = docs, .eggs, setup.py, example, .aws-sam
ignore = E203, E266, W503, BLK100, W291, I004
max-line-length = 120
max-complexity = 18
max-complexity = 15

[isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 120

78 changes: 78 additions & 0 deletions python/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# HISTORY

## May 16th

**0.9.3**

* **Tracer**: Bugfix - Runtime Error for nested sync due to incorrect loop usage

## May 14th

**0.9.2**

* **Tracer**: Bugfix - aiohttp lazy import so it's not a hard dependency

## May 12th

**0.9.0**

* **Tracer**: Support for async functions in `Tracer` via `capture_method` decorator
* **Tracer**: Support for `aiohttp` via `aiohttp_trace_config` trace config
* **Tracer**: Support for patching specific modules via `patch_modules` param
* **Tracer**: Document escape hatch mechanisms via `tracer.provider`

## May 1st

**0.8.1**

* **Metrics**: Fix metric unit casting logic if one passes plain string (value or key)
* **Metrics: **Fix `MetricUnit` enum values for
- `BytesPerSecond`
- `KilobytesPerSecond`
- `MegabytesPerSecond`
- `GigabytesPerSecond`
- `TerabytesPerSecond`
- `BitsPerSecond`
- `KilobitsPerSecond`
- `MegabitsPerSecond`
- `GigabitsPerSecond`
- `TerabitsPerSecond`
- `CountPerSecond`

## April 24th

**0.8.0**

* **Logger**: Introduces `Logger` class for stuctured logging as a replacement for `logger_setup`
* **Logger**: Introduces `Logger.inject_lambda_context` decorator as a replacement for `logger_inject_lambda_context`
* **Logger**: Raise `DeprecationWarning` exception for both `logger_setup`, `logger_inject_lambda_context`

## April 20th, 2020

**0.7.0**

* **Middleware factory**: Introduces Middleware Factory to build your own middleware via `lambda_handler_decorator`
* **Metrics**: Fixes metrics dimensions not being included correctly in EMF

## April 9th, 2020

**0.6.3**

* **Logger**: Fix `log_metrics` decorator logic not calling the decorated function, and exception handling

## April 8th, 2020

**0.6.1**

* **Metrics**: Introduces Metrics middleware to utilise CloudWatch Embedded Metric Format
* **Metrics**: Adds deprecation warning for `log_metrics`

## February 20th, 2020

**0.5.0**

* **Logger**: Introduces log sampling for debug - Thanks to [Danilo's contribution](https://github.com/awslabs/aws-lambda-powertools/pull/7)

## November 15th, 2019

* Public beta release
24 changes: 0 additions & 24 deletions python/HISTORY.md

This file was deleted.

15 changes: 12 additions & 3 deletions python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ target:
@$(MAKE) pr

dev:
pip install --upgrade poetry
pip install --upgrade pip poetry
poetry install

format:
Expand All @@ -17,10 +17,10 @@ lint: format
test:
poetry run pytest -vvv

test-html:
coverage-html:
poetry run pytest --cov-report html

pr: lint test
pr: lint test security-baseline complexity-baseline

build: pr
poetry run build
Expand All @@ -31,6 +31,15 @@ docs: dev
docs-dev:
poetry run pdoc --http : aws_lambda_powertools

security-baseline:
poetry run bandit --baseline bandit.baseline -r aws_lambda_powertools

complexity-baseline:
$(info Maintenability index)
poetry run radon mi aws_lambda_powertools
$(info Cyclomatic complexity index)
poetry run xenon --max-absolute C --max-modules A --max-average A aws_lambda_powertools

#
# Use `poetry version <major>/<minor></patch>` for version bump
#
Expand Down
Loading