Skip to content

Commit

Permalink
feat: switch to python 3.8 (#4239) (#4327)
Browse files Browse the repository at this point in the history
Python 3.7 has been end-of-life since 2023-06-27, and an increasing amount of our dependencies are dropping support for it as a consequence.

We introduced a warning to users that are still using Python 3.7 with release v1.86.0 around August 1, 2023.

We are now effectively dropping support for Python 3.7.

Related: 0ef7ace

Re-roll of #4239, which was reverted because the build & release pipeline failed. After some investigation this was because the job used a superchain image with python3.7. However after this change a minimum version of python 3.8 is required.

BREAKING CHANGE: jsii-pacmak and the libraries it generates for Python targets now require a minimum Python version of 3.8, instead of 3.7 previously. We recommend users upgrade to the latest supported Python release (Python 3.11).

---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
  • Loading branch information
mrgrain committed Nov 14, 2023
1 parent 7197b4f commit 416e2b5
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 55 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ jobs:
with:
cache: yarn
node-version: '18'
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'
cache: pip
- name: Install python3-venv
run: sudo apt install -y python3-venv
Expand Down Expand Up @@ -130,10 +130,10 @@ jobs:
with:
cache: yarn
node-version: '18'
- name: Set up Python 3.7
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.7'
python-version: '3.8'
cache: pip
- name: Install python3-venv
run: sudo apt install -y python3-venv
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
java: ['8']
node: ['18'] # EOL 2025-04-30
os: [ubuntu-latest]
python: ['3.7']
python: ['3.8']
# Add specific combinations to be tested against (to restrict cardinality)
include:
# Test using Windows
Expand All @@ -207,54 +207,54 @@ jobs:
go: '1.18'
java: '8'
node: '18'
python: '3.7'
python: '3.8'
# Test using macOS
- title: 'macOS'
os: macos-latest
dotnet: '6.0.x'
go: '1.18'
java: '8'
node: '18'
python: '3.7'
python: '3.8'
# Test alternate Nodes
- title: 'Node 18'
java: '8'
dotnet: '6.0.x'
go: '1.18'
node: '18' # EOL 2025-04-30
os: ubuntu-latest
python: '3.7'
python: '3.8'
- title: 'Node 20'
java: '8'
dotnet: '6.0.x'
go: '1.18'
node: '20' # EOL 2026-04-30
os: ubuntu-latest
python: '3.7'
python: '3.8'
# Test alternate .NETs
- title: '.NET 7.0'
java: '8'
dotnet: '7.0.x'
go: '1.18'
node: '18'
os: ubuntu-latest
python: '3.7'
python: '3.8'
# Test alternate Gos
- title: 'Go 1.19'
java: '8'
dotnet: '6.0.x'
go: '1.19'
node: '18'
os: ubuntu-latest
python: '3.7'
python: '3.8'
# Test alternate Javas
- title: 'Java 11'
java: '11'
dotnet: '6.0.x'
go: '1.18'
node: '18'
os: ubuntu-latest
python: '3.7'
python: '3.8'
# Test alternate Pythons
- title: 'Python 3.8'
python: '3.8'
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ in your development environment.
+ [`maven >= 3.0.5`](https://maven.apache.org)
- [.NET `6.0`] or later
+ *Recommended:* [`mono >= 6`](https://www.mono-project.com)
- [Python `3.7.3`] or later
- [Python `3.8.10`] or later
+ [`pip`](https://pip.pypa.io/en/stable/installing/)
+ [`setuptools >= 38.6.0`](https://pypi.org/project/setuptools/)
+ [`wheel`](https://pypi.org/project/wheel/)
Expand All @@ -57,7 +57,7 @@ in your development environment.
[Oracle's OpenJDK8]: http://openjdk.java.net/install/
[Amazon Corretto 8]: https://aws.amazon.com/corretto/
[.NET `6.0`]: https://www.microsoft.com/net/download
[Python `3.7.3`]: https://www.python.org/downloads/release/python-373/
[Python `3.8.10`]: https://www.python.org/downloads/release/python-3810/
[Go]: https://go.dev/dl/

## Getting Started
Expand Down
2 changes: 1 addition & 1 deletion gh-pages/content/user-guides/language-support/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ in significant re-engineering effort:
- How are dependencies modeled? If [semantic versioning] is not the norm, what is the strategy to correctly represent
semantic version ranges?
- What are the toolchain and platform requirements?
- For example, **Java** requires an OpenJDK 8 distribution and `maven`, **Python** requires `python` 3.7 or above,
- For example, **Java** requires an OpenJDK 8 distribution and `maven`, **Python** requires `python` 3.8 or above,
etc...

## Code Generation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ The `python` target requires two configuration entries:
- Additionally, the following `Programming Language ::` classifiers are already set (more could be added by the user
if relevant):
- `Programming Language :: Python :: 3 :: Only`
- `Programming Language :: Python :: 3.7`
- `Programming Language :: Python :: 3.8`
- `Programming Language :: Python :: 3.9`
- `Programming Language :: Python :: 3.10`
Expand Down
2 changes: 1 addition & 1 deletion gh-pages/content/user-guides/lib-author/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ to produce releasable artifacts.
| .NET | .NET ≥ 6.0 |
| Go | Go ≥ 1.18 |
| Java | JDK ≥ 8 *and* Maven ≥ 3.6 |
| Python | Python ≥ 3.7 |
| Python | Python ≥ 3.8 |


## :octicons-desktop-download-24: Download Locations
Expand Down
4 changes: 2 additions & 2 deletions packages/@jsii/python-runtime/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ requires = ["setuptools~=62.2", "wheel~=0.37"]
build-backend = 'setuptools.build_meta'

[tool.black]
target-version = ['py37', 'py38', 'py39', 'py310', 'py311']
target-version = ['py38', 'py39', 'py310', 'py311']
include = '\.pyi?$'
exclude = '\.(git|mypy_cache|env)'

[tool.mypy]
ignore_missing_imports = true

[tool.pyright]
pythonVersion = "3.7"
pythonVersion = "3.8"
venv = ".env"
venvPath = "."
5 changes: 2 additions & 3 deletions packages/@jsii/python-runtime/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@
"publication>=0.0.3", # This is used by all generated code.
"typeguard~=2.13.3", # This is used by all generated code.
"python-dateutil",
"typing_extensions>=3.7,<5.0",
"typing_extensions>=3.8,<5.0",
],
python_requires="~=3.7",
python_requires="~=3.8",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: JavaScript",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand Down
5 changes: 2 additions & 3 deletions packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2102,7 +2102,7 @@ class Package {
package_dir: { '': 'src' },
packages: modules.map((m) => m.pythonName),
package_data: packageData,
python_requires: '~=3.7',
python_requires: '~=3.8',
install_requires: [
`jsii${toPythonVersionRange(`^${VERSION}`)}`,
'publication>=0.0.3',
Expand All @@ -2115,7 +2115,6 @@ class Package {
'Operating System :: OS Independent',
'Programming Language :: JavaScript',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
Expand Down Expand Up @@ -2236,7 +2235,7 @@ class Package {
code.line();
code.line('[tool.pyright]');
code.line('defineConstant = { DEBUG = true }');
code.line('pythonVersion = "3.7"');
code.line('pythonVersion = "3.8"');
code.line('pythonPlatform = "All"');
code.line('reportSelfClsParameterName = false');
code.closeFile('pyproject.toml');
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 416e2b5

Please sign in to comment.