Skip to content

Commit

Permalink
feat: add support for Python 3.11 (googleapis#1973)
Browse files Browse the repository at this point in the history
* feat: add support for Python 3.11

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>

* fix: FutureWarning pandas

In a future version of pandas all arguments of StringMethods.rsplit except for the argument 'pat' will be keyword-only.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>

* fix: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0

With Python 3.11 `inspect.getargspec()` was removed. The recommendation
is to use `inspect.getfullargspec()`.

See: https://docs.python.org/3.10/library/inspect.html#inspect.getargspec

> Deprecated since version 3.0: Use `getfullargspec()` for an updated API
> that is usually a drop-in replacement, but also correctly handles
> function annotations and keyword-only parameters.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>

* add python 3.11 in template generation

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Remove python 3.11 samples check

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 30, 2022
1 parent 03f4753 commit 1106672
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 7 deletions.
6 changes: 4 additions & 2 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 and 3.10 on both UNIX and Windows.
3.7, 3.8, 3.9, 3.10 and 3.11 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 @@ -72,7 +72,7 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.

- To run a single unit test::

$ nox -s unit-3.10 -- -k <name of test>
$ nox -s unit-3.11 -- -k <name of test>


.. note::
Expand Down Expand Up @@ -225,11 +225,13 @@ We support:
- `Python 3.8`_
- `Python 3.9`_
- `Python 3.10`_
- `Python 3.11`_

.. _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/


Supported versions can be found in our ``noxfile.py`` `config`_.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ virtualenv <your-env>

## Supported Python Versions

Python 3.7, 3.8, 3.9 and 3.10 are fully supported and tested. This library may work on later versions of 3, but we do not currently run tests against those versions.
Python 3.7, 3.8, 3.9, 3.10 and 3.11 are fully supported and tested. This library may work on later versions of 3, but we do not currently run tests against those versions.

## Unsupported Python Versions

Expand Down
2 changes: 1 addition & 1 deletion googleapiclient/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def positional_wrapper(*args, **kwargs):
if isinstance(max_positional_args, int):
return positional_decorator
else:
args, _, _, defaults = inspect.getargspec(max_positional_args)
args, _, _, defaults, _, _, _ = inspect.getfullargspec(max_positional_args)
return positional(len(args) - len(defaults))(max_positional_args)


Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def format(session):
)


@nox.session(python=["3.7", "3.8", "3.9", "3.10"])
@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
@nox.parametrize(
"oauth2client",
[
Expand Down
4 changes: 3 additions & 1 deletion owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
# ----------------------------------------------------------------------------
# Add templated files
# ----------------------------------------------------------------------------
templated_files = common.py_library()
templated_files = common.py_library(
unit_test_python_versions=["3.7", "3.8", "3.9", "3.10", "3.11"],
)

# Copy kokoro configs.
# Docs are excluded as repo docs cannot currently be generated using sphinx.
Expand Down
2 changes: 1 addition & 1 deletion scripts/changesummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _get_discovery_differences(self, filename):
# Split the Key into 2 columns for `Parent` and `Child` in order
# to group keys with the same parents together to summarize the changes
# by parent.
parent_child_df = combined_docs["Key"].str.rsplit(".", 1, expand=True)
parent_child_df = combined_docs["Key"].str.rsplit(".", n=1, expand=True)
# Rename the columns and join them with the combined_docs dataframe.
# If we only have a `Parent` column, it means that the Key doesn't have
# any children.
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
Expand Down

0 comments on commit 1106672

Please sign in to comment.