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 fileTake 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 back1How to contribute to Flask2==========================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:11Merge branch '1.0.x'David Lordbefore adoption2236ba9
line 12why, one step back12* The ``#get-help`` channel on our Discord chat: https://discord.gg/t6rrQZHazure config, fix docs buildDavid Lordbefore adoptionbcf8cb1
line 13why, one step back13Merge branch '1.0.x'David Lordbefore adoption2236ba9
lines 14–15why, one step back14 * The IRC channel ``#pocoo`` on FreeNode is linked to Discord, but15 Discord is preferred.azure config, fix docs buildDavid Lordbefore adoptionbcf8cb1
line 16why, one step back16Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6
lines 17–39why, one step back17* 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------------------39Merge pull request #3213 from jab/contributingJoshua Bronsonbefore adoptionfe41c6c
lines 40–42why, one step back40- Use `Black`_ to autoformat your code. This should be done for you as a41 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 back43- Include tests if your patch is supposed to solve a bug, and explain44 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 back82.. _Fork: https://github.com/pallets/flask/forkMerge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6
lines 83–87why, one step back83.. _Clone: https://help.github.com/articles/fork-a-repo/#step-2-create-a-local-clone-of-your-fork8485Start coding86~~~~~~~~~~~~87Merge branch '1.0.x'David Lordbefore adoption2236ba9
lines 88–98why, one step back88- Create a branch to identify the issue you would like to work on. If89 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/master98Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6
lines 99–101why, one step back99- 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 back102- Push your commits to GitHub and `create a pull request`_ by using::103104 git push --set-upstream origin your-branch-name105Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6
lines 106–107why, one step back106- Celebrate 🎉107Merge pull request #2969 from codeaditya/update-linksDavid Lordbefore adoption7e714bd
line 108why, one step back108.. _committing as you go: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changesMerge pull request #3213 from jab/contributingJoshua Bronsonbefore adoptionfe41c6c
lines 109–111why, one step back109.. _Black: https://black.readthedocs.io110.. _Editor integration: https://black.readthedocs.io/en/stable/editor_integration.html111.. _pre-commit: https://pre-commit.comMerge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6
lines 112–127why, one step back112.. _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 multipleRemove python 2.6 and 3.3 everywhere. (#2583)Hsiaoming Yangbefore adoption60eecb5
lines 128–129why, one step back128combinations 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 back130131 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.149Merge pull request #2624 from pallets/metadataDavid Lordbefore adoption4309c7c
lines 150–160why, one step back150151Building 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.160Merge pull request #2969 from codeaditya/update-linksDavid Lordbefore adoption7e714bd
line 161why, one step back161Read more about `Sphinx <https://www.sphinx-doc.org>`_.Merge pull request #2624 from pallets/metadataDavid Lordbefore adoption4309c7c
lines 162–165why, one step back162163164make targets165~~~~~~~~~~~~Merge pull request #2352 from davidism/json-object-hookDavid Lordbefore adoption62406e6
lines 166–196why, one step back166167Flask 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.