Skip to content

Commit dca02ee

Browse files
author
Tom McCarthy
committed
Merge branch 'develop' into feat/idempotency_helper
# Conflicts: # docs/media/idempotency_expired_seq.png
2 parents 41d559e + fc08062 commit dca02ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3424
-21377
lines changed

.github/workflows/python_docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches:
99
- master
10+
- docs/mkdocs
1011
# Disabled until docs support versioning per branch/release
1112
# - develop
1213
release:

CHANGELOG.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
.# Changelog
1+
# Changelog
2+
23
All notable changes to this project will be documented in this file.
34

4-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
This project follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format for changes and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
68

79
## [Unreleased]
810

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ GitHub provides additional document on [forking a repository](https://help.githu
4242
You might find useful to run both the documentation website and the API reference locally while contributing:
4343

4444
* **API reference**: `make docs-api-local`
45-
* **Docs website**: `make dev-docs` to install deps, and `make docs-local` to run it thereafter
45+
* **Docs website**: `make docs-local`
46+
- If you prefer using Docker: `make docs-local-docker`
4647

4748
### Conventions
4849

Makefile

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: target dev dev-docs format lint test coverage-html pr build build-docs build-docs-api build-docs-website
1+
.PHONY: target dev format lint test coverage-html pr build build-docs build-docs-api build-docs-website
22
.PHONY: docs-local docs-api-local security-baseline complexity-baseline release-prod release-test release
33

44
target:
@@ -9,9 +9,6 @@ dev:
99
poetry install --extras "pydantic"
1010
pre-commit install
1111

12-
dev-docs:
13-
cd docs && yarn install
14-
1512
format:
1613
poetry run isort -rc aws_lambda_powertools tests
1714
poetry run black aws_lambda_powertools tests
@@ -40,13 +37,17 @@ build-docs-api: dev
4037
mv -f dist/api/aws_lambda_powertools/* dist/api/
4138
rm -rf dist/api/aws_lambda_powertools
4239

43-
build-docs-website: dev-docs
40+
build-docs-website: dev
4441
mkdir -p dist
45-
cd docs && yarn build
46-
cp -R docs/public/* dist/
42+
poetry run mkdocs build
43+
cp -R site/* dist/
44+
45+
docs-local:
46+
poetry run mkdocs serve
4747

48-
docs-local: dev-docs
49-
cd docs && yarn start
48+
docs-local-docker:
49+
docker build -t squidfunk/mkdocs-material ./docs/
50+
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
5051

5152
docs-api-local:
5253
poetry run pdoc --http : aws_lambda_powertools

aws_lambda_powertools/utilities/parser/envelopes/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
from abc import ABC, abstractmethod
3-
from typing import Any, Dict, Optional, TypeVar, Union
3+
from typing import Any, Dict, Optional, Type, TypeVar, Union
44

55
from ..types import Model
66

@@ -11,14 +11,14 @@ class BaseEnvelope(ABC):
1111
"""ABC implementation for creating a supported Envelope"""
1212

1313
@staticmethod
14-
def _parse(data: Optional[Union[Dict[str, Any], Any]], model: Model) -> Union[Model, None]:
14+
def _parse(data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]) -> Union[Model, None]:
1515
"""Parses envelope data against model provided
1616
1717
Parameters
1818
----------
1919
data : Dict
2020
Data to be parsed and validated
21-
model : Model
21+
model : Type[Model]
2222
Data model to parse and validate data against
2323
2424
Returns
@@ -38,7 +38,7 @@ def _parse(data: Optional[Union[Dict[str, Any], Any]], model: Model) -> Union[Mo
3838
return model.parse_obj(data)
3939

4040
@abstractmethod
41-
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Model):
41+
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]):
4242
"""Implementation to parse data against envelope model, then against the data model
4343
4444
NOTE: Call `_parse` method to fully parse data with model provided.

aws_lambda_powertools/utilities/parser/envelopes/cloudwatch.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Any, Dict, List, Optional, Union
2+
from typing import Any, Dict, List, Optional, Type, Union
33

44
from ..models import CloudWatchLogsModel
55
from ..types import Model
@@ -18,14 +18,14 @@ class CloudWatchLogsEnvelope(BaseEnvelope):
1818
Note: The record will be parsed the same way so if model is str
1919
"""
2020

21-
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Model) -> List[Optional[Model]]:
21+
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]) -> List[Optional[Model]]:
2222
"""Parses records found with model provided
2323
2424
Parameters
2525
----------
2626
data : Dict
2727
Lambda event to be parsed
28-
model : Model
28+
model : Type[Model]
2929
Data model provided to parse after extracting data using envelope
3030
3131
Returns

aws_lambda_powertools/utilities/parser/envelopes/dynamodb.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Any, Dict, List, Optional, Union
2+
from typing import Any, Dict, List, Optional, Type, Union
33

44
from ..models import DynamoDBStreamModel
55
from ..types import Model
@@ -15,14 +15,14 @@ class DynamoDBStreamEnvelope(BaseEnvelope):
1515
length of the list is the record's amount in the original event.
1616
"""
1717

18-
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Model) -> List[Dict[str, Optional[Model]]]:
18+
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]) -> List[Dict[str, Optional[Model]]]:
1919
"""Parses DynamoDB Stream records found in either NewImage and OldImage with model provided
2020
2121
Parameters
2222
----------
2323
data : Dict
2424
Lambda event to be parsed
25-
model : Model
25+
model : Type[Model]
2626
Data model provided to parse after extracting data using envelope
2727
2828
Returns

aws_lambda_powertools/utilities/parser/envelopes/event_bridge.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Any, Dict, Optional, Union
2+
from typing import Any, Dict, Optional, Type, Union
33

44
from ..models import EventBridgeModel
55
from ..types import Model
@@ -11,14 +11,14 @@
1111
class EventBridgeEnvelope(BaseEnvelope):
1212
"""EventBridge envelope to extract data within detail key"""
1313

14-
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Model) -> Optional[Model]:
14+
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]) -> Optional[Model]:
1515
"""Parses data found with model provided
1616
1717
Parameters
1818
----------
1919
data : Dict
2020
Lambda event to be parsed
21-
model : Model
21+
model : Type[Model]
2222
Data model provided to parse after extracting data using envelope
2323
2424
Returns

aws_lambda_powertools/utilities/parser/envelopes/kinesis.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Any, Dict, List, Optional, Union
2+
from typing import Any, Dict, List, Optional, Type, Union
33

44
from ..models import KinesisDataStreamModel
55
from ..types import Model
@@ -19,14 +19,14 @@ class KinesisDataStreamEnvelope(BaseEnvelope):
1919
all items in the list will be parsed as str and npt as JSON (and vice versa)
2020
"""
2121

22-
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Model) -> List[Optional[Model]]:
22+
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]) -> List[Optional[Model]]:
2323
"""Parses records found with model provided
2424
2525
Parameters
2626
----------
2727
data : Dict
2828
Lambda event to be parsed
29-
model : Model
29+
model : Type[Model]
3030
Data model provided to parse after extracting data using envelope
3131
3232
Returns

aws_lambda_powertools/utilities/parser/envelopes/sns.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Any, Dict, List, Optional, Union
2+
from typing import Any, Dict, List, Optional, Type, Union
33

44
from ..models import SnsModel, SnsNotificationModel, SqsModel
55
from ..types import Model
@@ -16,16 +16,16 @@ class SnsEnvelope(BaseEnvelope):
1616
1717
Note: Records will be parsed the same way so if model is str,
1818
all items in the list will be parsed as str and npt as JSON (and vice versa)
19-
"""
19+
"""
2020

21-
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Model) -> List[Optional[Model]]:
21+
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]) -> List[Optional[Model]]:
2222
"""Parses records found with model provided
2323
2424
Parameters
2525
----------
2626
data : Dict
2727
Lambda event to be parsed
28-
model : Model
28+
model : Type[Model]
2929
Data model provided to parse after extracting data using envelope
3030
3131
Returns
@@ -50,14 +50,14 @@ class SnsSqsEnvelope(BaseEnvelope):
5050
3. Finally, parse provided model against payload extracted
5151
"""
5252

53-
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Model) -> List[Optional[Model]]:
53+
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]) -> List[Optional[Model]]:
5454
"""Parses records found with model provided
5555
5656
Parameters
5757
----------
5858
data : Dict
5959
Lambda event to be parsed
60-
model : Model
60+
model : Type[Model]
6161
Data model provided to parse after extracting data using envelope
6262
6363
Returns

aws_lambda_powertools/utilities/parser/envelopes/sqs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Any, Dict, List, Optional, Union
2+
from typing import Any, Dict, List, Optional, Type, Union
33

44
from ..models import SqsModel
55
from ..types import Model
@@ -18,14 +18,14 @@ class SqsEnvelope(BaseEnvelope):
1818
all items in the list will be parsed as str and npt as JSON (and vice versa)
1919
"""
2020

21-
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Model) -> List[Optional[Model]]:
21+
def parse(self, data: Optional[Union[Dict[str, Any], Any]], model: Type[Model]) -> List[Optional[Model]]:
2222
"""Parses records found with model provided
2323
2424
Parameters
2525
----------
2626
data : Dict
2727
Lambda event to be parsed
28-
model : Model
28+
model : Type[Model]
2929
Data model provided to parse after extracting data using envelope
3030
3131
Returns

docs/.prettierignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/.prettierrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM squidfunk/mkdocs-material
2+
RUN pip install mkdocs-git-revision-date-plugin

docs/api/.gitkeep

Whitespace-only changes.

docs/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[comment]: <> (Includes Changelog content entire file as a snippet)
2+
--8<-- "CHANGELOG.md"

0 commit comments

Comments
 (0)