Skip to content

Commit

Permalink
chore: drop support for Python 3.6 (EOL as of 2021-12-23) (#3472)
Browse files Browse the repository at this point in the history
Python 3.6 has been end-of-life since late december 2021, 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.6 with
release `v1.55.1` around March 16, 2022.

We are now effectively dropping support for Python 3.6, and introducing
testing for Python 3.10 releases.

Related: 919f735

BREAKING CHANGE: `jsii-pacmak` and the libraries it generates for Python
targets now require a minimum Python version of 3.7, instead of 3.6
previously. We recommend users upgrade to the latest supported Python
release (Python 3.10).
  • Loading branch information
RomainMuller authored Apr 25, 2022
1 parent 6db62b9 commit abf7415
Show file tree
Hide file tree
Showing 17 changed files with 102 additions and 82 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
with:
cache: yarn
node-version: '12'
- name: Set up Python 3.6
- name: Set up Python 3.7
uses: actions/setup-python@v3
with:
python-version: '3.6'
python-version: '3.7'
- name: Install python3-venv
run: sudo apt install -y python3-venv
- name: Locate Caches
Expand All @@ -69,9 +69,9 @@ jobs:
!~/.m2/repository/software/amazon/jsii/
~/.nuget/packages
!~/.nuget/packages/amazon.jsii.*
key: ${{ runner.os }}-node@12-python@3.6-${{ hashFiles('**/yarn.lock', '**/Directory.Build.targets') }}
key: ${{ runner.os }}-node@12-python@3.7-${{ hashFiles('**/yarn.lock', '**/Directory.Build.targets') }}
restore-keys: |-
${{ runner.os }}-node@12-python@3.6-
${{ runner.os }}-node@12-python@3.7-
${{ runner.os }}-node@12-
${{ runner.os }}-
# Prepare dependencies and build
Expand Down Expand Up @@ -139,10 +139,10 @@ jobs:
with:
cache: yarn
node-version: '12'
- name: Set up Python 3.6
- name: Set up Python 3.7
uses: actions/setup-python@v3
with:
python-version: '3.6'
python-version: '3.7'
- name: Install python3-venv
run: sudo apt install -y python3-venv
- name: Locate Caches
Expand All @@ -163,9 +163,9 @@ jobs:
!~/.m2/repository/software/amazon/jsii/
~/.nuget/packages
!~/.nuget/packages/amazon.jsii.*
key: ${{ runner.os }}-node@12-python@3.6-${{ hashFiles('**/yarn.lock', '**/Directory.Build.targets') }}
key: ${{ runner.os }}-node@12-python@3.7-${{ hashFiles('**/yarn.lock', '**/Directory.Build.targets') }}
restore-keys: |-
${{ runner.os }}-node@12-python@3.6-
${{ runner.os }}-node@12-python@3.7-
${{ runner.os }}-node@12-
${{ runner.os }}-
# Prepare dependencies and build
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
java: ['8']
node: ['12', '14', '16', '17']
os: [ubuntu-latest]
python: ['3.6']
python: ['3.7']
# Add specific combinations to be tested against "node 12" (to restrict cardinality)
include:
# Test using Windows
Expand All @@ -224,48 +224,48 @@ jobs:
go: '1.16'
java: '8'
node: '12'
python: '3.6'
python: '3.7'
# Test using macOS
- os: macos-latest
dotnet: '3.1.x'
go: '1.16'
java: '8'
node: '12'
python: '3.6'
python: '3.7'
# Test alternate .NETs
- java: '8'
dotnet: '5.0.x'
go: '1.16'
node: '12'
os: ubuntu-latest
python: '3.6'
python: '3.7'
- java: '8'
dotnet: '6.0.x'
go: '1.16'
node: '12'
os: ubuntu-latest
python: '3.6'
python: '3.7'
# Test alternate Javas
- java: '11'
dotnet: '3.1.x'
go: '1.16'
node: '12'
os: ubuntu-latest
python: '3.6'
python: '3.7'
# Test alternate Pythons
- python: '3.7'
- python: '3.8'
dotnet: '3.1.x'
go: '1.16'
java: '8'
node: '12'
os: ubuntu-latest
- python: '3.8'
- python: '3.9'
dotnet: '3.1.x'
go: '1.16'
java: '8'
node: '12'
os: ubuntu-latest
- python: '3.9'
- python: '3.10'
dotnet: '3.1.x'
go: '1.16'
java: '8'
Expand Down
16 changes: 8 additions & 8 deletions .mergify/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ queue_rules:
# One test for Java 8 and 11
- status-success~=^Test \(.* java 8 .*$
- status-success~=^Test \(.* java 11 .*$
# One test for Python 3.6 through 3.9
- status-success~=^Test \(.* python 3\.6[ )].*$
# One test for Python 3.7 through 3.10
- status-success~=^Test \(.* python 3\.7[ )].*$
- status-success~=^Test \(.* python 3\.8[ )].*$
- status-success~=^Test \(.* python 3\.9[ )].*$
- status-success~=^Test \(.* python 3\.10[ )].*$

pull_request_rules:
- name: label core
Expand Down Expand Up @@ -68,11 +68,11 @@ pull_request_rules:
# One test for Java 8 and 11
- status-success~=^Test \(.* java 8 .*$
- status-success~=^Test \(.* java 11 .*$
# One test for Python 3.6 through 3.9
- status-success~=^Test \(.* python 3\.6[ )].*$
# One test for Python 3.7 through 3.10
- status-success~=^Test \(.* python 3\.7[ )].*$
- status-success~=^Test \(.* python 3\.8[ )].*$
- status-success~=^Test \(.* python 3\.9[ )].*$
- status-success~=^Test \(.* python 3\.10[ )].*$

- name: Synchronize that PR to upstream and merge it (squash)
actions:
Expand Down Expand Up @@ -118,11 +118,11 @@ pull_request_rules:
# One test for Java 8 and 11
- status-success~=^Test \(.* java 8 .*$
- status-success~=^Test \(.* java 11 .*$
# One test for Python 3.6 through 3.9
- status-success~=^Test \(.* python 3\.6[ )].*$
# One test for Python 3.7 through 3.10
- status-success~=^Test \(.* python 3\.7[ )].*$
- status-success~=^Test \(.* python 3\.8[ )].*$
- status-success~=^Test \(.* python 3\.9[ )].*$
- status-success~=^Test \(.* python 3\.10[ )].*$

- name: Synchronize that PR to upstream and merge it (no-squash)
actions:
Expand Down Expand Up @@ -168,11 +168,11 @@ pull_request_rules:
# One test for Java 8 and 11
- status-success~=^Test \(.* java 8 .*$
- status-success~=^Test \(.* java 11 .*$
# One test for Python 3.6 through 3.9
- status-success~=^Test \(.* python 3\.6[ )].*$
# One test for Python 3.7 through 3.10
- status-success~=^Test \(.* python 3\.7[ )].*$
- status-success~=^Test \(.* python 3\.8[ )].*$
- status-success~=^Test \(.* python 3\.9[ )].*$
- status-success~=^Test \(.* python 3\.10[ )].*$

- name: Clean branch up
actions:
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 Core `3.1`] or later
+ *Recommended:* [`mono >= 5`](https://www.mono-project.com)
- [Python `3.6.5`] or later
- [Python `3.7.3`] 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 @@ -56,7 +56,7 @@ in your development environment.
[Oracle's OpenJDK8]: http://openjdk.java.net/install/
[Amazon Corretto 8]: https://aws.amazon.com/corretto/
[.NET Core `3.1`]: https://www.microsoft.com/net/download
[Python `3.6.5`]: https://www.python.org/downloads/release/python-365/
[Python `3.7.3`]: https://www.python.org/downloads/release/python-373/

## Getting Started
### Bootstrapping
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.6 or above,
- For example, **Java** requires an OpenJDK 8 distribution and `maven`, **Python** requires `python` 3.7 or above,
etc...

## Code Generation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ 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.6`
- `Programming Language :: Python :: 3.7`
- `Programming Language :: Python :: 3.8`
- `Programming Language :: Python :: 3.9`
- `Programming Language :: Python :: 3.10`

Example:

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 Core ≥ 3.1 / .NET ≥ 5.0 |
| Go | Go ≥ 1.15 |
| Java | JDK ≥ 8 *and* Maven ≥ 3.6 |
| Python | Python ≥ 3.6 |
| Python | Python ≥ 3.7 |


## :octicons-desktop-download-24: Download Locations
Expand Down
6 changes: 5 additions & 1 deletion packages/@jsii/python-runtime/build-tools/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { venv, runCommand } from './_constants';

const python = join(venv.bin, 'python');

runCommand('python3', ['-m', 'venv', venv.root]);
// On Windows, there is usually no python3.exe (the GitHub action workers will have a python3
// shim, but using this actually results in a WinError with Python 3.7 and 3.8 where venv will
// fail to copy the python binary if it's not invoked as python.exe). More on this particular
// issue can be read here: https://bugs.python.org/issue43749
runCommand(process.platform === 'win32' ? 'python' : 'python3', ['-m', 'venv', venv.root]);

const env = {
...process.env,
Expand Down
4 changes: 2 additions & 2 deletions packages/@jsii/python-runtime/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[build-system]
requires = ["pip~=20.2", "setuptools~=50.3", "wheel~=0.35"]
requires = ["pip~=22.0", "setuptools~=62.1", "wheel~=0.37"]
build-backend = 'setuptools.build_meta'

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

Expand Down
8 changes: 3 additions & 5 deletions packages/@jsii/python-runtime/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
black~=22.3
mypy==0.812
pip~=21.3 ; python_version < '3.7'
pip~=22.0 ; python_version >= '3.7'
pytest~=7.0 ; python_version < '3.7'
pytest~=7.1 ; python_version >= '3.7'
pip~=22.0
pytest~=7.1
pytest-mypy~=0.9
setuptools~=59.6
setuptools~=62.1
wheel~=0.37

-e .
8 changes: 3 additions & 5 deletions packages/@jsii/python-runtime/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,21 @@
},
install_requires=[
"attrs~=21.2",
"cattrs~=1.0.0 ; python_version < '3.7'",
"cattrs>=1.8,<22.2 ; python_version >= '3.7'",
"importlib_resources ; python_version < '3.7'",
"cattrs>=1.8,<22.2",
"python-dateutil",
"typing_extensions>=3.7,<5.0",
],
python_requires="~=3.6",
python_requires="~=3.7",
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.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
"Typing :: Typed",
Expand Down
10 changes: 7 additions & 3 deletions packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ export default class Python extends Target {
venv,
process.platform === 'win32' ? 'Scripts' : 'bin',
);
await shell('python3', [
// On Windows, there is usually no python3.exe (the GitHub action workers will have a python3
// shim, but using this actually results in a WinError with Python 3.7 and 3.8 where venv will
// fail to copy the python binary if it's not invoked as python.exe). More on this particular
// issue can be read here: https://bugs.python.org/issue43749
await shell(process.platform === 'win32' ? 'python' : 'python3', [
'-m',
'venv',
'--system-site-packages', // Allow using globally installed packages (saves time & disk space)
Expand Down Expand Up @@ -2000,7 +2004,7 @@ class Package {
package_dir: { '': 'src' },
packages: modules.map((m) => m.pythonName),
package_data: packageData,
python_requires: '>=3.6',
python_requires: '~=3.7',
install_requires: [
`jsii${toPythonVersionRange(`^${jsiiVersionSimple}`)}`,
'publication>=0.0.3',
Expand All @@ -2012,10 +2016,10 @@ class Package {
'Operating System :: OS Independent',
'Programming Language :: JavaScript',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Typing :: Typed',
],
scripts,
Expand Down
5 changes: 2 additions & 3 deletions packages/jsii-pacmak/lib/targets/python/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# be installed in the virtual environment used for building the distribution
# package (wheel, sdist), but not declared as build-system dependencies.

setuptools~=59.6.0 # build-system
setuptools~=62.1.0 # build-system
wheel~=0.37.1 # build-system

twine~=3.8.0 ; python_version < '3.7'
twine~=4.0.0 ; python_version >= '3.7'
twine~=4.0.0
17 changes: 15 additions & 2 deletions packages/jsii-pacmak/test/build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,28 @@ final_cleanup() {
trap final_cleanup EXIT

# Prepare Python venv to avoid depending on system stuff
case "${OSTYPE}" in
"msys" | "cygwin" | "win32")
# On Windows, there is usually no python3.exe (the GitHub action workers will have a python3
# shim, but using this actually results in a WinError with Python 3.7 and 3.8 where venv will
# fail to copy the python binary if it's not invoked as python.exe). More on this particular
# issue can be read here: https://bugs.python.org/issue43749
PYTHON='python'
;;
*)
PYTHON='python3'
;;
esac

venv="${outdir}/.env"
python3 -m venv ${venv}
${PYTHON} -m venv ${venv}
if [ -f ${venv}/bin/activate ]; then
. ${venv}/bin/activate
else
# Hello Windows!
. ${venv}/Scripts/activate
fi
python3 -m pip install --upgrade pip~=20.2 twine~=3.2
${PYTHON} -m pip install --upgrade pip~=22.0 twine~=4.0

# Provision a specific NuGet package cache
NUGET_CACHE=${outdir}/.nuget/packages
Expand Down
Loading

0 comments on commit abf7415

Please sign in to comment.