From c8852f00449ecaf7bd5e69d93f798449ef5efe53 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 12 Jun 2020 10:07:41 +0100 Subject: [PATCH 1/9] docs: clean up contributing guide Signed-off-by: heitorlessa --- CONTRIBUTING.md | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 914e0741d75..df3809d7242 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,50 +6,47 @@ documentation, we greatly value feedback and contributions from our community. Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution. - ## Reporting Bugs/Feature Requests -We welcome you to use the GitHub issue tracker to report bugs or suggest features. +We welcome you to use the GitHub issue tracker to report bugs, suggest features, or documentation improvements. When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already -reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: - -* A reproducible test case or series of steps -* The version of our code being used -* Any modifications you've made relevant to the bug -* Anything unusual about your environment or deployment - +reported the issue. Please try to include as much information as you can. ## Contributing via Pull Requests + Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: -1. You are working against the latest source on the *master* branch. +1. You are working against the latest source on the *develop* branch. 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. -3. You open an issue to discuss any significant work - we would hate for your time to be wasted. +3. You open a RFC issue to discuss any significant work - we would hate for your time to be wasted. -To send us a pull request, please: +### Local dev setup + +To send us a pull request, please follow these steps: 1. Fork the repository. -2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. -3. Ensure local tests pass. +2. Install dependencies in a virtual env with poetry, and pre-commit hooks: `make dev` +3. Create a new branch to focus on the specific change you are contributing e.g. `improv/logger-debug-sampling` +4. Run all tests, and code baseline checks: `make pr` + - Git hooks will run linting and formatting while `make pr` run deep checks that also run in the CI process 4. Commit to your fork using clear commit messages. -5. Send us a pull request, answering any default questions in the pull request interface. +5. Send us a pull request with a [conventional semantic title](https://github.com/awslabs/aws-lambda-powertools-python/pulls?q=is%3Apr+is%3Aclosed), and answering any default questions in the pull request interface. 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). - ## Finding contributions to work on -Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. +Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/help wanted/invalid/question/documentation), looking at any 'help wanted' issues is a great place to start. ## Code of Conduct + This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact opensource-codeofconduct@amazon.com with any additional questions or comments. - ## Security issue notifications If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. From 2c6f1350b3166cdafb2de7a3b389ee972a9dee86 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 12 Jun 2020 10:10:47 +0100 Subject: [PATCH 2/9] docs: add local documentation section Signed-off-by: heitorlessa --- CONTRIBUTING.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df3809d7242..3096a2f75e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -41,6 +41,13 @@ GitHub provides additional document on [forking a repository](https://help.githu Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/help wanted/invalid/question/documentation), looking at any 'help wanted' issues is a great place to start. +## Local documentation + +You might find useful to run both the documentation website and the API reference locally while contributing. + +* **API reference**: `make docs-api-local` +* **Docs website**: `make dev-docs` to install deps, and `make docs-local` to run it thereafter + ## Code of Conduct This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). From b69cb59f0b2027246dfda19ffe38e83d42d2a512 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 12 Jun 2020 11:05:24 +0100 Subject: [PATCH 3/9] feat: experiment with Gitpod pre-build env Signed-off-by: heitorlessa --- .gitpod.Dockerfile | 5 +++++ .gitpod.yml | 8 ++++++++ CONTRIBUTING.md | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .gitpod.Dockerfile create mode 100644 .gitpod.yml diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 00000000000..6e9edc7827c --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,5 @@ +FROM gitpod/workspace-full:latest + +USER gitpod + +RUN pip install --upgrade pip setupools poetry diff --git a/.gitpod.yml b/.gitpod.yml new file mode 100644 index 00000000000..ef137539142 --- /dev/null +++ b/.gitpod.yml @@ -0,0 +1,8 @@ +image: + file: .gitpod.Dockerfile + +ports: + - port: 8000 + - port: 8080 +tasks: + - command: make dev diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3096a2f75e2..0b52f20aa3c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,7 +21,9 @@ Contributions via pull requests are much appreciated. Before sending us a pull r 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 3. You open a RFC issue to discuss any significant work - we would hate for your time to be wasted. -### Local dev setup +### Dev setup + +If you prefer not to use your current IDE and environment, you can use a pre-configured browser IDE with all tools installed - [![Launch IDE](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/awslabs/aws-lambda-powertools-python) To send us a pull request, please follow these steps: From 1f43f33ff0aec0407ae2c5b08a2ec350fcaf51b2 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 12 Jun 2020 17:42:22 +0100 Subject: [PATCH 4/9] fix: unnecessary exc_info in example exception --- example/hello_world/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/hello_world/app.py b/example/hello_world/app.py index 53ce0ace715..3d47646c389 100644 --- a/example/hello_world/app.py +++ b/example/hello_world/app.py @@ -117,7 +117,7 @@ def lambda_handler(event, context): metrics.add_metric(name="SuccessfulLocations", unit="Count", value=1) except requests.RequestException as e: # Send some context about this error to Lambda Logs - logger.exception(e, exc_info=True) + logger.exception(e) raise with single_metric(name="UniqueMetricDimension", unit="Seconds", value=1) as metric: From ea072ad8024c98bd9b300c8999ec0b3368496761 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 12 Jun 2020 17:43:05 +0100 Subject: [PATCH 5/9] docs: add conventions we use across the project Signed-off-by: heitorlessa --- CONTRIBUTING.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0b52f20aa3c..a71b7d57e4c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,8 +23,6 @@ Contributions via pull requests are much appreciated. Before sending us a pull r ### Dev setup -If you prefer not to use your current IDE and environment, you can use a pre-configured browser IDE with all tools installed - [![Launch IDE](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/awslabs/aws-lambda-powertools-python) - To send us a pull request, please follow these steps: 1. Fork the repository. @@ -39,17 +37,29 @@ To send us a pull request, please follow these steps: GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). -## Finding contributions to work on - -Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/help wanted/invalid/question/documentation), looking at any 'help wanted' issues is a great place to start. - -## Local documentation +#### Local documentation -You might find useful to run both the documentation website and the API reference locally while contributing. +You might find useful to run both the documentation website and the API reference locally while contributing: * **API reference**: `make docs-api-local` * **Docs website**: `make dev-docs` to install deps, and `make docs-local` to run it thereafter +### Conventions + +Category | Convention +------------------------------------------------- | --------------------------------------------------------------------------------- +**Docstring** | We use a slight variation of numpy convention with markdown to help generate more readable API references. +**Style guide** | We use black as well as flake8 extensions to enforce beyond good practices [PEP8](https://pep8.org/). We strive to make use of type annotation as much as possible, but don't overdo in creating custom types. +**Core utilities** | Core utilities use a Class, always accept `service` as a constructor parameter, can work in isolation, and are also available in other languages implementation. +**Utilities** | Utilities are not as strict as core and focus on solving a developer experience problem while following the project [Tenets](https://awslabs.github.io/aws-lambda-powertools-python/#tenets). +**Exceptions** | Specific exceptions live within utilities themselves and use `Error` suffix e.g. `MetricUnitError`. +**Git commits** | We follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). These are not enforced as we squash and merge PRs, but PR titles are enforced during CI. +**Documentation** | API reference docs are generated from docstrings which should have Examples section to allow developers to have what they need within their own IDE. Documentation website covers the wider usage, tips, and strive to be concise. + +## Finding contributions to work on + +Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/help wanted/invalid/question/documentation), looking at any 'help wanted' issues is a great place to start. + ## Code of Conduct This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). From 123515d9aa6a69d39ede97a6d10b465161e177ad Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 12 Jun 2020 17:48:09 +0100 Subject: [PATCH 6/9] chore: remove gitpod due to poetry issue --- .gitpod.Dockerfile | 5 ----- .gitpod.yml | 8 -------- 2 files changed, 13 deletions(-) delete mode 100644 .gitpod.Dockerfile delete mode 100644 .gitpod.yml diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile deleted file mode 100644 index 6e9edc7827c..00000000000 --- a/.gitpod.Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM gitpod/workspace-full:latest - -USER gitpod - -RUN pip install --upgrade pip setupools poetry diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index ef137539142..00000000000 --- a/.gitpod.yml +++ /dev/null @@ -1,8 +0,0 @@ -image: - file: .gitpod.Dockerfile - -ports: - - port: 8000 - - port: 8080 -tasks: - - command: make dev From 2fd564ee58dec3f83b2381ac28948890958e12ba Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 12 Jun 2020 17:50:08 +0100 Subject: [PATCH 7/9] chore: develop branch in bold Signed-off-by: heitorlessa --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a71b7d57e4c..3d72736f84b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ reported the issue. Please try to include as much information as you can. Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: -1. You are working against the latest source on the *develop* branch. +1. You are working against the latest source on the **develop** branch. 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 3. You open a RFC issue to discuss any significant work - we would hate for your time to be wasted. From 09dfe26119f6c17dee96cfd19ea7afa531a4509f Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Fri, 12 Jun 2020 17:51:43 +0100 Subject: [PATCH 8/9] chore: add link to RFC issue, fix typo Signed-off-by: heitorlessa --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d72736f84b..e8aa9dbdd2a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,8 +18,8 @@ reported the issue. Please try to include as much information as you can. Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 1. You are working against the latest source on the **develop** branch. -2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. -3. You open a RFC issue to discuss any significant work - we would hate for your time to be wasted. +2. You check existing open, and recently merged pull requests to make sure someone else hasn't addressed the problem already. +3. You open a [RFC issue](https://github.com/awslabs/aws-lambda-powertools-python/issues/new?assignees=&labels=RFC%2C+triage&template=rfc.md&title=RFC%3A+) to discuss any significant work - we would hate for your time to be wasted. ### Dev setup From 4132ccda65126b43fb7a6be73b314bf00ed3ceb4 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Sat, 13 Jun 2020 18:43:01 +0100 Subject: [PATCH 9/9] chore: address Nicolas feedback on PR link Signed-off-by: heitorlessa --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8aa9dbdd2a..45c5e93da78 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ To send us a pull request, please follow these steps: 4. Run all tests, and code baseline checks: `make pr` - Git hooks will run linting and formatting while `make pr` run deep checks that also run in the CI process 4. Commit to your fork using clear commit messages. -5. Send us a pull request with a [conventional semantic title](https://github.com/awslabs/aws-lambda-powertools-python/pulls?q=is%3Apr+is%3Aclosed), and answering any default questions in the pull request interface. +5. Send us a pull request with a [conventional semantic title](https://github.com/awslabs/aws-lambda-powertools-python/pull/67), and answering any default questions in the pull request interface. 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and