Skip to content

Commit

Permalink
[Build] Remove official support for CY22
Browse files Browse the repository at this point in the history
Closes OpenAssetIO#1389. Closes OpenAssetIO#1352.

VFX Reference Platform CY22 is rather old now, especially to use as a
default, and removing support has additional advantages:

* We no longer need to worry about switching the libstdc++ ABI between
  old and new. E.g. previously we were using the old ABI even for Python
  3.10+ wheel builds, which was wrong.
* We no longer need to use the backport of `importlib_metadata`, since
  the API is stable as of Python 3.10 (CY23).

So remove Python 3.9 support, including no longer building/deploying
wheels.

Hence bump the `cibuildwheel` Docker image to `manylinux_2_28` for all
Python wheels, and use the new libstdc++ ABI for Conan packages. This
then means the libstdc++ ABI and glibc version matches for at least CY23
through CY24 (and likely CY25 too).

Also remove `importlib_metadata` dependency, now that it's no longer
required since Python 3.10+ has a stable API.

Signed-off-by: David Feltell <[email protected]>
  • Loading branch information
feltech committed Aug 9, 2024
1 parent 68e3a41 commit f6b9ca6
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 76 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
# These are the platform build strings provided to
# cibuildwheel, with wildcarding. See
# https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip
python-build: ['cp39*64', 'cp310*64', 'cp311*64']
python-build: ['cp310*64', 'cp311*64']
defaults:
run:
# Annoyingly required here since `matrix` isn't available in the
Expand Down Expand Up @@ -68,10 +68,12 @@ jobs:
# deploy on that platform.
CIBW_BUILD: ${{ matrix.python-build }}
CIBW_SKIP: '*musllinux* *arm64*'
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
# manylinux_2_28 is based on AlmaLinux 8, which uses glibc
# 2.28 and new libstdc++ ABI.
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
PIP_VERBOSE: 1
# Required as we make use of c++17 features
MACOSX_DEPLOYMENT_TARGET: 10.15
# VFX Reference Platform CY23-CY24
MACOSX_DEPLOYMENT_TARGET: 11
# Ensure .pyi stub tests won't be skipped
OPENASSETIO_TEST_ENABLE_PYTHON_STUBGEN: 1

Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ cmake_minimum_required(VERSION 3.27)
# Additional include directories for CMake utils.
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)

# Minimum required for the C++17 features used.
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
# VFX Reference Platform CY23-CY24
set(CMAKE_OSX_DEPLOYMENT_TARGET 11)

# Forbid in-source builds.
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
Expand Down
13 changes: 11 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ section for more details._

### Breaking changes

