Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(governance): add pre-configured dev environment with GitPod.io to ease contributions #1403

Merged
merged 11 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
10 changes: 10 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# See here all gitpod images available: https://hub.docker.com/r/gitpod/workspace-python-3.9/tags
# Current python version: 3.9.13
FROM gitpod/workspace-python-3.9@sha256:de87d4ebffe8daab2e8fef96ec20497ae4f39e8dcb9dec1483d0be61ea78e8cd

WORKDIR /app
ADD . /app

# Installing pre-commit as system package and not user package. Git needs this to execute pre-commit hooks.
RUN export PIP_USER=no
RUN python3 -m pip install pre-commit
19 changes: 19 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
image:
file: .gitpod.Dockerfile
tasks:
- init: make dev-gitpod
vscode:
extensions:
heitorlessa marked this conversation as resolved.
Show resolved Hide resolved
- ms-python.python # IntelliSense (Pylance), Linting, Debugging (multi-threaded, remote), Jupyter Notebooks, code formatting, refactoring, unit tests, and more.
- littlefoxteam.vscode-python-test-adapter # Run your Python tests in the Sidebar of Visual Studio Code
- ms-azuretools.vscode-docker # Makes it easy to create, manage, and debug containerized applications.
- davidanson.vscode-markdownlint # Markdown linting and style checking for Visual Studio Code
- bungcip.better-toml # Better TOML Language support
- oderwat.indent-rainbow # Makes indentation easier to read
- yzhang.markdown-all-in-one # Autoformat, better visualization, snippets, and markdown export to multiple fmts
- bierner.markdown-mermaid # Previews mermaid diagrams when previewing markdown
- matangover.mypy # Highlight mypy issues
- njpwerner.autodocstring # Auto-generate docsstrings in numpy format that we use
- netcorext.uuid-generator # For those helping create code snippets for docs
- streetsidesoftware.code-spell-checker # Spell checker that works with camel case too
- bungcip.better-toml # In case GitPod doesn't have support for TOML pyproject.toml
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/from-referrer/)

# Contributing Guidelines

Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional
Expand Down Expand Up @@ -36,6 +38,8 @@ To send us a pull request, please follow these steps:
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.

Optionally you can use [Gitpod](https://gitpod.io/) to have a pre-configured dev environment. If you choose to use Gitpod, there is no need to install anything on your machine, as the environment will be pre-configured with all necessary dependencies.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @heitorlessa and @rubenfonseca. I'm really not sure if this information is enough to make it clear how to use Gitpod.io or we should create a section to explain how Gitpod works and how to use it. I need help 🙏

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Leandro! This is great, but I'm not familiar with gitpod, and after reading this paragraph I don't know what I have to do exactly. Do I need to click somewhere? Do I have to go to gitpod.io instead? Some extra instructions would help a lot :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Rubens! Currently we need to fork the repository, install all dependencies locally and start coding, basically using Gitpod we just need to fork the repository and click on that badge and everything is ready to start coding.
To contribute to the project this document guides us through 7 steps and using Gitpod basically changes step 2 because we no longer need to install dependencies locally.

What do you think about this:

Optionally you can use [Gitpod](https://gitpod.io/) to have a pre-configured dev environment. If you choose to use Gitpod, there is no need to install anything on your machine, as the environment will be pre-configured with all necessary dependencies. To gain access to a pre-configured environment using Gitpod, simply fork the repository and click the Gitpod badge in the README.md file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest updating the entire section and use something along these lines. This makes our recommendation to use our pre-configured env explicit, give them recommendations on how to create against their fork (not ours, or else their push will fail), and keeping the remaining steps applicable for both.

The only thing I kinda miss is having a link for people unfamiliar with GitHub trying to create their first PR - maybe installing GitHub CLI and adding this link can raise the bar? I'm fine without it for now too.


Firstly, fork the repository.

To setup your development environment, we recommend using our pre-configured Cloud environment: https://gitpod.io/#https://github.com/YOUR_USERNAME/aws-lambda-powertools-python. Replace YOUR_USERNAME with your GitHub username so the Cloud environment can target your fork accordingly.

Alternatively, you can use make dev within your local virtual environment.

To send us a pull request, please follow these steps:

  1. Create a new branch to focus on the specific change you are contributing e.g. improv/logger-debug-sampling
  2. 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
  3. Commit to your fork using clear commit messages.
  4. Send us a pull request with a conventional semantic title, and answering any default questions in the pull request interface.
  5. 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/).

Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ dev:
poetry install --extras "pydantic"
pre-commit install

dev-gitpod:
pip install --upgrade pip poetry
heitorlessa marked this conversation as resolved.
Show resolved Hide resolved
poetry install --extras "pydantic"
pre-commit install

format:
poetry run isort aws_lambda_powertools tests examples
poetry run black aws_lambda_powertools tests examples
Expand Down