Skip to content

Commit 2ac1fba

Browse files
authored
* add details about type hinting to authoring guide * update noxfile manually, update example config * add enforce_type_hints to default config
1 parent 5594899 commit 2ac1fba

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

noxfile-template.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
# You can opt out from the test for specific Python versions.
4040
'ignored_versions': ["2.7"],
4141

42+
# Old samples are opted out of enforcing Python type hints
43+
# All new samples should feature them
44+
'enforce_type_hints': False,
45+
4246
# An envvar key for determining the project id to use. Change it
4347
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
4448
# build specific Cloud project. You can also use your own string
@@ -133,7 +137,10 @@ def _determine_local_import_names(start_dir):
133137

134138
@nox.session
135139
def lint(session):
136-
session.install("flake8", "flake8-import-order")
140+
if not TEST_CONFIG['enforce_type_hints']:
141+
session.install("flake8", "flake8-import-order")
142+
else:
143+
session.install("flake8", "flake8-import-order", "flake8-annotations")
137144

138145
local_names = _determine_local_import_names(".")
139146
args = FLAKE8_COMMON_ARGS + [

noxfile_config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
TEST_CONFIG_OVERRIDE = {
2424
# You can opt out from the test for specific Python versions.
2525
'ignored_versions': ["2.7"],
26+
# Old samples are opted out of enforcing Python type hints
27+
# All new samples should feature them
28+
'enforce_type_hints': False,
2629

2730
# An envvar key for determining the project id to use. Change it
2831
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a

0 commit comments

Comments
 (0)