Skip to content
Myr

CONTRIBUTING.rst

This file

Path

CONTRIBUTING.rst

196 lines · 6.4 KiB

Last changed by

Merge pull request #3213 from jab/contributingJoshua Bronsonbefore adoptionfe41c6c

History of this file

Take it

The walk stopped after 200 commits: lines older than 62406e6 point at it.

Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6

lines 1–11why, one step back
1How to contribute to Flask
2==========================34Thank you for considering contributing to Flask!56Support questions7-----------------89Please, don't use the issue tracker for this. Use one of the following10resources for questions about your own code:11

Merge branch '1.0.x'David Lordbefore adoption2236ba9

line 12why, one step back
12* The ``#get-help`` channel on our Discord chat: https://discord.gg/t6rrQZH

azure config, fix docs buildDavid Lordbefore adoptionbcf8cb1

line 13why, one step back
13

Merge branch '1.0.x'David Lordbefore adoption2236ba9

lines 14–15why, one step back
14 * The IRC channel ``#pocoo`` on FreeNode is linked to Discord, but
15 Discord is preferred.

azure config, fix docs buildDavid Lordbefore adoptionbcf8cb1

line 16why, one step back
16

Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6

lines 17–39why, one step back
17* The mailing list flask@python.org for long term discussion or larger issues.
18* Ask on `Stack Overflow`_. Search with Google first using:19 ``site:stackoverflow.com flask {search term, exception message, etc.}``2021.. _Stack Overflow: https://stackoverflow.com/questions/tagged/flask?sort=linked2223Reporting issues24----------------2526- Describe what you expected to happen.27- If possible, include a `minimal, complete, and verifiable example`_ to help28 us identify the issue. This also helps check that the issue is not with your29 own code.30- Describe what actually happened. Include the full traceback if there was an31 exception.32- List your Python, Flask, and Werkzeug versions. If possible, check if this33 issue is already fixed in the repository.3435.. _minimal, complete, and verifiable example: https://stackoverflow.com/help/mcve3637Submitting patches38------------------39

Merge pull request #3213 from jab/contributingJoshua Bronsonbefore adoptionfe41c6c

lines 40–42why, one step back
40- Use `Black`_ to autoformat your code. This should be done for you as a
41 git `pre-commit`_ hook, which gets installed when you run ``pip install -e .[dev]``.42 You may also wish to use Black's `Editor integration`_.

Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6

lines 43–81why, one step back
43- Include tests if your patch is supposed to solve a bug, and explain
44 clearly under which circumstances the bug happens. Make sure the test fails45 without your patch.4647First time setup48~~~~~~~~~~~~~~~~4950- Download and install the `latest version of git`_.51- Configure git with your `username`_ and `email`_::5253 git config --global user.name 'your name'54 git config --global user.email 'your email'5556- Make sure you have a `GitHub account`_.57- Fork Flask to your GitHub account by clicking the `Fork`_ button.58- `Clone`_ your GitHub fork locally::5960 git clone https://github.com/{username}/flask61 cd flask6263- Add the main repository as a remote to update later::6465 git remote add pallets https://github.com/pallets/flask66 git fetch pallets6768- Create a virtualenv::6970 python3 -m venv env71 . env/bin/activate72 # or "env\Scripts\activate" on Windows7374- Install Flask in editable mode with development dependencies::7576 pip install -e ".[dev]"7778.. _GitHub account: https://github.com/join79.. _latest version of git: https://git-scm.com/downloads80.. _username: https://help.github.com/articles/setting-your-username-in-git/81.. _email: https://help.github.com/articles/setting-your-email-in-git/

Merge pull request #2676 from davidism/tutorialDavid Lordbefore adoptionc3e2ff2

line 82why, one step back
82.. _Fork: https://github.com/pallets/flask/fork

Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6

lines 83–87why, one step back
83.. _Clone: https://help.github.com/articles/fork-a-repo/#step-2-create-a-local-clone-of-your-fork
8485Start coding86~~~~~~~~~~~~87

Merge branch '1.0.x'David Lordbefore adoption2236ba9

