Add a devcontainer configuration (#4969)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by emisargent · committed by GitHub · parent 49498a3 · Browse files · 3 files·+75 added−38 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+75 added−38 removed
- other:+75 added−38 removed
Provenance
- Commit
182ce3d- Tree
6010802- Author
emisargent <55098699+emisargent@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
49498a3
3 files changed+75 added−38 removed
added:.devcontainer/devcontainer.json+17 added
1234567891011121314151617{ "name": "pallets/flask", "image": "mcr.microsoft.com/devcontainers/python:3", "customizations": { "vscode": { "settings": { "python.defaultInterpreterPath": "${workspaceFolder}/.venv", "python.terminal.activateEnvInCurrentTerminal": true, "python.terminal.launchArgs": [ "-X", "dev" ] } } }, "onCreateCommand": ".devcontainer/on-create-command.sh"}added:.devcontainer/on-create-command.sh+9 added
123456789#!/bin/bashset -e
python3 -m venv .venv. .venv/bin/activatepip install -U pip setuptools wheelpip install -r requirements/dev.txtpip install -e .pre-commit install --install-hooksmodified:CONTRIBUTING.rst+49 added-38 removed
65 unmodified lines66 .. _Black: https://black.readthedocs.io67 .. _pre-commit: https://pre-commit.com68 69 70-First time setup71-~~~~~~~~~~~~~~~~70+First time setup using GitHub Codespaces71+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~72 73+`GitHub Codespaces`_ creates a development environment that is already set up for the74+project. By default it opens in Visual Studio Code for the Web, but this can75+be changed in your GitHub profile settings to use Visual Studio Code or JetBrains76+PyCharm on your local computer.77+78+- Make sure you have a `GitHub account`_.79+- From the project's repository page, click the green "Code" button and then "Create80+ codespace on main".81+- The codespace will be set up, then Visual Studio Code will open. However, you'll82+ need to wait a bit longer for the Python extension to be installed. You'll know it's83+ ready when the terminal at the bottom shows that the virtualenv was activated.84+- Check out a branch and `start coding`_.85+86+.. _GitHub Codespaces: https://docs.github.com/en/codespaces87+.. _devcontainer: https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers88+89+First time setup in your local environment90+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~91+92+- Make sure you have a `GitHub account`_.93 - Download and install the `latest version of git`_.94 - Configure git with your `username`_ and `email`_.95 96 .. code-block:: text97 98 $ git config --global user.name 'your name'99 $ git config --global user.email 'your email'100 81-- Make sure you have a `GitHub account`_.101 - Fork Flask to your GitHub account by clicking the `Fork`_ button.83-- `Clone`_ the main repository locally.102+- `Clone`_ your fork locally, replacing ``your-username`` in the command below with103+ your actual username.104 105 .. code-block:: text106 87- $ git clone https://github.com/pallets/flask107+ $ git clone https://github.com/your-username/flask108 $ cd flask109 90-- Add your fork as a remote to push your work to. Replace91- ``{username}`` with your username. This names the remote "fork", the92- default Pallets remote is "origin".110+- Create a virtualenv. Use the latest version of Python.111 94- .. code-block:: text95-96- $ git remote add fork https://github.com/{username}/flask97-98-- Create a virtualenv.99-100-112 - Linux/macOS113 114 .. code-block:: text115 6 unmodified lines122 123 > py -3 -m venv .venv124 > env\Scripts\activate125 115-- Upgrade pip and setuptools.126+- Install the development dependencies, then install Flask in editable mode.127 128 .. code-block:: text129 119- $ python -m pip install --upgrade pip setuptools120-121-- Install the development dependencies, then install Flask in editable122- mode.123-124- .. code-block:: text125-130+ $ python -m pip install -U pip setuptools wheel131 $ pip install -r requirements/dev.txt && pip install -e .132 133 - Install the pre-commit hooks.134 135 .. code-block:: text136 132- $ pre-commit install137+ $ pre-commit install --install-hooks138 139+.. _GitHub account: https://github.com/join140 .. _latest version of git: https://git-scm.com/downloads141 .. _username: https://docs.github.com/en/github/using-git/setting-your-username-in-git142 .. _email: https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address137-.. _GitHub account: https://github.com/join143 .. _Fork: https://github.com/pallets/flask/fork144 .. _Clone: https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#step-2-create-a-local-clone-of-your-fork145 146+.. _start coding:147 148 Start coding149 ~~~~~~~~~~~~150 145-- Create a branch to identify the issue you would like to work on. If146- you're submitting a bug or documentation fix, branch off of the147- latest ".x" branch.151+- Create a branch to identify the issue you would like to work on. If you're152+ submitting a bug or documentation fix, branch off of the latest ".x" branch.153 154 .. code-block:: text155 156 $ git fetch origin157 $ git checkout -b your-branch-name origin/2.0.x158 154- If you're submitting a feature addition or change, branch off of the155- "main" branch.159+ If you're submitting a feature addition or change, branch off of the "main" branch.160 161 .. code-block:: text162 163 $ git fetch origin164 $ git checkout -b your-branch-name origin/main165 162-- Using your favorite editor, make your changes,163- `committing as you go`_.164-- Include tests that cover any code changes you make. Make sure the165- test fails without your patch. Run the tests as described below.166-- Push your commits to your fork on GitHub and167- `create a pull request`_. Link to the issue being addressed with168- ``fixes #123`` in the pull request.166+- Using your favorite editor, make your changes, `committing as you go`_.167 168+ - If you are in a codespace, you will be prompted to `create a fork`_ the first169+ time you make a commit. Enter ``Y`` to continue.170+171+- Include tests that cover any code changes you make. Make sure the test fails without172+ your patch. Run the tests as described below.173+- Push your commits to your fork on GitHub and `create a pull request`_. Link to the174+ issue being addressed with ``fixes #123`` in the pull request description.175+176 .. code-block:: text177 172- $ git push --set-upstream fork your-branch-name178+ $ git push --set-upstream origin your-branch-name179 180 .. _committing as you go: https://afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes181+.. _create a fork: https://docs.github.com/en/codespaces/developing-in-codespaces/using-source-control-in-your-codespace#about-automatic-forking182 .. _create a pull request: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request183 184+.. _Running the tests:185 186 Running the tests187 ~~~~~~~~~~~~~~~~~188 19 unmodified lines208 Generating a report of lines that do not have test coverage can indicate209 where to start contributing. Run ``pytest`` using ``coverage`` and210 generate a report.211 212+If you are using GitHub Codespaces, ``coverage`` is already installed213+so you can skip the installation command.214+215 .. code-block:: text216 217 $ pip install coverage218 $ coverage run -m pytest20 unmodified lines