- Removed official support for Python 3.7. The minimum supported Python
version is now Python 3.9.
- Removed official support for Python 3.7 and 3.9. The minimum supported
Python version is now Python 3.10. This includes PyPI packages.
[#1365](https://github.com/OpenAssetIO/OpenAssetIO/pull/1365)
[#1389](https://github.com/OpenAssetIO/OpenAssetIO/pull/1389)

- Removed deprecated type aliases `openassetio.TraitsData`,
`openassetio.BatchElementError`
Expand Down Expand Up @@ -81,13 +82,21 @@ section for more details._
`openassetio.test.manager` API Compliance test harness, to aid in
IDE code completion when writing test cases for manager plugins.

- `importlib_metadata` is no longer a dependency for Python
manager plugins to make use of Python entry point hooks.
[#1389](https://github.com/OpenAssetIO/OpenAssetIO/issues/1389)

### Bug fixes

- Modified OpenAssetIO Python distributions (e.g. installed with `pip
install`) to allow C++ plugins to load. OpenAssetIO is now bundled as
multiple shared libraries, allowing external libraries to link.
[#1340](https://github.com/OpenAssetIO/OpenAssetIO/issues/1340)

- Fixed Python wheel builds to use the new libstdc++ ABI, reflecting
their associated VFX Reference Platform version.
[#1352](https://github.com/OpenAssetIO/OpenAssetIO/issues/1352)

- Fixed the (Python-only) `terminology.Mapper` class such that its
terminology dict can be updated by the manager.
[#1356](https://github.com/OpenAssetIO/OpenAssetIO/pull/1356)
Expand Down
4 changes: 2 additions & 2 deletions doc/BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ We assume the following system packages are installed

- CMake 3.27+
- C++17 or later compliant compiler
(GCC 9.3+ / MSVC 16.9+ / macOS 10.15+)
(GCC 11.2+ / MSVC 17.4+ / macOS 11+)

For linting and other build verification options, we assume the
following packages are installed:
Expand All @@ -34,7 +34,7 @@ following packages are installed:
Binary builds additionally require the following packages to be
available.

- [Python 3.9+](https://www.python.org/) (development install)
- [Python 3.10+](https://www.python.org/) (development install)
- [pybind11](https://pybind11.readthedocs.io/en/stable/) 2.8.1+
- [toml++](https://marzer.github.io/tomlplusplus/) 3.2.0+
- [fmt](https://github.com/fmtlib/fmt) 9.1.0
Expand Down
2 changes: 1 addition & 1 deletion doc/contributing/CODING_STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ disambiguating fixtures from tests.
### Python

Python code should be written using only features included in Python
3.9.
3.10.

Where feasible, Python unit test cases should use a class for each unit,
where the methods of the test class are the test cases for that unit. In
Expand Down
3 changes: 0 additions & 3 deletions doc/doxygen/src/Configuration.dox
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,6 @@
* version as the one used to install via `pip`.
* - Check that the appropriate directory is on `sys.path` in the
* host's interpreter.
* - Check that `importlib_metadata` is available to the host
* interpreter (a message will be logged during startup if this is
* missing).
*
* @subsection manual_plugins_missing Manually installed plugins not being found
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ pip3 install -r "resources/build/requirements.txt"
# Use explicit predictable conan root path, where packages are cached.
export CONAN_USER_HOME="$HOME/conan"

# Create default conan profile so we can configure it before instlibXcomposite-develall.
# Create default conan profile so we can configure it before install.
# Use --force so that if it already exists we don't error out.
conan profile new default --detect --force
# Use old C++11 ABI as per VFX Reference Platform CY2022. Not strictly
# necessary as this is the default for conan, but we can't be certain
# it'll remain the default in future.
conan profile update settings.compiler.libcxx=libstdc++ default
# Use new/non-deprecated C++11 ABI to match VFX Reference Platform
# CY23+.
conan profile update settings.compiler.libcxx=libstdc++11 default
# If we need to pin a package to a specific Conan recipe revision, then
# we need to explicitly opt-in to this functionality.
conan config set general.revisions_enabled=True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"""

import os.path
import importlib.metadata
import importlib.util
import hashlib
import sys
Expand Down Expand Up @@ -113,30 +114,17 @@ def scan_entry_points(self, entryPointName):
the first plugin with any given identifier will be registered.
@param entryPointName `str` The entry point name to search for
(see: importlib_metadata.entry_points group).
(see: importlib.metadata.entry_points group).
@returns True if entry point discovery is possible, False if
there was a problem loading importlib_metadata.
there was a problem loading importlib.metadata.
"""

# We opt to use the backport implementation of modern importlib
# since the API changes from 3.9 to 3.10.
# Pip installs should have this module available, but other methods may not,
# so be tolerant of it being missing.
try:
import importlib_metadata # pylint: disable=import-outside-toplevel
except ImportError:
self.__logger.warning(
"PythonPluginSystem: Can not load entry point plugins as the importlib_metadata "
"package is unavailable."
)
return False

self.__logger.debug(
f"PythonPluginSystem: Searching packages for '{entryPointName}' entry points."
)

for entryPoint in importlib_metadata.entry_points(group=entryPointName):
for entryPoint in importlib.metadata.entry_points(group=entryPointName):
self.__logger.debug(f"PythonPluginSystem: Found entry point in {entryPoint.name}")
try:
module = entryPoint.load()
Expand Down
8 changes: 2 additions & 6 deletions src/openassetio-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "openassetio"
version = "1.0.0b2.rev2"
requires-python = ">=3.9"
dependencies = [
"importlib_metadata >= 3.6"
]
requires-python = ">=3.10"

authors = [
{ name = "Contributors to the OpenAssetIO project", email = "[email protected]" }
Expand All @@ -37,7 +34,6 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down Expand Up @@ -144,5 +140,5 @@ environment-pass = ["PIP_VERBOSE", "OPENASSETIO_TEST_ENABLE_PYTHON_STUBGEN"]

[tool.cibuildwheel.linux]
# Linux runs in a docker container, with the project at top level
before-build = "resources/build/bootstrap-cibuildwheel-manylinux-2014.sh"
before-build = "resources/build/bootstrap-cibuildwheel-manylinux.sh"
environment = { CMAKE_TOOLCHAIN_FILE=".conan/conan_paths.cmake" }
1 change: 0 additions & 1 deletion src/openassetio-python/requirements.txt

This file was deleted.

7 changes: 0 additions & 7 deletions src/openassetio-python/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ endif ()
#-----------------------------------------------------------------------
# Test dependencies.

# Install openassetio-specific dependencies that allow us to
# extend PYTHONPATH without needing to pip install to run tests.
openassetio_add_python_environment_dependency(
openassetio.internal.python.install-deps
"${PROJECT_SOURCE_DIR}/src/openassetio-python/requirements.txt"
)

# Install test-specific dependencies (e.g. pytest).
openassetio_add_python_environment_dependency(
openassetio.internal.pytest.install-deps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "missing-plugin"
version = "0.0.0"
requires-python = ">=3.9"
requires-python = ">=3.10"

description = """\
A test OpenAssetIO Manager plugin that is missing the top-level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "raises-exception"
version = "0.0.0"
requires-python = ">=3.9"
requires-python = ">=3.10"

description = """\
A test OpenAssetIO Manager plugin that raises an exception during inmport.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "packaged-plugin"
version = "0.0.0"
requires-python = ">=3.9"
requires-python = ">=3.10"

description = """\
A test OpenAssetIO Manager plugin that can be pip installed and \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,6 @@ def test_when_entry_point_package_installed_then_loaded_and_true_returned(
assert a_plugin_system.scan_entry_points(PLUGIN_ENTRY_POINT_GROUP) is True
assert a_plugin_system.identifiers() == [entry_point_plugin_identifier]

def test_when_importlib_metadata_missing_then_a_warning_is_loggeed_and_false_returned(
self, mock_logger, monkeypatch
):
# Remove any previously imported versions
sys.modules.pop("importlib_metadata", None)
monkeypatch.setattr(sys, "path", [])

plugin_system = PythonPluginSystem(mock_logger)
assert plugin_system.scan_entry_points("some.entrypoint") is False

mock_logger.mock.log.assert_called_once_with(
mock_logger.Severity.kWarning,
"PythonPluginSystem: Can not load entry point plugins as the importlib_metadata "
"package is unavailable.",
)

def test_when_plugins_broken_then_skipped_with_expected_errors(
self, broken_python_plugins_path, mock_logger, monkeypatch
):
Expand Down
9 changes: 1 addition & 8 deletions src/openassetio-python/tests/test_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,11 @@
"""
# pylint: disable=missing-function-docstring,invalid-name
import os
from importlib import metadata

import pytest


try:
from importlib import metadata

# pylint: disable=bare-except
except:
import importlib_metadata as metadata


@pytest.mark.skipif(
os.environ.get("OPENASSETIO_CMAKE_PACKAGE_VERSION") is None, reason="CMake package only"
)
Expand Down

0 comments on commit f6b9ca6

Please sign in to comment.