Skip to content

Commit ffbd77b

Browse files
chalmerloweohmayr
authored andcommitted
chore: adds noxfile, updates setup.py, and adds symlink to CHANGELOG
1 parent f5a71b1 commit ffbd77b

3 files changed

Lines changed: 113 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../CHANGELOG.md
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Copyright 2021 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
import nox
17+
18+
DEFAULT_PYTHON_VERSION = "3.14"
19+
UNIT_TEST_PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
20+
21+
ALL_PYTHON = list(UNIT_TEST_PYTHON_VERSIONS)
22+
# ALL_PYTHON.extend(["3.7"]) # User said NOT to include 3.7
23+
24+
nox.options.sessions = [
25+
"format",
26+
"lint",
27+
"lint_setup_py",
28+
"mypy",
29+
"unit",
30+
"docs",
31+
"prerelease_deps",
32+
"core_deps_from_source",
33+
]
34+
35+
def _skip_if_37(session):
36+
if session.python in ("3.7",):
37+
session.skip("Python 3.7 is no longer supported")
38+
39+
@nox.session(python=DEFAULT_PYTHON_VERSION)
40+
def mypy(session):
41+
"""Run the type checker."""
42+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
43+
# Add mypy tests
44+
session.skip("mypy tests are not yet supported")
45+
46+
@nox.session(python=DEFAULT_PYTHON_VERSION)
47+
def core_deps_from_source(session):
48+
"""Run all tests with core dependencies installed from source
49+
rather than pulling the dependencies from PyPI.
50+
"""
51+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
52+
# Add core deps from source tests
53+
session.skip("Core deps from source tests are not yet supported")
54+
55+
@nox.session(python=DEFAULT_PYTHON_VERSION)
56+
def prerelease_deps(session):
57+
"""Run all tests with prerelease versions of dependencies installed.
58+
"""
59+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16014):
60+
# Add prerelease deps tests
61+
session.skip("prerelease deps tests are not yet supported")
62+
63+
@nox.session
64+
def format(session: nox.sessions.Session) -> None:
65+
"""
66+
Run isort to sort imports. Then run black
67+
to format code to uniform standard.
68+
"""
69+
_skip_if_37(session)
70+
session.install("black", "isort")
71+
python_files = [path for path in os.listdir(".") if path.endswith(".py")]
72+
if not python_files:
73+
pass
74+
75+
# Use the --fss option to sort imports using strict alphabetical order.
76+
# See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
77+
session.run("isort", "--fss", *python_files)
78+
session.run("black", *python_files)
79+
80+
@nox.session(python=DEFAULT_PYTHON_VERSION)
81+
def lint(session):
82+
"""Run linter."""
83+
_skip_if_37(session)
84+
session.install("flake8")
85+
session.run("flake8", ".")
86+
87+
@nox.session(python=DEFAULT_PYTHON_VERSION)
88+
def lint_setup_py(session):
89+
"""Lint setup.py."""
90+
_skip_if_37(session)
91+
session.install("setuptools", "flake8")
92+
session.run("flake8", "setup.py")
93+
94+
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
95+
def unit(session):
96+
"""Run unit tests."""
97+
_skip_if_37(session)
98+
session.install("-r", "requirements.txt")
99+
session.install("pytest")
100+
session.run("pytest", "tests")
101+
102+
@nox.session(python="3.10")
103+
def docs(session):
104+
"""Build documentation."""
105+
_skip_if_37(session)
106+
session.install("-r", "requirements.txt")
107+
session.install("sphinx", "sphinx-docfx-yaml")
108+
session.run("sphinx-build", "-b", "html", "docs", "docs/_build/html")

packages/gcp-sphinx-docfx-yaml/setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@
5353
package_dir={'': '.'},
5454
packages=packages,
5555
install_requires=dependencies,
56-
python_requires=">=3.10",
56+
python_requires=">=3.8",
57+
classifiers=[
58+
"Programming Language :: Python :: 3.8",
59+
],
5760
include_package_data=True,
5861
zip_safe=False,
5962
**extra_setup

0 commit comments

Comments
 (0)