Skip to content

Commit

Permalink
Add support for Python 3.12, drop older than 3.11.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dean0x7d committed Apr 28, 2024
1 parent fdcab66 commit ebf3cce
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
## v1.9.0 | In development

- Added support for Conan v2.
- Added support for Python 3.12.
- Dropped support for Python versions older than 3.11.5 in order to avoid needing to support both `openssl` v1 and v3. Only v3 is supported now.
- 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.
- Removed the obsolete `openssl_variant` option.

## v1.8.2 | 2023-11-17
Expand Down
10 changes: 5 additions & 5 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
25 changes: 7 additions & 18 deletions core/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion core/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length = 100
target-version = ['py39']
target-version = ['py311']
extend-exclude = '''
(
/(
Expand Down
2 changes: 1 addition & 1 deletion test_package/nbconvert/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nbconvert==7.4.0
nbconvert==7.16.3
10 changes: 5 additions & 5 deletions test_package/numpy/requirements.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ebf3cce

Please sign in to comment.