From 504ddf43b3644b157494235cfd7fa45327f80776 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Sun, 28 Apr 2024 12:13:23 +0200 Subject: [PATCH] Add support for Python 3.12, drop older than 3.11.5 --- .github/workflows/test_package.yml | 2 +- .github/workflows/update_env.yml | 2 +- changelog.md | 5 ++++- conanfile.py | 10 +++++----- core/conanfile.py | 25 +++++++------------------ core/test_package/conanfile.py | 1 - pyproject.toml | 2 +- test_package/nbconvert/requirements.txt | 2 +- test_package/numpy/requirements.txt | 10 +++++----- test_package/numpy/test.py | 10 ++++++++-- 10 files changed, 33 insertions(+), 36 deletions(-) diff --git a/.github/workflows/test_package.yml b/.github/workflows/test_package.yml index 8f655fc..bd818db 100644 --- a/.github/workflows/test_package.yml +++ b/.github/workflows/test_package.yml @@ -7,7 +7,7 @@ jobs: fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] - embedded-py: [3.9.8, 3.11.5] + embedded-py: [3.11.5, 3.12.3] conan: - version: 1 args: lumicks/testing --build=missing diff --git a/.github/workflows/update_env.yml b/.github/workflows/update_env.yml index d96d630..4b7c645 100644 --- a/.github/workflows/update_env.yml +++ b/.github/workflows/update_env.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.9" + python-version: "3.11" - name: Compile run: | python -m pip install pip-tools==7.4.1 diff --git a/changelog.md b/changelog.md index 8cbf0dc..9fa8819 100644 --- a/changelog.md +++ b/changelog.md @@ -1,8 +1,11 @@ # Changelog -## v1.9.0 | In development +## v1.9.0 | 2024-05-03 - Added support for Conan v2. +- Added support for Python 3.12. +- Updated default recipe options to `pip` v24.0, `setuptools` v69.5.1, `wheel` v0.43.0, and `pip-licenses` v4.4.0 for compatibility with Python 3.12. +- Dropped support for Python versions older than 3.11.5 in order to avoid maintaining both `openssl` v1 and v3. - Removed the obsolete `openssl_variant` option. - Removed redundant `embedded_python:version` option. Use `embedded_python-core:version`. diff --git a/conanfile.py b/conanfile.py index 46c7c92..80f6ad5 100644 --- a/conanfile.py +++ b/conanfile.py @@ -26,10 +26,10 @@ class EmbeddedPython(ConanFile): } default_options = { "packages": None, - "pip_version": "23.1.2", - "pip_licenses_version": "4.3.2", - "setuptools_version": "67.8.0", - "wheel_version": "0.40.0", + "pip_version": "24.0", + "pip_licenses_version": "4.4.0", + "setuptools_version": "69.5.1", + "wheel_version": "0.43.0", } short_paths = True # some of the pip packages go over the 260 char path limit on Windows exports_sources = "embedded_python.cmake" @@ -39,7 +39,7 @@ def requirements(self): @property def pyversion(self): - """Full Python version that we want to package, e.g. 3.11.3""" + """Full Python version that we want to package, e.g. 3.11.5""" return scm.Version(self.dependencies["embedded_python-core"].options.version) @property diff --git a/core/conanfile.py b/core/conanfile.py index 7d077ed..a733f9c 100644 --- a/core/conanfile.py +++ b/core/conanfile.py @@ -30,7 +30,7 @@ class EmbeddedPythonCore(ConanFile): exports_sources = "embedded_python_tools.py", "embedded_python-core.cmake" def validate(self): - minimum_python = "3.9.8" + minimum_python = "3.11.5" if self.pyversion < minimum_python: raise ConanInvalidConfiguration(f"Minimum supported Python version is {minimum_python}") @@ -51,26 +51,19 @@ def requirements(self): if self.settings.os == "Windows": return # on Windows, we download a binary, so we don't need anything else - self.requires("sqlite3/3.42.0") + self.requires("sqlite3/3.45.3") self.requires("bzip2/1.0.8") - self.requires("xz_utils/5.4.2") + self.requires("xz_utils/5.4.5") self.requires("zlib/[>=1.2.11 <2]") + self.requires("openssl/[>=3 <4]") if self.settings.os == "Linux": self.requires("libffi/3.4.4") self.requires("libuuid/1.0.3") - if self.pyversion < "3.8": - self.requires("mpdecimal/2.4.2") - else: - self.requires("mpdecimal/2.5.0") - - if self.pyversion >= scm.Version("3.11.0"): - self.requires("openssl/[>=3 <4]") - else: - self.requires("openssl/1.1.1w") + self.requires("mpdecimal/2.5.1") @property def pyversion(self): - """Full Python version that we want to package, e.g. 3.11.3""" + """Full Python version that we want to package, e.g. 3.11.5""" return scm.Version(self.options.version) @property @@ -221,13 +214,9 @@ def _zip_stdlib(self, prefix): for pyc_file in (pathlib.Path(root, f) for f in file_names if f.endswith(".pyc")): zf.write(pyc_file, arcname=str(pyc_file.relative_to(lib))) - def is_landmark(filepath): - """Older Python version require `os.py(c)` to use as a landmark for the stdlib""" - return self.pyversion < "3.11.0" and filepath.name == "os.pyc" - # Delete everything that we can in `lib`: the `.zip` takes over for path in lib.iterdir(): - if path.is_file() and not is_landmark(path): + if path.is_file(): path.unlink() elif path.is_dir() and path.name not in keep_lib_dirs: shutil.rmtree(path) diff --git a/core/test_package/conanfile.py b/core/test_package/conanfile.py index 7d75eb3..57f26ac 100644 --- a/core/test_package/conanfile.py +++ b/core/test_package/conanfile.py @@ -11,7 +11,6 @@ class TestEmbeddedPythonCore(ConanFile): name = "test_embedded_python" settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "VirtualRunEnv" - default_options = {"embedded_python-core/*:version": "3.11.3"} test_type = "explicit" def layout(self): diff --git a/pyproject.toml b/pyproject.toml index 510e7a2..83e2916 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length = 100 -target-version = ['py39'] +target-version = ['py311'] extend-exclude = ''' ( /( diff --git a/test_package/nbconvert/requirements.txt b/test_package/nbconvert/requirements.txt index 26ddf65..b8c49ce 100644 --- a/test_package/nbconvert/requirements.txt +++ b/test_package/nbconvert/requirements.txt @@ -1 +1 @@ -nbconvert==7.4.0 +nbconvert==7.16.3 diff --git a/test_package/numpy/requirements.txt b/test_package/numpy/requirements.txt index 82f69b4..bba1d30 100644 --- a/test_package/numpy/requirements.txt +++ b/test_package/numpy/requirements.txt @@ -1,5 +1,5 @@ -hypothesis==6.75.3 -numpy==1.24.3 -pytest-xdist==3.3.1 -pytest==7.3.1 -typing-extensions==4.5.0 +hypothesis==6.100.2 +numpy==1.26.4 +pytest-xdist==3.5.0 +pytest==8.2.0 +typing-extensions==4.11.0 diff --git a/test_package/numpy/test.py b/test_package/numpy/test.py index 57998a7..746663f 100644 --- a/test_package/numpy/test.py +++ b/test_package/numpy/test.py @@ -3,5 +3,11 @@ import sys import numpy as np - -sys.exit(not np.test(verbose=2, extra_argv=["-n", "auto"])) +# `test_mem_policy.py` and `f2py/*` tests fail with Python 3.11 due to `numpy.distutils` +# deprecations and issues with the latest `setuptools`. Ignore it until it's resolves in `numpy`. +sys.exit( + not np.test( + verbose=2, + extra_argv=["-n", "auto", "-k=not test_mem_policy and not f2py"], + ) +)