Skip to content
Myr

use global contributing guide

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Remove the per-project files so we don't have to keep them in sync. GitHub's UI links to everything except the contributing guide, so add a section about that to the readme. (cherry picked from commit 60a11a730e8aa2450115385798ab8710804c6409)

authored by David Lord · committed by David Lord · parent 5b525e9 · Browse files · 5 files+18 added−317 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+18 added−317 removed

  • other:+18 added−317 removed

5 files+18 added−317 removed

modified:.github/ISSUE_TEMPLATE/config.yml+2 added-2 removed
modified:docs/contributing.rst+8 added-1 removed
1.. include:: ../CONTRIBUTING.rst1Contributing2============34See the Pallets `detailed contributing documentation <_contrib>`_ for many ways5to contribute, including reporting issues, requesting features, asking or6answering questions, and making PRs.78.. _contrib: https://palletsprojects.com/contributing/
deleted:CODE_OF_CONDUCT.md-76 removed
deleted:CONTRIBUTING.rst-238 removed
1How to contribute to Flask2==========================34Thank you for considering contributing to Flask!567Support questions8-----------------910Please don't use the issue tracker for this. The issue tracker is a tool11to address bugs and feature requests in Flask itself. Use one of the12following resources for questions about using Flask or issues with your13own code:1415- The ``#questions`` channel on our Discord chat:16 https://discord.gg/pallets17- Ask on `Stack Overflow`_. Search with Google first using:18 ``site:stackoverflow.com flask {search term, exception message, etc.}``19- Ask on our `GitHub Discussions`_ for long term discussion or larger20 questions.2122.. _Stack Overflow: https://stackoverflow.com/questions/tagged/flask?tab=Frequent23.. _GitHub Discussions: https://github.com/pallets/flask/discussions242526Reporting issues27----------------2829Include the following information in your post:3031- Describe what you expected to happen.32- If possible, include a `minimal reproducible example`_ to help us33 identify the issue. This also helps check that the issue is not with34 your own code.35- Describe what actually happened. Include the full traceback if there36 was an exception.37- List your Python and Flask versions. If possible, check if this38 issue is already fixed in the latest releases or the latest code in39 the repository.4041.. _minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example424344Submitting patches45------------------4647If there is not an open issue for what you want to submit, prefer48opening one for discussion before working on a PR. You can work on any49issue that doesn't have an open PR linked to it or a maintainer assigned50to it. These show up in the sidebar. No need to ask if you can work on51an issue that interests you.5253Include the following in your patch:5455- Use `Black`_ to format your code. This and other tools will run56 automatically if you install `pre-commit`_ using the instructions57 below.58- Include tests if your patch adds or changes code. Make sure the test59 fails without your patch.60- Update any relevant docs pages and docstrings. Docs pages and61 docstrings should be wrapped at 72 characters.62- Add an entry in ``CHANGES.rst``. Use the same style as other63 entries. Also include ``.. versionchanged::`` inline changelogs in64 relevant docstrings.6566.. _Black: https://black.readthedocs.io67.. _pre-commit: https://pre-commit.com686970First 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'100101- Fork Flask to your GitHub account by clicking the `Fork`_ button.102- `Clone`_ your fork locally, replacing ``your-username`` in the command below with103 your actual username.104105 .. code-block:: text106107 $ git clone https://github.com/your-username/flask108 $ cd flask109110- Create a virtualenv. Use the latest version of Python.111112 - Linux/macOS113114 .. code-block:: text115116 $ python3 -m venv .venv117 $ . .venv/bin/activate118119 - Windows120121 .. code-block:: text122123 > py -3 -m venv .venv124 > .venv\Scripts\activate125126- Install the development dependencies, then install Flask in editable mode.127128 .. code-block:: text129130 $ python -m pip install -U pip131 $ pip install -r requirements/dev.txt && pip install -e .132133- Install the pre-commit hooks.134135 .. code-block:: text136137 $ 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-address143.. _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~~~~~~~~~~~~150151- 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.x158159 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/main165166- 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:: text177178 $ 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~~~~~~~~~~~~~~~~~188189Run the basic test suite with pytest.190191.. code-block:: text192193 $ pytest194195This runs the tests for the current environment, which is usually196sufficient. CI will run the full suite when you submit your pull197request. You can run the full test suite with tox if you don't want to198wait.199200.. code-block:: text201202 $ tox203204205Running test coverage206~~~~~~~~~~~~~~~~~~~~~207208Generating 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 pytest219 $ coverage html220221Open ``htmlcov/index.html`` in your browser to explore the report.222223Read more about `coverage <https://coverage.readthedocs.io>`__.224225226Building the docs227~~~~~~~~~~~~~~~~~228229Build the docs in the ``docs`` directory using Sphinx.230231.. code-block:: text232233 $ cd docs234 $ make html235236Open ``_build/html/index.html`` in your browser to view the docs.237238Read more about `Sphinx <https://www.sphinx-doc.org/en/stable/>`__.
modified:README.md+8 added