Skip to content

Commit 8f5f337

Browse files
chore(python): drop flake8-import-order in samples noxfile (#392)
* chore(python): drop flake8-import-order in samples noxfile Source-Link: googleapis/synthtool@6ed3a83 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb * fix replacement in owlbot.py * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent c320e2c commit 8f5f337

File tree

10 files changed

+223
-202
lines changed

10 files changed

+223
-202
lines changed

.github/.OwlBot.lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:7a40313731a7cb1454eef6b33d3446ebb121836738dc3ab3d2d3ded5268c35b6
16+
digest: sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Python
1313
uses: actions/setup-python@v4
1414
with:
15-
python-version: "3.10"
15+
python-version: "3.9"
1616
- name: Install nox
1717
run: |
1818
python -m pip install --upgrade setuptools pip wheel
@@ -28,7 +28,7 @@ jobs:
2828
- name: Setup Python
2929
uses: actions/setup-python@v4
3030
with:
31-
python-version: "3.10"
31+
python-version: "3.9"
3232
- name: Install nox
3333
run: |
3434
python -m pip install --upgrade setuptools pip wheel

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Python
1313
uses: actions/setup-python@v4
1414
with:
15-
python-version: "3.10"
15+
python-version: "3.8"
1616
- name: Install nox
1717
run: |
1818
python -m pip install --upgrade setuptools pip wheel

.github/workflows/unittest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Setup Python
4242
uses: actions/setup-python@v4
4343
with:
44-
python-version: "3.10"
44+
python-version: "3.8"
4545
- name: Install coverage
4646
run: |
4747
python -m pip install --upgrade setuptools pip wheel

.kokoro/docker/docs/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ RUN apt-get update \
6060
&& rm -rf /var/lib/apt/lists/* \
6161
&& rm -f /var/cache/apt/archives/*.deb
6262

63-
###################### Install python 3.8.11
63+
###################### Install python 3.9.13
6464

65-
# Download python 3.8.11
66-
RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz
65+
# Download python 3.9.13
66+
RUN wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz
6767

6868
# Extract files
69-
RUN tar -xvf Python-3.8.11.tgz
69+
RUN tar -xvf Python-3.9.13.tgz
7070

71-
# Install python 3.8.11
72-
RUN ./Python-3.8.11/configure --enable-optimizations
71+
# Install python 3.9.13
72+
RUN ./Python-3.9.13/configure --enable-optimizations
7373
RUN make altinstall
7474

7575
###################### Install pip

.kokoro/requirements.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ typing-extensions
55
twine
66
wheel
77
setuptools
8-
nox
8+
nox
9+
charset-normalizer<3
10+
click<8.1.0

.kokoro/requirements.txt

Lines changed: 193 additions & 161 deletions
Large diffs are not rendered by default.

noxfile.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,16 @@ def cover(session):
281281
session.run("coverage", "erase")
282282

283283

284-
@nox.session(python=DEFAULT_PYTHON_VERSION)
284+
@nox.session(python="3.9")
285285
def docs(session):
286286
"""Build the docs for this library."""
287287

288288
session.install("-e", ".")
289-
session.install("sphinx==4.0.1", "alabaster", "recommonmark")
289+
session.install(
290+
"sphinx==4.0.1",
291+
"alabaster",
292+
"recommonmark",
293+
)
290294

291295
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
292296
session.run(
@@ -311,13 +315,16 @@ def pytype(session):
311315
session.run("pytype", "google/cloud/pubsublite")
312316

313317

314-
@nox.session(python=DEFAULT_PYTHON_VERSION)
318+
@nox.session(python="3.9")
315319
def docfx(session):
316320
"""Build the docfx yaml files for this library."""
317321

318322
session.install("-e", ".")
319323
session.install(
320-
"sphinx==4.0.1", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml"
324+
"sphinx==4.0.1",
325+
"alabaster",
326+
"recommonmark",
327+
"gcp-sphinx-docfx-yaml",
321328
)
322329

323330
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)

owlbot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def default(session):
9999
# add pytype nox session
100100
s.replace("noxfile.py",
101101
"""
102-
@nox.session\(python=DEFAULT_PYTHON_VERSION\)
102+
@nox.session\(python="3.9"\)
103103
def docfx\(session\):""",
104104
"""
105105
@nox.session(python=DEFAULT_PYTHON_VERSION)
@@ -109,7 +109,7 @@ def pytype(session):
109109
session.install(PYTYPE_VERSION)
110110
session.run("pytype", "google/cloud/pubsublite")
111111
112-
@nox.session(python=DEFAULT_PYTHON_VERSION)
112+
@nox.session(python="3.9")
113113
def docfx(session):"""
114114
)
115115

samples/snippets/noxfile.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import os
1919
from pathlib import Path
2020
import sys
21-
from typing import Callable, Dict, List, Optional
21+
from typing import Callable, Dict, Optional
2222

2323
import nox
2424

@@ -109,22 +109,6 @@ def get_pytest_env_vars() -> Dict[str, str]:
109109
#
110110

111111

112-
def _determine_local_import_names(start_dir: str) -> List[str]:
113-
"""Determines all import names that should be considered "local".
114-
115-
This is used when running the linter to insure that import order is
116-
properly checked.
117-
"""
118-
file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
119-
return [
120-
basename
121-
for basename, extension in file_ext_pairs
122-
if extension == ".py"
123-
or os.path.isdir(os.path.join(start_dir, basename))
124-
and basename not in ("__pycache__")
125-
]
126-
127-
128112
# Linting with flake8.
129113
#
130114
# We ignore the following rules:
@@ -139,7 +123,6 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
139123
"--show-source",
140124
"--builtin=gettext",
141125
"--max-complexity=20",
142-
"--import-order-style=google",
143126
"--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py",
144127
"--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
145128
"--max-line-length=88",
@@ -149,14 +132,11 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
149132
@nox.session
150133
def lint(session: nox.sessions.Session) -> None:
151134
if not TEST_CONFIG["enforce_type_hints"]:
152-
session.install("flake8", "flake8-import-order")
135+
session.install("flake8")
153136
else:
154-
session.install("flake8", "flake8-import-order", "flake8-annotations")
137+
session.install("flake8", "flake8-annotations")
155138

156-
local_names = _determine_local_import_names(".")
157139
args = FLAKE8_COMMON_ARGS + [
158-
"--application-import-names",
159-
",".join(local_names),
160140
".",
161141
]
162142
session.run("flake8", *args)

0 commit comments

Comments
 (0)