Skip to content

Commit d87f82b

Browse files
committed
merge latest stable fixes from develop branch
* develop: (31 commits) docs: fix contrast on highlighted code text (#73) feat: improve error handling for log_metrics decorator (#71) chore(deps): bump graphql-playground-html from 1.6.19 to 1.6.25 in /docs feat: add high level imports (#70) fix: correct env var name for publish to pypi test (#69) chore: version bump (#68) feat: add capture_cold_start_metric for log_metrics (#67) chore(deps): bump websocket-extensions from 0.1.3 to 0.1.4 in /docs (#66) feat: automate publishing to pypi (#58) feat: add pre-commit hooks (#64) improv: include example tests in `make tests` (#63) chore: rename Makefile target docs-dev to docs-local (#65) improv: better namespace/dimension handling for Metrics (#62) docs: build on master only chore: correct docstring for log_metrics chore: fix typo in metrics doc chore: Correct test comment chore: remove unused import chore: formatting feat: update Metrics interface to resemble tracer & logger: use "service" as its namespace. ...
2 parents 8ae86bd + 8859f27 commit d87f82b

Some content is hidden

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

54 files changed

+1078
-290
lines changed

Diff for: .flake8

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[flake8]
2-
exclude = docs, .eggs, setup.py, example, .aws-sam
2+
exclude = docs, .eggs, setup.py, example, .aws-sam, .git, dist, *.md, *.yaml, example/samconfig.toml, *.txt, *.ini
33
ignore = E203, E266, W503, BLK100, W291, I004
44
max-line-length = 120
55
max-complexity = 15

Diff for: .github/ISSUE_TEMPLATE/bug_report.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug, triage
6+
assignees: ''
7+
8+
---
9+
10+
<!--- Provide a general summary of the issue in the Title above -->
11+
<!--- How has this issue affected you? What are you trying to accomplish? -->
12+
13+
**What were you trying to accomplish?**
14+
15+
## Expected Behavior
16+
<!--- If you're describing a bug, tell us what should happen -->
17+
<!--- If you're suggesting a change/improvement, tell us how it should work -->
18+
19+
## Current Behavior
20+
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
21+
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
22+
23+
## Possible Solution
24+
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
25+
<!--- or ideas how to implement the addition or change -->
26+
27+
## Steps to Reproduce (for bugs)
28+
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
29+
<!--- reproduce this bug. Include code to reproduce, if relevant -->
30+
1.
31+
2.
32+
3.
33+
4.
34+
35+
## Environment
36+
37+
* **Powertools version used**:
38+
* **Packaging format (Layers, PyPi)**:
39+
* **AWS Lambda function runtime:**
40+
* **Debugging logs**
41+
42+
> [How to enable debug mode](https://awslabs.github.io/aws-lambda-powertools-python/#debug-mode)**
43+
44+
```python
45+
# paste logs here
46+
```

Diff for: .github/ISSUE_TEMPLATE/documentation-improvements.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Documentation improvements
3+
about: Suggest a documentation update
4+
title: ''
5+
labels: documentation
6+
assignees: ''
7+
8+
---
9+
10+
**What were you initially searching for in the docs?**
11+
<!-- Please help us understand how you looked for information that was either not available or unclear -->
12+
13+
**Is this related to an existing part of the documentation? Please share a link**
14+
15+
**Describe how we could make it clearer**
16+
17+
**If you have a proposed update, please share it here**

Diff for: .github/ISSUE_TEMPLATE/feature_request.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: feature-request, triage
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
12+
13+
**Describe the solution you'd like**
14+
<!-- A clear and concise description of what you want to happen. -->
15+
16+
**Describe alternatives you've considered**
17+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
18+
19+
**Additional context**
20+
<!-- Add any other context or screenshots about the feature request here. -->

Diff for: .github/ISSUE_TEMPLATE/rfc.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: RFC
3+
about: Feature design and proposals
4+
title: 'RFC: '
5+
labels: RFC, triage
6+
assignees: ''
7+
8+
---
9+
10+
## Key information
11+
12+
* RFC PR: (leave this empty)
13+
* Related issue(s), if known:
14+
* Area: (i.e. Tracer, Metrics, Logger, etc.)
15+
* Meet [tenets](https://awslabs.github.io/aws-lambda-powertools-python/#tenets): (Yes/no)
16+
17+
## Summary
18+
[summary]: #summary
19+
20+
> One paragraph explanation of the feature.
21+
22+
## Motivation
23+
[motivation]: #motivation
24+
25+
> Why are we doing this? What use cases does it support? What is the expected outcome?
26+
27+
## Proposal
28+
[proposal]: #proposal
29+
30+
> This is the bulk of the RFC.
31+
32+
> Explain the design in enough detail for somebody familiar with Powertools to understand it, and for somebody familiar with the implementation to implement it.
33+
34+
> This should get into specifics and corner-cases, and include examples of how the feature is used. Any new terminology should be defined here.
35+
36+
## Drawbacks
37+
[drawbacks]: #drawbacks
38+
39+
> Why should we *not* do this?
40+
41+
> Do we need additional dependencies? Impact performance/package size?
42+
43+
## Rationale and alternatives
44+
[rationale-and-alternatives]: #rationale-and-alternatives
45+
46+
* **What other designs have been considered? Why not them?**
47+
* **What is the impact of not doing this?**
48+
49+
## Unresolved questions
50+
[unresolved-questions]: #unresolved-questions
51+
52+
> Optional, stash area for topics that need further development e.g. TBD

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
**Issue #, if available:**
2+
3+
## Description of changes:
4+
5+
> One or two sentences as a summary of what's being changed
6+
7+
* [ ] [Meet tenets criteria](https://awslabs.github.io/aws-lambda-powertools-python/#tenets)
8+
* [ ] Update tests
9+
* [ ] Update docs
10+
* [ ] PR title follows [conventional commit semantics](https://github.com/awslabs/aws-lambda-powertools-python/blob/376ec0a2ac0d2a40e0af5717bef42ff84ca0d1b9/.github/semantic.yml#L2)
11+
12+
## Breaking change checklist
13+
14+
> Ignore if it's not a breaking change
15+
16+
**RFC issue #**:
17+
18+
* [ ] Migration process documented
19+
* [ ] Implement warnings (if it can live side by side)
20+
21+
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Diff for: .github/release-drafter.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
change-template: "* $TITLE (#$NUMBER) by @$AUTHOR"
2+
categories:
3+
- title: '⚡ Breaking Changes'
4+
labels:
5+
- 'breaking-change'
6+
- title: '🌟New features and non-breaking changes'
7+
labels:
8+
- 'major'
9+
- 'feature'
10+
- title: '🌟 Minor Changes'
11+
labels:
12+
- 'enhancement'
13+
- title: '📜 Documentation updates'
14+
labels:
15+
- 'documentation'
16+
- title: '🐛 Bug and hot fixes'
17+
labels:
18+
- 'bug'
19+
- 'fix'
20+
- title: '🚒 Deprecations'
21+
labels:
22+
- 'deprecated'
23+
exclude-labels:
24+
- 'skip-changelog'
25+
tag-template: 'v$NEXT_PATCH_VERSION'
26+
template: |
27+
## Changes
28+
29+
**[Human readable summary of changes]**
30+
31+
$CHANGES
32+
33+
## This release was made possible by the following contributors:
34+
35+
$CONTRIBUTORS

Diff for: .github/semantic.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# conventional commit types: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json
2+
types:
3+
- feat
4+
- fix
5+
- docs
6+
- style
7+
- refactor
8+
- perf
9+
- test
10+
- build
11+
- ci
12+
- chore
13+
- revert
14+
- improv
15+
16+
# Always validate the PR title
17+
# and ignore the commits to lower the entry bar for contribution
18+
# while titles make up the Release notes to ease maintenance overhead
19+
titleOnly: true

Diff for: .github/stale.yml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
only: issues
2+
daysUntilStale: 30
3+
daysUntilClose: 7
4+
exemptLabels:
5+
- bug
6+
- documentation
7+
- enhancement
8+
- feature-request
9+
- RFC
10+
staleLabel: pending-close-response-required
11+
markComment: >
12+
This issue has been automatically marked as stale because it has not had
13+
recent activity. It will be closed if no further activity occurs. Thank you
14+
for your contributions.
15+
closeComment: >
16+
This issue has been automatically closed because of inactivity.
17+
Please open a new issue if you are still encountering problems.

Diff for: .github/workflows/publish.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Publish to PyPi
2+
3+
# RELEASE PROCESS
4+
#
5+
# === Manual activities ===
6+
#
7+
# 1. Document human readable changes in CHANGELOG
8+
# 2. Bump package version using poetry version <major|minor|patch|specific version>
9+
# 3. Create a PR to develop branch, and merge if all tests pass
10+
# 4. Edit the current draft release notes
11+
# 5. If not already set, use `v<new version>` as a tag, and select develop as target branch
12+
#
13+
# === Automated activities ===
14+
#
15+
# 1. Extract release notes tag that was published
16+
# 2. Ensure release notes tag match what's in CHANGELOG and pyproject
17+
# 3. Run tests, linting, security and complexity base line
18+
# 4. Publish package to PyPi test repository
19+
# 5. Publish package to PyPi prod repository
20+
# 6. Push latest release source code to master using release title as the commit message
21+
22+
on:
23+
release:
24+
types: [published]
25+
26+
jobs:
27+
upload:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v2
31+
- name: Set up Python
32+
uses: actions/setup-python@v1
33+
with:
34+
python-version: "3.8"
35+
- name: Set release notes tag
36+
run: |
37+
export RELEASE_TAG_VERSION=${{ github.event.release.tag_name }}
38+
echo ::set-env name=RELEASE_TAG_VERSION::${RELEASE_TAG_VERSION:1}
39+
- name: Ensure new version is also set in pyproject and CHANGELOG
40+
run: |
41+
grep --regexp "\[${RELEASE_TAG_VERSION}\]" CHANGELOG.md
42+
grep --regexp "version \= \"${RELEASE_TAG_VERSION}\"" pyproject.toml
43+
- name: Install dependencies
44+
run: make dev
45+
- name: Run all tests, linting and baselines
46+
run: make pr
47+
- name: Build python package and wheel
48+
run: poetry build
49+
- name: Upload to PyPi test
50+
run: make release-test
51+
env:
52+
PYPI_USERNAME: __token__
53+
PYPI_TEST_TOKEN: ${{ secrets.PYPI_TEST_TOKEN }}
54+
- name: Upload to PyPi prod
55+
run: make release-prod
56+
env:
57+
PYPI_USERNAME: __token__
58+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
59+
60+
sync_master:
61+
needs: upload
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v2
65+
- name: Sync master from detached head
66+
# If version matches CHANGELOG and pyproject.toml
67+
# If it passes all checks, successfully releases to test and prod
68+
# Then sync up master with latest source code release
69+
# where commit message will be Release notes title
70+
run: git push origin HEAD:refs/heads/master --force

Diff for: .github/workflows/python.yml renamed to .github/workflows/python_build.yml

+15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
max-parallel: 4
1818
matrix:
1919
python-version: [3.6, 3.7, 3.8]
20+
env:
21+
OS: ${{ matrix.os }}
22+
PYTHON: ${{ matrix.python-version }}
2023
steps:
2124
- uses: actions/checkout@v1
2225
- name: Set up Python ${{ matrix.python-version }}
@@ -29,3 +32,15 @@ jobs:
2932
run: make lint
3033
- name: Test with pytest
3134
run: make test
35+
- name: Security baseline
36+
run: make security-baseline
37+
- name: Complexity baseline
38+
run: make complexity-baseline
39+
- name: Upload coverage to Codecov
40+
uses: codecov/codecov-action@v1
41+
with:
42+
file: ./coverage.xml
43+
# flags: unittests
44+
env_vars: OS,PYTHON
45+
name: aws-lambda-powertools-python-codecov
46+
fail_ci_if_error: true

Diff for: .github/workflows/python_docs.yml

+20-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77
push:
88
branches:
99
- master
10-
- develop
10+
# Disabled until docs support versioning per branch/release
11+
# - develop
1112

1213
jobs:
1314
docs:
@@ -26,20 +27,27 @@ jobs:
2627
- name: Build docs website
2728
run: make build-docs-website
2829
- name: Build docs API reference
29-
if: env.SOURCE_BRANCH == 'master'
30+
# if: env.SOURCE_BRANCH == 'master' # Disabled until docs support versioning per branch/release
3031
run: make build-docs-api
31-
- name: Deploy docs website
32-
uses: peaceiris/actions-gh-pages@v3
33-
with:
34-
github_token: ${{ secrets.GITHUB_TOKEN }}
35-
publish_dir: ./dist
36-
# when deploying docs website only
37-
# we need to keep existing API docs checked in
38-
# but only for dev branch
39-
keep_files: true
4032
- name: Deploy all docs
4133
uses: peaceiris/actions-gh-pages@v3
42-
if: env.SOURCE_BRANCH == 'master'
4334
with:
4435
github_token: ${{ secrets.GITHUB_TOKEN }}
4536
publish_dir: ./dist
37+
38+
# Disabled until docs support versioning per branch/release
39+
# - name: Deploy docs website
40+
# uses: peaceiris/actions-gh-pages@v3
41+
# with:
42+
# github_token: ${{ secrets.GITHUB_TOKEN }}
43+
# publish_dir: ./dist
44+
# # when deploying docs website only
45+
# # we need to keep existing API docs checked in
46+
# # but only for dev branch
47+
# keep_files: true
48+
# - name: Deploy all docs
49+
# uses: peaceiris/actions-gh-pages@v3
50+
# if: env.SOURCE_BRANCH == 'master'
51+
# with:
52+
# github_token: ${{ secrets.GITHUB_TOKEN }}
53+
# publish_dir: ./dist

0 commit comments

Comments
 (0)