lines 88–98why, one step back
88- Create a branch to identify the issue you would like to work on. If
89 you're submitting a bug or documentation fix, branch off of the90 latest ".x" branch::9192 git checkout -b your-branch-name origin/1.0.x9394 If you're submitting a feature addition or change, branch off of the95 "master" branch::9697 git checkout -b your-branch-name origin/master98

Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6

lines 99–101why, one step back
99- Using your favorite editor, make your changes, `committing as you go`_.
100- Include tests that cover any code changes you make. Make sure the test fails101 without your patch. `Run the tests. <contributing-testsuite_>`_.

Merge branch '1.0.x'David Lordbefore adoption2236ba9

lines 102–105why, one step back
102- Push your commits to GitHub and `create a pull request`_ by using::
103104 git push --set-upstream origin your-branch-name105

Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6

lines 106–107why, one step back
106- Celebrate 🎉
107

Merge pull request #2969 from codeaditya/update-linksDavid Lordbefore adoption7e714bd

line 108why, one step back
108.. _committing as you go: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes

Merge pull request #3213 from jab/contributingJoshua Bronsonbefore adoptionfe41c6c

lines 109–111why, one step back
109.. _Black: https://black.readthedocs.io
110.. _Editor integration: https://black.readthedocs.io/en/stable/editor_integration.html111.. _pre-commit: https://pre-commit.com

Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6

lines 112–127why, one step back
112.. _create a pull request: https://help.github.com/articles/creating-a-pull-request/
113114.. _contributing-testsuite:115116Running the tests117~~~~~~~~~~~~~~~~~118119Run the basic test suite with::120121 pytest122123This only runs the tests for the current environment. Whether this is relevant124depends on which part of Flask you're working on. Travis-CI will run the full125suite when you submit your pull request.126127The full test suite takes a long time to run because it tests multiple

Remove python 2.6 and 3.3 everywhere. (#2583)Hsiaoming Yangbefore adoption60eecb5

lines 128–129why, one step back
128combinations of Python and dependencies. You need to have Python 2.7, 3.4,
1293.5 3.6, and PyPy 2.7 installed to run all of the environments. Then run::

Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6

lines 130–149why, one step back
130
131 tox132133Running test coverage134~~~~~~~~~~~~~~~~~~~~~135136Generating a report of lines that do not have test coverage can indicate137where to start contributing. Run ``pytest`` using ``coverage`` and generate a138report on the terminal and as an interactive HTML document::139140 coverage run -m pytest141 coverage report142 coverage html143 # then open htmlcov/index.html144145Read more about `coverage <https://coverage.readthedocs.io>`_.146147Running the full test suite with ``tox`` will combine the coverage reports148from all runs.149

Merge pull request #2624 from pallets/metadataDavid Lordbefore adoption4309c7c

lines 150–160why, one step back
150
151Building the docs152~~~~~~~~~~~~~~~~~153154Build the docs in the ``docs`` directory using Sphinx::155156 cd docs157 make html158159Open ``_build/html/index.html`` in your browser to view the docs.160

Merge pull request #2969 from codeaditya/update-linksDavid Lordbefore adoption7e714bd

line 161why, one step back
161Read more about `Sphinx <https://www.sphinx-doc.org>`_.

Merge pull request #2624 from pallets/metadataDavid Lordbefore adoption4309c7c

lines 162–165why, one step back
162
163164make targets165~~~~~~~~~~~~

Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6

lines 166–196why, one step back
166
167Flask provides a ``Makefile`` with various shortcuts. They will ensure that168all dependencies are installed.169170- ``make test`` runs the basic test suite with ``pytest``171- ``make cov`` runs the basic test suite with ``coverage``172- ``make test-all`` runs the full test suite with ``tox``173- ``make docs`` builds the HTML documentation174175Caution: zero-padded file modes176-------------------------------177178This repository contains several zero-padded file modes that may cause issues179when pushing this repository to git hosts other than GitHub. Fixing this is180destructive to the commit history, so we suggest ignoring these warnings. If it181fails to push and you're using a self-hosted git service like GitLab, you can182turn off repository checks in the admin panel.183184These files can also cause issues while cloning. If you have ::185186 [fetch]187 fsckobjects = true188189or ::190191 [receive]192 fsckObjects = true193194set in your git configuration file, cloning this repository will fail. The only195solution is to set both of the above settings to false while cloning, and then196setting them back to true after the cloning is finished.