Skip to content

Commit

Permalink
Update base python to 3.12
Browse files Browse the repository at this point in the history
Upgrading to python 3.12 provides a ton of benefits both in authoring
and in runtime performance. Of particular note is the new type param
syntax, which will massively improve the readability of the
relatively large amount of generic typing that we make use of. In
addition, there's huge performance gains in asyncio as a whole.

This does not update any python code, only the configurations.
  • Loading branch information
JordonPhillips committed Mar 12, 2024
1 parent 6bcf0cd commit 22dad67
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The code generator, `smithy-python-codegen`, hasn't been published yet, so
you'll need to build it yourself. To build and run the generator you will need
the following prerequisites:

* Python 3.11 or newer
* Python 3.12 or newer
* (optional) Install [black](https://black.readthedocs.io/en/stable/) in your
environment to have the generated output be auto-formatted.
* The [Smithy CLI](https://smithy.io/2.0/guides/smithy-cli/cli_installation.html)
Expand Down Expand Up @@ -230,7 +230,7 @@ needed. Currently, pants requires python 3.7, 3.8, or 3.9 to run, so one of
those must be available on your path. (It doesn't have to be the version that
is linked to `python` or `python3`, it just needs `python3.9` etc.) It is,
however, fully capable of building and working with code that uses newer python
versions like we do. This repository uses a minimum python version of 3.11
versions like we do. This repository uses a minimum python version of 3.12
for all its packages, so you will need that too to work on it.

Pants provides a number of python commands it calls goals, documented
Expand Down
2 changes: 1 addition & 1 deletion codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ clients.

#### Optional Prerequisites - Python

* Python 3.11 is required to run the generated code, but not run the generator.
* Python 3.12 is required to run the generated code, but not run the generator.
If it is present on the path, the generator will use it for linting and
formatting.
* Use of a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void customizeAfterIntegrations(CustomizeDirective<GenerationContext, Pyt
int minorVersion = Integer.parseInt(matcher.group("minor"));
if (minorVersion < 11) {
LOGGER.warning(format("""
Found incompatible python version 3.%s.%s, expected 3.11.0 or greater. \
Found incompatible python version 3.%s.%s, expected 3.12.0 or greater. \
Skipping formatting and type checking.""",
matcher.group("minor"), matcher.group("patch")));
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private static void writePyproject(
version = $2S
description = $3S
readme = "README.md"
requires-python = ">=3.11"
requires-python = ">=3.12"
keywords = ["smithy", $1S]
license = {text = "Apache-2.0"}
classifiers = [
Expand All @@ -87,7 +87,7 @@ private static void writePyproject(
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11"
"Programming Language :: Python :: 3.12"
]
""", settings.getModuleName(), settings.getModuleVersion(), settings.getModuleDescription());

Expand Down
24 changes: 16 additions & 8 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ root_patterns = [
]

[python]
interpreter_constraints = [">=3.11"]
interpreter_constraints = [">=3.12"]
pip_version = "latest"
enable_resolves = true
resolves = { python-default = "python-default.lock" }
Expand All @@ -38,34 +38,42 @@ use_coverage = true

[black]
install_from_resolve = "python-default"
args = ["-t py311"]
interpreter_constraints = [">=3.11"]
args = ["-t py312"]
interpreter_constraints = [">=3.12"]

[coverage-py]
interpreter_constraints = [">=3.11"]
install_from_resolve = "python-default"
interpreter_constraints = [">=3.12"]
report = [
"xml",
"html"
]

[mypy]
install_from_resolve = "python-default"
interpreter_constraints = [">=3.11"]
interpreter_constraints = [">=3.12"]

[flake8]
install_from_resolve = "python-default"
args = "--extend-ignore=W503"

[pyupgrade]
args = ["--py311-plus"]
interpreter_constraints = [">=3.11"]
install_from_resolve = "python-default"
args = ["--py312-plus"]
interpreter_constraints = [">=3.12"]

[docformatter]
install_from_resolve = "python-default"
args = ["--wrap-summaries 88", "--wrap-descriptions 88"]
interpreter_constraints = [">=3.11"]
interpreter_constraints = [">=3.12"]

[bandit]
install_from_resolve = "python-default"
args = ["-x tests"]

[isort]
install_from_resolve = "python-default"
interpreter_constraints = [">=3.12"]

[anonymous-telemetry]
enabled = false
4 changes: 2 additions & 2 deletions python-packages/smithy-aws-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Core libraries for Smithy defined AWS services in Python."
readme = "README.md"
authors = [{name = "Amazon Web Services"}]
keywords = ["aws", "python", "sdk", "amazon", "smithy", "codegen"]
requires-python = ">=3.11"
requires-python = ">=3.12"
license = {text = "Apache License 2.0"}
classifiers = [
"Development Status :: 2 - Pre-Alpha",
Expand All @@ -21,7 +21,7 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries"
]
Expand Down
3 changes: 1 addition & 2 deletions python-packages/smithy-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Core library for Smithy defined services in Python."
readme = "README.md"
authors = [{name = "Amazon Web Services"}]
keywords = ["aws", "python", "sdk", "amazon", "smithy", "codegen"]
requires-python = ">=3.11"
requires-python = ">=3.12"
license = {text = "Apache License 2.0"}
classifiers = [
"Development Status :: 2 - Pre-Alpha",
Expand All @@ -21,7 +21,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries"
Expand Down
3 changes: 1 addition & 2 deletions python-packages/smithy-http/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Core HTTP library for Smithy defined services in Python."
readme = "README.md"
authors = [{name = "Amazon Web Services"}]
keywords = ["aws", "python", "sdk", "amazon", "smithy", "codegen", "http"]
requires-python = ">=3.11"
requires-python = ">=3.12"
license = {text = "Apache License 2.0"}
classifiers = [
"Development Status :: 2 - Pre-Alpha",
Expand All @@ -21,7 +21,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Libraries"
Expand Down
4 changes: 4 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ pytest<=7.4
pytest-asyncio<0.21.0
pytest-cov<=4.1.0
freezegun<1.3.0
pyupgrade<3.16.0
isort<5.14.0
docformatter<1.7.5
bandit<1.8.0

0 comments on commit 22dad67

Please sign in to comment.