Skip to content

Commit 4726bf3

Browse files
partheaclundin25
andauthored
feat: Add support for Python 3.12 (#1421)
* feat: Add support for Python 3.12 * Add samples lint session * Add constraints file for python 3.12 * chore: Refresh system test creds. * only run specified nox session for samples --------- Co-authored-by: Carl Lundin <clundin@google.com>
1 parent 7a0e5b2 commit 4726bf3

2 files changed

Lines changed: 42 additions & 5 deletions

File tree

auth/cloud-client-temp/authenticate_implicit_with_adc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ def authenticate_implicit_with_adc(project_id="your-google-cloud-project-id"):
4343
print(bucket.name)
4444
print("Listed all storage buckets.")
4545

46-
# [END auth_cloud_implicit_adc]
46+
# [END auth_cloud_implicit_adc]

auth/cloud-client-temp/noxfile.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
1615
import pathlib
17-
import shutil
1816

1917
import nox
2018

@@ -33,7 +31,36 @@
3331
"docs/conf.py",
3432
]
3533

36-
@nox.session(python=["3.7", "3.8", "3.9", "3.10"])
34+
35+
# Error if a python version is missing
36+
nox.options.error_on_missing_interpreters = True
37+
38+
#
39+
# Style Checks
40+
#
41+
42+
43+
# Linting with flake8.
44+
#
45+
# We ignore the following rules:
46+
# E203: whitespace before ‘:’
47+
# E266: too many leading ‘#’ for block comment
48+
# E501: line too long
49+
# I202: Additional newline in a section of imports
50+
#
51+
# We also need to specify the rules which are ignored by default:
52+
# ['E226', 'W504', 'E126', 'E123', 'W503', 'E24', 'E704', 'E121']
53+
FLAKE8_COMMON_ARGS = [
54+
"--show-source",
55+
"--builtin=gettext",
56+
"--max-complexity=20",
57+
"--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py",
58+
"--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
59+
"--max-line-length=88",
60+
]
61+
62+
63+
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"])
3764
def unit(session):
3865
# constraints_path = str(
3966
# CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
@@ -45,4 +72,14 @@ def unit(session):
4572
f"--junitxml=unit_{session.python}_sponge_log.xml",
4673
"snippets_test.py",
4774
# "tests_async",
48-
)
75+
)
76+
77+
78+
@nox.session
79+
def lint(session: nox.sessions.Session) -> None:
80+
session.install("flake8")
81+
82+
args = FLAKE8_COMMON_ARGS + [
83+
".",
84+
]
85+
session.run("flake8", *args)

0 commit comments

Comments
 (0)