Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ branchProtectionRules:
- 'Kokoro system-3.12'
- 'cla/google'
- 'Samples - Lint'
- 'Samples - Python 3.8'
- 'Samples - Python 3.9'
- 'Samples - Python 3.12'
4 changes: 2 additions & 2 deletions .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9
- name: Install nox
run: python -m pip install nox
- name: Check formatting
Expand All @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout code
Expand Down
40 changes: 0 additions & 40 deletions .kokoro/samples/python3.7/common.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.7/continuous.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions .kokoro/samples/python3.7/periodic-head.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.7/periodic.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.7/presubmit.cfg

This file was deleted.

40 changes: 0 additions & 40 deletions .kokoro/samples/python3.8/common.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.8/continuous.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions .kokoro/samples/python3.8/periodic-head.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.8/periodic.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions .kokoro/samples/python3.8/presubmit.cfg

This file was deleted.

16 changes: 6 additions & 10 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ In order to add a feature:
documentation.

- The feature must work fully on the following CPython versions:
3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13 on both UNIX and Windows.
3.9, 3.10, 3.11, 3.12 and 3.13 on both UNIX and Windows.

- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
Expand Down Expand Up @@ -143,12 +143,12 @@ Running System Tests
$ nox -s system

# Run a single system test
$ nox -s system-3.8 -- -k <name of test>
$ nox -s system-3.12 -- -k <name of test>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we having a higher version here?



.. note::

System tests are only configured to run under Python 3.8.
System tests are only configured to run under Python 3.12.
For expediency, we do not run them in older versions of Python 3.

This alone will not run the tests. You'll need to change some local
Expand Down Expand Up @@ -195,11 +195,11 @@ configure them just like the System Tests.

# Run all tests in a folder
$ cd samples/samples
$ nox -s py-3.8
$ nox -s py-3.9

# Run a single sample test
$ cd samples/samples
$ nox -s py-3.8 -- -k <name of test>
$ nox -s py-3.9 -- -k <name of test>

********************************************
Note About ``README`` as it pertains to PyPI
Expand All @@ -221,16 +221,12 @@ Supported Python Versions

We support:

- `Python 3.7`_
- `Python 3.8`_
- `Python 3.9`_
- `Python 3.10`_
- `Python 3.11`_
- `Python 3.12`_
- `Python 3.13`_

.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
.. _Python 3.9: https://docs.python.org/3.9/
.. _Python 3.10: https://docs.python.org/3.10/
.. _Python 3.11: https://docs.python.org/3.11/
Expand All @@ -243,7 +239,7 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
.. _config: https://github.com/googleapis/python-spanner/blob/main/noxfile.py


We also explicitly decided to support Python 3 beginning with version 3.7.
We also explicitly decided to support Python 3 beginning with version 3.9.
Reasons for this include:

- Encouraging use of newest versions of Python 3
Expand Down
5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ dependencies.

Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.7
Python >= 3.9

Deprecated Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^
Python == 2.7.
Python == 3.5.
Python == 3.6.

Python == 3.7.
Python == 3.8.

Mac/Linux
^^^^^^^^^
Expand Down
9 changes: 3 additions & 6 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.12"]

UNIT_TEST_PYTHON_VERSIONS: List[str] = [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
Expand Down Expand Up @@ -78,8 +76,6 @@
CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()

nox.options.sessions = [
# TODO(https://github.com/googleapis/python-spanner/issues/1392):
# Remove or restore testing for Python 3.7/3.8
"unit-3.9",
"unit-3.10",
"unit-3.11",
Expand Down Expand Up @@ -516,11 +512,12 @@ def prerelease_deps(session, protobuf_implementation, database_dialect):
constraints_deps = [
match.group(1)
for match in re.finditer(
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
r"^\s*([a-zA-Z0-9._-]+)", constraints_text, flags=re.MULTILINE
)
]

session.install(*constraints_deps)
if constraints_deps:
session.install(*constraints_deps)

prerel_deps = [
"protobuf",
Expand Down
13 changes: 13 additions & 0 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ def get_staging_dirs(
".github/release-please.yml",
".kokoro/test-samples-impl.sh",
".kokoro/presubmit/presubmit.cfg",
".kokoro/samples/python3.7/**",
".kokoro/samples/python3.8/**",
],
)

Expand All @@ -259,6 +261,17 @@ def get_staging_dirs(

python.py_samples()

s.replace(
"samples/**/noxfile.py",
'BLACK_VERSION = "black==22.3.0"',
'BLACK_VERSION = "black==23.7.0"',
)
s.replace(
"samples/**/noxfile.py",
r'ALL_VERSIONS = \["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"\]',
'ALL_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]',
)

# Use a python runtime which is available in the owlbot post processor here
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
s.shell.run(["nox", "-s", "blacken-3.10"], hide_output=False)
4 changes: 2 additions & 2 deletions samples/samples/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# WARNING - WARNING - WARNING - WARNING - WARNING
# WARNING - WARNING - WARNING - WARNING - WARNING

BLACK_VERSION = "black==22.3.0"
BLACK_VERSION = "black==23.7.0"
ISORT_VERSION = "isort==5.10.1"

# Copy `noxfile_config.py` to your directory and modify it instead.
Expand Down Expand Up @@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:

# DO NOT EDIT - automatically generated.
# All versions used to test samples.
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
ALL_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"]

# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
Expand Down
4 changes: 2 additions & 2 deletions samples/samples/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1591,9 +1591,9 @@ def __init__(self):
super().__init__("commit_stats_sample")

def info(self, msg, *args, **kwargs):
if kwargs["extra"] and "commit_stats" in kwargs["extra"]:
if "extra" in kwargs and kwargs["extra"] and "commit_stats" in kwargs["extra"]:
self.last_commit_stats = kwargs["extra"]["commit_stats"]
super().info(msg)
super().info(msg, *args, **kwargs)

spanner_client = spanner.Client()
instance = spanner_client.instance(instance_id)
Expand Down
13 changes: 10 additions & 3 deletions samples/samples/snippets_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,13 +680,20 @@ def test_write_with_dml_transaction(capsys, instance_id, sample_database):


@pytest.mark.dependency(depends=["add_column"])
def update_data_with_partitioned_dml(capsys, instance_id, sample_database):
def test_update_data_with_partitioned_dml(capsys, instance_id, sample_database):
snippets.update_data_with_partitioned_dml(instance_id, sample_database.database_id)
out, _ = capsys.readouterr()
assert "3 record(s) updated" in out
assert "3 records updated" in out


@pytest.mark.dependency(depends=["insert_with_dml"])
@pytest.mark.dependency(
depends=[
"insert_with_dml",
"dml_write_read_transaction",
"log_commit_stats",
"set_max_commit_delay",
]
)
def test_delete_data_with_partitioned_dml(capsys, instance_id, sample_database):
snippets.delete_data_with_partitioned_dml(instance_id, sample_database.database_id)
out, _ = capsys.readouterr()
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand All @@ -99,7 +97,7 @@
packages=packages,
install_requires=dependencies,
extras_require=extras,
python_requires=">=3.7",
python_requires=">=3.9",
include_package_data=True,
zip_safe=False,
)
Loading