You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/CONTRIBUTING.rst
+34-19Lines changed: 34 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
How To Contribute
2
-
===================
2
+
=================
3
3
4
4
Every open source project lives from the generous help by contributors that sacrifice their time and ``python-telegram-bot`` is no different. To make participation as pleasant as possible, this project adheres to the `Code of Conduct`_ by the Python Software Foundation.
5
5
6
6
Setting things up
7
-
-------------------
7
+
-----------------
8
8
9
9
1. Fork the ``python-telegram-bot`` repository to your GitHub account.
10
10
11
11
2. Clone your forked repository of ``python-telegram-bot`` to your computer:
If you already know what you'd like to work on, you can skip this section.
41
41
@@ -44,7 +44,7 @@ If you have an idea for something to do, first check if it's already been filed
44
44
Another great way to start contributing is by writing tests. Tests are really important because they help prevent developers from accidentally breaking existing code, allowing them to build cool things faster. If you're interested in helping out, let the development team know by posting to the `developers' mailing list`_, and we'll help you get started.
45
45
46
46
Instructions for making a code change
47
-
####################
47
+
#####################################
48
48
49
49
The central development branch is ``master``, which should be clean and ready for release at any time. In general, all changes should be done as feature branches based off of ``master``.
50
50
@@ -89,7 +89,7 @@ Here's how to make a one-off code change.
89
89
90
90
.. code-block::
91
91
92
-
$ nosetests -v
92
+
$ pytest -v
93
93
94
94
- To actually make the commit (this will trigger tests for yapf, lint and pep8 automatically):
95
95
@@ -129,13 +129,19 @@ Here's how to make a one-off code change.
129
129
130
130
.. code-block:: bash
131
131
132
-
$ git checkout your-branch-name
133
-
$ git fetch upstream
134
-
$ git merge upstream/master
135
-
$ ...[fix the conflicts]...
136
-
$ ...[make sure the tests pass before committing]...
137
-
$ git commit -a
138
-
$ git push origin your-branch-name
132
+
$ git checkout your-branch-name
133
+
$ git fetch upstream
134
+
$ git merge upstream/master
135
+
$ ...[fix the conflicts]...
136
+
$ ...[make sure the tests pass before committing]...
137
+
$ git commit -a
138
+
$ git push origin your-branch-name
139
+
140
+
- If after merging you see local modified files in ``telegram/vendor/`` directory, that you didn't actually touch, that means you need to update submodules with this command:
141
+
142
+
.. code-block:: bash
143
+
144
+
$ git submodule update --init --recursive
139
145
140
146
- At the end, the reviewer will merge the pull request.
141
147
@@ -149,20 +155,29 @@ Here's how to make a one-off code change.
149
155
7. **Celebrate.** Congratulations, you have contributed to ``python-telegram-bot``!
150
156
151
157
Style commandments
152
-
---------------------
158
+
------------------
153
159
154
160
Specific commandments
155
161
#####################
156
162
157
163
- Avoid using "double quotes" where you can reasonably use 'single quotes'.
158
164
159
-
AssertEqual argument order
160
-
######################
165
+
Assert comparison order
166
+
#######################
161
167
162
-
- assertEqual method's arguments should be in ('actual', 'expected') order.
168
+
- assert statements should compare in **actual** == **expected** order.
169
+
For example (assuming ``test_call`` is the thing being tested):
170
+
171
+
.. code-block:: python
172
+
173
+
# GOOD
174
+
assert test_call() ==5
175
+
176
+
# BAD
177
+
assert5== test_call()
163
178
164
179
Properly calling callables
165
-
#######################
180
+
##########################
166
181
167
182
Methods, functions and classes can specify optional parameters (with default
168
183
values) using Python's keyword arg syntax. When providing a value to such a
@@ -180,7 +195,7 @@ This gives us the flexibility to re-order arguments and more importantly
180
195
to add new required arguments. It's also more explicit and easier to read.
181
196
182
197
Properly defining optional arguments
183
-
########################
198
+
####################################
184
199
185
200
It's always good to not initialize optional arguments at class creation,
186
201
instead use ``**kwargs`` to get them. It's well known Telegram API can
0 commit comments