@@ -3,86 +3,108 @@ How to contribute to Flask
3
3
4
4
Thank you for considering contributing to Flask!
5
5
6
+
6
7
Support questions
7
8
-----------------
8
9
9
10
Please, don't use the issue tracker for this. Use one of the following
10
11
resources for questions about your own code:
11
12
12
- * The ``#get-help `` channel on our Discord chat: https://discordapp.com/invite/t6rrQZH
13
+ - The ``#get-help `` channel on our Discord chat:
14
+ https://discord.gg/t6rrQZH
13
15
14
- * The IRC channel ``#pocoo `` on FreeNode is linked to Discord, but
15
- Discord is preferred.
16
+ - The IRC channel ``#pocoo `` on FreeNode is linked to Discord, but
17
+ Discord is preferred.
16
18
17
- * The mailing list
[email protected] 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.} ``
19
+ - The mailing list
[email protected] for long term discussion or larger
20
+ issues.
21
+ - Ask on `Stack Overflow `_. Search with Google first using:
22
+ ``site:stackoverflow.com flask {search term, exception message, etc.} ``
20
23
21
24
.. _Stack Overflow : https://stackoverflow.com/questions/tagged/flask?sort=linked
22
25
26
+
23
27
Reporting issues
24
28
----------------
25
29
26
- - Describe what you expected to happen.
27
- - If possible, include a `minimal reproducible example `_ to help us
28
- identify the issue. This also helps check that the issue is not with
29
- your own code.
30
- - Describe what actually happened. Include the full traceback if there was an
31
- exception.
32
- - List your Python, Flask, and Werkzeug versions. If possible, check if this
33
- issue is already fixed in the repository.
30
+ - Describe what you expected to happen.
31
+ - If possible, include a `minimal reproducible example `_ to help us
32
+ identify the issue. This also helps check that the issue is not with
33
+ your own code.
34
+ - Describe what actually happened. Include the full traceback if there
35
+ was an exception.
36
+ - List your Python, Flask, and Werkzeug versions. If possible, check
37
+ if this issue is already fixed in the repository.
34
38
35
39
.. _minimal reproducible example : https://stackoverflow.com/help/minimal-reproducible-example
36
40
41
+
37
42
Submitting patches
38
43
------------------
39
44
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 `_.
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 fails
45
- without your patch.
46
- - Include a string like "Fixes #123" in your commit message
47
- (where 123 is the issue you fixed).
48
- See ` Closing issues using keywords
49
- <https://help.github.com/articles/creating-a-pull-request/> `__.
45
+ - Use `Black `_ to autoformat your code. This should be done for you as
46
+ a Git `pre-commit `_ hook, set up below. You may also wish to use
47
+ Black's `Editor integration `_.
48
+ - Include tests if your patch is supposed to solve a bug, and explain
49
+ clearly under which circumstances the bug happens. Make sure the
50
+ test fails without your patch.
51
+ - Include a string like "Fixes #123" in your commit message (where 123
52
+ is the issue you fixed). See ` Closing issues using keywords
53
+ <https://help.github.com/articles/creating-a-pull-request/> `__.
54
+
50
55
51
56
First time setup
52
57
~~~~~~~~~~~~~~~~
53
58
54
- - Download and install the `latest version of git `_.
55
- - Configure git with your `username `_ and `email `_::
59
+ - Download and install the `latest version of git `_.
60
+ - Configure git with your `username `_ and `email `_.
61
+
62
+ .. code-block :: text
63
+
64
+ $ git config --global user.name 'your name'
65
+ $ git config --global user.email 'your email'
66
+
67
+ - Make sure you have a `GitHub account `_.
68
+ - Fork Flask to your GitHub account by clicking the `Fork `_ button.
69
+ - `Clone `_ your GitHub fork locally.
56
70
57
- git config --global user.name 'your name'
58
- git config --global user.email 'your email'
71
+ .. code-block :: text
59
72
60
- - Make sure you have a `GitHub account `_.
61
- - Fork Flask to your GitHub account by clicking the `Fork `_ button.
62
- - `Clone `_ your GitHub fork locally::
73
+ $ git clone https://github.com/{username}/flask
74
+ $ cd flask
63
75
64
- git clone https://github.com/{username}/flask
65
- cd flask
76
+ - Add the main repository as a remote to update later::
66
77
67
- - Add the main repository as a remote to update later::
78
+ .. code-block:: text
68
79
69
80
git remote add pallets https://github.com/pallets/flask
70
81
git fetch pallets
71
82
72
- - Create a virtualenv::
83
+ - Create a virtualenv.
84
+
85
+ .. code-block :: text
86
+
87
+ $ python3 -m venv env
88
+ $ . env/bin/activate
89
+
90
+ On Windows, activating is different.
91
+
92
+ .. code-block :: text
93
+
94
+ > env\Scripts\activate
95
+
96
+ - Install Flask in editable mode with development dependencies.
73
97
74
- python3 -m venv env
75
- . env/bin/activate
76
- # or "env\Scripts\activate" on Windows
98
+ .. code-block :: text
77
99
78
- - Install Flask in editable mode with development dependencies::
100
+ $ pip install -e ".[dev]"
79
101
80
- pip install -e ".[dev]"
102
+ - Install the `pre-commit framework `_.
103
+ - Install the pre-commit hooks.
81
104
82
- - Install the `pre-commit framework `_.
83
- - Install the pre-commit hooks::
105
+ .. code-block :: text
84
106
85
- pre-commit install --install-hooks
107
+ $ pre-commit install
86
108
87
109
.. _GitHub account : https://github.com/join
88
110
.. _latest version of git : https://git-scm.com/downloads
@@ -92,66 +114,79 @@ First time setup
92
114
.. _Clone : https://help.github.com/en/articles/fork-a-repo#step-2-create-a-local-clone-of-your-fork
93
115
.. _pre-commit framework : https://pre-commit.com/#install
94
116
117
+
95
118
Start coding
96
119
~~~~~~~~~~~~
97
120
98
121
- Create a branch to identify the issue you would like to work on. If
99
122
you're submitting a bug or documentation fix, branch off of the
100
- latest ".x" branch::
123
+ latest ".x" branch.
124
+
125
+ .. code-block :: text
101
126
102
- git checkout -b your-branch-name origin/1.0.x
127
+ $ git checkout -b your-branch-name origin/1.0.x
103
128
104
129
If you're submitting a feature addition or change, branch off of the
105
- "master" branch::
130
+ "master" branch.
131
+
132
+ .. code-block :: text
106
133
107
- git checkout -b your-branch-name origin/master
134
+ $ git checkout -b your-branch-name origin/master
108
135
109
- - Using your favorite editor, make your changes, `committing as you go `_.
110
- - Include tests that cover any code changes you make. Make sure the test fails
111
- without your patch. `Run the tests <contributing-testsuite _>`_.
112
- - Push your commits to GitHub and `create a pull request `_ by using::
136
+ - Using your favorite editor, make your changes,
137
+ `committing as you go `_.
138
+ - Include tests that cover any code changes you make. Make sure the
139
+ test fails without your patch.
140
+ `Run the tests <contributing-testsuite _>`_.
141
+ - Push your commits to GitHub and `create a pull request `_.
113
142
114
- git push --set-upstream origin your-branch-name
143
+ .. code-block :: text
115
144
116
- - Celebrate 🎉
145
+ $ git push --set-upstream origin your-branch-name
117
146
118
147
.. _committing as you go : https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes
119
148
.. _Black : https://black.readthedocs.io
120
149
.. _Editor integration : https://black.readthedocs.io/en/stable/editor_integration.html
121
150
.. _pre-commit : https://pre-commit.com
122
151
.. _create a pull request : https://help.github.com/en/articles/creating-a-pull-request
123
152
153
+
124
154
.. _contributing-testsuite : #running-the-tests
125
155
126
156
Running the tests
127
157
~~~~~~~~~~~~~~~~~
128
158
129
- Run the basic test suite with::
159
+ Run the basic test suite with pytest.
160
+
161
+ .. code-block :: text
130
162
131
- pytest
163
+ $ pytest
132
164
133
- This only runs the tests for the current environment. Whether this is relevant
134
- depends on which part of Flask you're working on. Travis- CI will run the full
135
- suite when you submit your pull request.
165
+ This only runs the tests for the current environment. Whether this is
166
+ relevant depends on which part of Flask you're working on. CI will run
167
+ the full suite when you submit your pull request.
136
168
137
169
The full test suite takes a long time to run because it tests multiple
138
170
combinations of Python and dependencies. If you don't have a Python
139
171
version installed, it will be skipped with a warning message at the end.
140
- Run::
141
172
142
- tox
173
+ .. code-block :: text
174
+
175
+ $ tox
176
+
143
177
144
178
Running test coverage
145
179
~~~~~~~~~~~~~~~~~~~~~
146
180
147
181
Generating a report of lines that do not have test coverage can indicate
148
- where to start contributing. Run ``pytest `` using ``coverage `` and generate a
149
- report on the terminal and as an interactive HTML document::
182
+ where to start contributing. Run ``pytest `` using ``coverage `` and
183
+ generate a report on the terminal and as an interactive HTML document.
184
+
185
+ .. code-block :: text
150
186
151
- coverage run -m pytest
152
- coverage report
153
- coverage html
154
- # then open htmlcov/index.html
187
+ $ coverage run -m pytest
188
+ $ coverage report
189
+ $ coverage html # then open htmlcov/index.html
155
190
156
191
Read more about `coverage <https://coverage.readthedocs.io >`_.
157
192
@@ -162,11 +197,12 @@ from all runs.
162
197
Building the docs
163
198
~~~~~~~~~~~~~~~~~
164
199
165
- Build the docs in the ``docs `` directory using Sphinx::
200
+ Build the docs in the ``docs `` directory using Sphinx.
201
+
202
+ .. code-block :: text
166
203
167
- cd docs
168
- pip install -r requirements.txt
169
- make html
204
+ $ cd docs
205
+ $ make html
170
206
171
207
Open ``_build/html/index.html `` in your browser to view the docs.
172
208
@@ -176,22 +212,23 @@ Read more about `Sphinx <https://www.sphinx-doc.org/en/master/>`_.
176
212
Caution: zero-padded file modes
177
213
-------------------------------
178
214
179
- This repository contains several zero-padded file modes that may cause issues
180
- when pushing this repository to git hosts other than GitHub. Fixing this is
181
- destructive to the commit history, so we suggest ignoring these warnings. If it
182
- fails to push and you're using a self-hosted git service like GitLab, you can
183
- turn off repository checks in the admin panel.
215
+ This repository contains several zero-padded file modes that may cause
216
+ issues when pushing this repository to Git hosts other than GitHub.
217
+ Fixing this is destructive to the commit history, so we suggest ignoring
218
+ these warnings. If it fails to push and you're using a self-hosted Git
219
+ service like GitLab, you can turn off repository checks in the admin
220
+ panel.
184
221
185
- These files can also cause issues while cloning. If you have ::
222
+ These files can also cause issues while cloning if you have
223
+ ``fsckObjects `` enabled with either of the following in your git config.
186
224
187
- [fetch]
188
- fsckobjects = true
225
+ .. code-block ::
189
226
190
- or ::
227
+ [fetch]
228
+ fsckObjects = true
191
229
192
230
[receive]
193
231
fsckObjects = true
194
232
195
- set in your git configuration file, cloning this repository will fail. The only
196
- solution is to set both of the above settings to false while cloning, and then
197
- setting them back to true after the cloning is finished.
233
+ The only solution is to set both of the above to ``false ``, clone, and
234
+ then set them back to ``true `` after.
0 commit comments