Skip to content

Commit 2514a99

Browse files
authored
chore(python): remove hardcoded versions in CONTRIBUTING.rst (#1132)
1 parent b0eb8a8 commit 2514a99

1 file changed

Lines changed: 29 additions & 20 deletions

File tree

synthtool/gcp/templates/python_library/CONTRIBUTING.rst

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ In order to add a feature:
2222
documentation.
2323

2424
- The feature must work fully on the following CPython versions:
25-
3.6, 3.7, 3.8 and 3.9 on both UNIX and Windows.
25+
{% for v in unit_test_python_versions -%}
26+
{% if not loop.first -%}
27+
{% if not loop.last -%}, {% else %} and {% endif %}
28+
{%- endif %}
29+
{{- v -}}
30+
{%- endfor %} on both UNIX and Windows.
2631

2732
- The feature must not add unnecessary dependencies (where
2833
"unnecessary" is of course subjective, but new dependencies should
@@ -68,14 +73,15 @@ Using ``nox``
6873
We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.
6974

7075
- To test your changes, run unit tests with ``nox``::
71-
72-
$ nox -s unit-3.8
73-
$ ...
76+
{% for v in unit_test_python_versions %}
77+
$ nox -s unit-{{ v }}
78+
{%- endfor %}
7479

7580
- Args to pytest can be passed through the nox command separated by a `--`. For
7681
example, to run a single test::
7782

78-
$ nox -s unit-3.8 -- -k <name of test>
83+
$ nox -s unit-{{ unit_test_python_versions | last }} -- -k <name of test>
84+
7985

8086
.. note::
8187

@@ -142,15 +148,22 @@ Running System Tests
142148
- To run system tests, you can execute::
143149

144150
# Run all system tests
145-
$ nox -s system-3.8
151+
{%- for system_test_version in system_test_python_versions %}
152+
$ nox -s system-{{ system_test_version }}
153+
{%- endfor %}
146154

147155
# Run a single system test
148-
$ nox -s system-3.8 -- -k <name of test>
156+
$ nox -s system-{{ system_test_python_versions | last}} -- -k <name of test>
149157

150158

151159
.. note::
152160

153-
System tests are only configured to run under Python 3.8.
161+
System tests are only configured to run under Python
162+
{%- for v in system_test_python_versions -%}
163+
{% if not loop.first -%}
164+
{% if not loop.last %},{% else %} and{% endif -%}
165+
{% endif %} {{ v -}}
166+
{% endfor -%}.
154167
For expediency, we do not run them in older versions of Python 3.
155168

156169
This alone will not run the tests. You'll need to change some local
@@ -199,24 +212,20 @@ Supported Python Versions
199212

200213
We support:
201214

202-
- `Python 3.6`_
203-
- `Python 3.7`_
204-
- `Python 3.8`_
205-
- `Python 3.9`_
206-
207-
.. _Python 3.6: https://docs.python.org/3.6/
208-
.. _Python 3.7: https://docs.python.org/3.7/
209-
.. _Python 3.8: https://docs.python.org/3.8/
210-
.. _Python 3.9: https://docs.python.org/3.9/
211-
215+
{% for v in unit_test_python_versions -%}
216+
- `Python {{ v -}}`_
217+
{% endfor %}
218+
{% for v in unit_test_python_versions -%}
219+
.. _Python {{ v -}}: https://docs.python.org/{{- v -}}/
220+
{% endfor %}
212221

213222
Supported versions can be found in our ``noxfile.py`` `config`_.
214223

215224
.. _config: https://github.com/{{ metadata['repo']['repo'] }}/blob/master/noxfile.py
216225

217226

218-
We also explicitly decided to support Python 3 beginning with version
219-
3.6. Reasons for this include:
227+
We also explicitly decided to support Python 3 beginning with version {{ unit_test_python_versions | first }}.
228+
Reasons for this include:
220229

221230
- Encouraging use of newest versions of Python 3
222231
- Taking the lead of `prominent`_ open-source `projects`_

0 commit comments

Comments
 (0)