Skip to content
Myr

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

3 files+75 added−38 removed

added:.devcontainer/devcontainer.json+17 added
added:.devcontainer/on-create-command.sh+9 added
modified:CONTRIBUTING.rst+49 added-38 removed
65 unmodified lines
66.. _Black: https://black.readthedocs.io67.. _pre-commit: https://pre-commit.com686970First time setup71~~~~~~~~~~~~~~~~70First time setup using GitHub Codespaces71~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~7273`GitHub Codespaces`_ creates a development environment that is already set up for the74project. By default it opens in Visual Studio Code for the Web, but this can75be changed in your GitHub profile settings to use Visual Studio Code or JetBrains76PyCharm on your local computer.7778- 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`_.8586.. _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-containers8889First time setup in your local environment90~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~9192- Make sure you have a `GitHub account`_.93- Download and install the `latest version of git`_.94- Configure git with your `username`_ and `email`_.9596 .. code-block:: text9798 $ git config --global user.name 'your name'99 $ git config --global user.email 'your email'10081- 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.104105 .. code-block:: text10687 $ git clone https://github.com/pallets/flask107 $ git clone https://github.com/your-username/flask108 $ cd flask10990- 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.11194 .. code-block:: text9596 $ git remote add fork https://github.com/{username}/flask9798- Create a virtualenv.99100112 - Linux/macOS113114 .. code-block:: text115
6 unmodified lines
122123 > py -3 -m venv .venv124 > env\Scripts\activate125115- Upgrade pip and setuptools.126- Install the development dependencies, then install Flask in editable mode.127128 .. code-block:: text129119 $ python -m pip install --upgrade pip setuptools120121- Install the development dependencies, then install Flask in editable122 mode.123124 .. code-block:: text125130 $ python -m pip install -U pip setuptools wheel131 $ pip install -r requirements/dev.txt && pip install -e .132133- Install the pre-commit hooks.134135 .. code-block:: text136132 $ pre-commit install137 $ pre-commit install --install-hooks138139.. _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-fork145146.. _start coding:147148Start coding149~~~~~~~~~~~~150145- 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.153154 .. code-block:: text155156 $ git fetch origin157 $ git checkout -b your-branch-name origin/2.0.x158154 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.160161 .. code-block:: text162163 $ git fetch origin164 $ git checkout -b your-branch-name origin/main165162- 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`_.167168 - 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.170171- 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.175176 .. code-block:: text177172 $ git push --set-upstream fork your-branch-name178 $ git push --set-upstream origin your-branch-name179180.. _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-request183184.. _Running the tests:185186Running the tests187~~~~~~~~~~~~~~~~~188
19 unmodified lines
208Generating a report of lines that do not have test coverage can indicate209where to start contributing. Run ``pytest`` using ``coverage`` and210generate a report.211212If you are using GitHub Codespaces, ``coverage`` is already installed213so you can skip the installation command.214215.. code-block:: text216217 $ pip install coverage218 $ coverage run -m pytest
20 unmodified lines