From b856a0b7ba2836191e3534a454f3b9c146a25423 Mon Sep 17 00:00:00 2001 From: Renato Ambrosone Date: Wed, 1 Apr 2026 19:20:02 +0200 Subject: [PATCH 1/3] ci: refresh Python 3.13 and align libyang v4 --- .github/workflows/ci.yaml | 137 +++++++++++++++++++++++++++----------- .gitmodules | 2 +- README.md | 2 +- libyang | 2 +- libyang-cpp | 2 +- oopt-gnpy-libyang.cpp | 21 +++++- tests/conftest.py | 3 +- tests/test_context.py | 16 ++++- 8 files changed, 135 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f5d71e9..eee7632 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,12 +12,6 @@ jobs: fail-fast: false matrix: include: - - name: "Ubuntu 22.04 Python 3.10" - os: ubuntu-22.04 - build_type: Release - generators: Ninja - python-version: "3.10" - - name: "Ubuntu 22.04 Python 3.11" os: ubuntu-22.04 build_type: Release @@ -33,34 +27,39 @@ jobs: python-version: "3.12" upload-sdist: true - - name: "Ubuntu 20.04 with GCC 10 Python 3.8" + - name: "Ubuntu 22.04 Python 3.13" + os: ubuntu-22.04 + build_type: Release + generators: Ninja + wheel: manylinux_2_35_x86_64 + python-version: "3.13" + + - name: "Ubuntu 20.04 with GCC 10 Python 3.11" os: ubuntu-20.04 build_type: Release generators: Ninja wheel: manylinux_2_31_x86_64 - python-version: "3.8" + python-version: "3.11" - - name: "Ubuntu 20.04 with GCC 10 Python 3.9" + - name: "Ubuntu 20.04 with GCC 10 Python 3.12" os: ubuntu-20.04 build_type: Release generators: Ninja wheel: manylinux_2_31_x86_64 - python-version: "3.9" + python-version: "3.12" - - name: "Ubuntu 20.04 with GCC 10 Python 3.10" + - name: "Ubuntu 20.04 with GCC 10 Python 3.13" os: ubuntu-20.04 build_type: Release generators: Ninja wheel: manylinux_2_31_x86_64 - python-version: "3.10" + python-version: "3.13" - - name: "Windows 2022 MSVC Python 3.10" - os: windows-2022 - triplet: x64-windows + - name: "Ubuntu 24.04 Python 3.13" + os: ubuntu-24.04 build_type: Release - generators: "Visual Studio 17 2022" - wheel: win_amd64 - python-version: "3.10" + generators: Ninja + python-version: "3.13" - name: "Windows 2022 MSVC Python 3.11" os: windows-2022 @@ -78,7 +77,22 @@ jobs: wheel: win_amd64 python-version: "3.12" - - name: "macOS 15 x86_64 x86_64 Python 3.13" + - name: "Windows 2022 MSVC Python 3.13" + os: windows-2022 + triplet: x64-windows + build_type: Release + generators: "Visual Studio 17 2022" + wheel: win_amd64 + python-version: "3.13" + + - name: "Windows 2025 MSVC Python 3.13" + os: windows-2025 + triplet: x64-windows + build_type: Release + generators: "Visual Studio 17 2022" + python-version: "3.13" + + - name: "macOS 15 x86_64 Python 3.13" os: macos-15-large build_type: Release generators: Ninja @@ -92,6 +106,20 @@ jobs: wheel: macosx_15_0_arm64 python-version: "3.13" + - name: "macOS 26 x86_64 Python 3.13" + os: macos-26-large + build_type: Release + generators: Ninja + wheel: macosx_26_0_x86_64 + python-version: "3.13" + + - name: "macOS 26 arm64 Python 3.13" + os: macos-26-xlarge + build_type: Release + generators: Ninja + wheel: macosx_26_0_arm64 + python-version: "3.13" + steps: - name: Unix line endings in git if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos') @@ -190,6 +218,12 @@ jobs: run: | echo MACOSX_DEPLOYMENT_TARGET=15.0 >> $GITHUB_ENV + - name: Mac OS 26 deployment target + if: startsWith(matrix.os, 'macos-26') + shell: bash + run: | + echo MACOSX_DEPLOYMENT_TARGET=26.0 >> $GITHUB_ENV + - name: Mac OS ARCHFLAGS x86_64 if: startsWith(matrix.os, 'macos') && endsWith(matrix.wheel, '_x86_64') shell: bash @@ -229,9 +263,12 @@ jobs: if: startsWith(matrix.os, 'macos') shell: bash run: | + BREW_PREFIX="$(brew --prefix)" echo ${{ github.workspace }}/../target/bin >> $GITHUB_PATH + echo "${BREW_PREFIX}/opt/tcl-tk/bin" >> $GITHUB_PATH echo REPAIR_LIBRARY_PATH=${{ github.workspace }}/../target/lib >> $GITHUB_ENV echo PKG_CONFIG_PATH=${{ github.workspace }}/../target/lib/pkgconfig >> $GITHUB_ENV + echo EXTRA_OSX_LIBYANG=-DPATH_EXPECT= >> $GITHUB_ENV # FIXME: CMake 4.0 is backwards-incompatible, https://github.com/actions/runner-images/issues/11926 - name: pin CMake to the latest 3.x series @@ -260,11 +297,11 @@ jobs: # Windows: pybind11 by vcpkg won't work for any other version of Python by design, https://github.com/microsoft/vcpkg/issues/23796 - name: Install pybind11 (Unix) if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos') - run: sudo pip install pybind11[global] + run: sudo pip install 'pybind11[global]>=2.9.1,<3' - name: Install pybind11 (Windows) if: startsWith(matrix.os, 'windows') - run: pip install pybind11[global] + run: pip install 'pybind11[global]>=2.9.1,<3' - name: configure libyang shell: bash @@ -442,11 +479,6 @@ jobs: fail-fast: false matrix: include: - - name: "Ubuntu 22.04 Python 3.10" - os: ubuntu-22.04 - python-version: "3.10" - wheel: manylinux_2_31_x86_64 - - name: "Ubuntu 22.04 Python 3.11" os: ubuntu-22.04 python-version: "3.11" @@ -457,30 +489,35 @@ jobs: python-version: "3.12" wheel: manylinux_2_35_x86_64 - - name: "Ubuntu 20.04 with GCC 10 Python 3.8" + - name: "Ubuntu 22.04 Python 3.13" + os: ubuntu-22.04 + python-version: "3.13" + wheel: manylinux_2_35_x86_64 + + - name: "Ubuntu 20.04 with GCC 10 Python 3.11" os: ubuntu-20.04 wheel: manylinux_2_31_x86_64 - python-version: "3.8" + python-version: "3.11" - - name: "Ubuntu 20.04 with GCC 10 Python 3.9" + - name: "Ubuntu 20.04 with GCC 10 Python 3.12" os: ubuntu-20.04 wheel: manylinux_2_31_x86_64 - python-version: "3.9" + python-version: "3.12" - - name: "Ubuntu 20.04 with GCC 10 Python 3.10" + - name: "Ubuntu 20.04 with GCC 10 Python 3.13" os: ubuntu-20.04 wheel: manylinux_2_31_x86_64 - python-version: "3.10" + python-version: "3.13" - - name: "Windows 2019 MSVC Python 3.10" - os: windows-2019 - wheel: win_amd64 - python-version: "3.10" + - name: "Ubuntu 24.04 Python 3.13" + os: ubuntu-24.04 + python-version: "3.13" + wheel: manylinux_2_35_x86_64 - - name: "Windows 2022 MSVC Python 3.10" - os: windows-2022 + - name: "Windows 2019 MSVC Python 3.11" + os: windows-2019 wheel: win_amd64 - python-version: "3.10" + python-version: "3.11" - name: "Windows 2022 MSVC Python 3.11" os: windows-2022 @@ -492,16 +529,36 @@ jobs: wheel: win_amd64 python-version: "3.12" + - name: "Windows 2022 MSVC Python 3.13" + os: windows-2022 + wheel: win_amd64 + python-version: "3.13" + + - name: "Windows 2025 MSVC Python 3.13" + os: windows-2025 + wheel: win_amd64 + python-version: "3.13" + - name: "macOS 15 x86_64 Python 3.13" os: macos-15-large wheel: macosx_15_0_x86_64 python-version: "3.13" - - name: "macOS 13 arm64 Python 3.13" + - name: "macOS 15 arm64 Python 3.13" os: macos-15-xlarge wheel: macosx_15_0_arm64 python-version: "3.13" + - name: "macOS 26 x86_64 Python 3.13" + os: macos-26-large + wheel: macosx_26_0_x86_64 + python-version: "3.13" + + - name: "macOS 26 arm64 Python 3.13" + os: macos-26-xlarge + wheel: macosx_26_0_arm64 + python-version: "3.13" + steps: - uses: actions/checkout@v3 with: diff --git a/.gitmodules b/.gitmodules index 3529f0d..cc3092c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "libyang"] path = libyang - url = ../../jktjkt/libyang + url = ../../CESNET/libyang [submodule "libyang-cpp"] path = libyang-cpp url = ../../CESNET/libyang-cpp diff --git a/README.md b/README.md index d37ceaf..2f7cbe6 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ We also produce prebuilt binary [wheels](https://realpython.com/python-wheels/) ```python import oopt_gnpy_libyang as ly -c = ly.Context('tests/yang', ly.ContextOptions.AllImplemented | ly.ContextOptions.NoYangLibrary) +c = ly.Context('tests/yang', ly.ContextOptions.RefImplemented | ly.ContextOptions.NoYangLibrary) for m in ('iana-if-type', 'ietf-interfaces', 'ietf-ip'): c.load_module(m) blob = '''{ diff --git a/libyang b/libyang index ce38b35..b0a8a12 160000 --- a/libyang +++ b/libyang @@ -1 +1 @@ -Subproject commit ce38b35612022dfc907d620ae5caff735155cb5f +Subproject commit b0a8a12fb1738a903f0cc56b362c41a7d1a61224 diff --git a/libyang-cpp b/libyang-cpp index dab8c9a..ffdaf3a 160000 --- a/libyang-cpp +++ b/libyang-cpp @@ -1 +1 @@ -Subproject commit dab8c9aac96063ccb8541d5d1795ee89b75faeee +Subproject commit ffdaf3a90b96e40d6f79644a13eb442e059360e2 diff --git a/oopt-gnpy-libyang.cpp b/oopt-gnpy-libyang.cpp index 326a145..2519824 100644 --- a/oopt-gnpy-libyang.cpp +++ b/oopt-gnpy-libyang.cpp @@ -45,6 +45,13 @@ PYBIND11_MODULE(oopt_gnpy_libyang, m) { .value("PreferSearchDirs", ContextOptions::PreferSearchDirs) .value("SetPrivParsed", ContextOptions::SetPrivParsed) .value("ExplicitCompile", ContextOptions::ExplicitCompile) + .value("EnableImpFeatures", ContextOptions::EnableImpFeatures) + .value("CompileObsolete", ContextOptions::CompileObsolete) + .value("LybHashes", ContextOptions::LybHashes) + .value("LeafrefExtended", ContextOptions::LeafrefExtended) + .value("LeafrefLinking", ContextOptions::LeafrefLinking) + .value("BuiltinPluginsOnly", ContextOptions::BuiltinPluginsOnly) + .value("StaticPluginsOnly", ContextOptions::StaticPluginsOnly) .def("__or__", [](ContextOptions a, ContextOptions b){ return a | b; }) ; @@ -104,11 +111,15 @@ PYBIND11_MODULE(oopt_gnpy_libyang, m) { .value("Strict", ParseOptions::Strict) .value("Opaque", ParseOptions::Opaque) .value("NoState", ParseOptions::NoState) - .value("LybModUpdate", ParseOptions::LybModUpdate) + .value("LybSkipModuleCheck", ParseOptions::LybSkipModuleCheck) + .value("LybModUpdate", ParseOptions::LybSkipModuleCheck) .value("Ordered", ParseOptions::Ordered) .value("Subtree", ParseOptions::Subtree) .value("WhenTrue", ParseOptions::WhenTrue) .value("NoNew", ParseOptions::NoNew) + .value("StoreOnly", ParseOptions::StoreOnly) + .value("JsonNull", ParseOptions::JsonNull) + .value("JsonStringDataTypes", ParseOptions::JsonStringDataTypes) .def("__or__", [](ParseOptions a, ParseOptions b){ return a | b; }) ; @@ -118,19 +129,23 @@ PYBIND11_MODULE(oopt_gnpy_libyang, m) { .value("MultiError", ValidationOptions::MultiError) .value("Operational", ValidationOptions::Operational) .value("NoDefaults", ValidationOptions::NoDefaults) + .value("NotFinal", ValidationOptions::NotFinal) .def("__or__", [](ValidationOptions a, ValidationOptions b){ return a | b; }) ; py::enum_(m, "PrintFlags") .value("WithDefaultsExplicit", PrintFlags::WithDefaultsExplicit) - .value("WithSiblings", PrintFlags::WithSiblings) + .value("Siblings", PrintFlags::Siblings) + .value("WithSiblings", PrintFlags::Siblings) .value("Shrink", PrintFlags::Shrink) - .value("KeepEmptyCont", PrintFlags::KeepEmptyCont) + .value("EmptyContainers", PrintFlags::EmptyContainers) + .value("KeepEmptyCont", PrintFlags::EmptyContainers) .value("WithDefaultsTrim", PrintFlags::WithDefaultsTrim) .value("WithDefaultsAll", PrintFlags::WithDefaultsAll) .value("WithDefaultsAllTag", PrintFlags::WithDefaultsAllTag) .value("WithDefaultsImplicitTag", PrintFlags::WithDefaultsImplicitTag) .value("WithDefaultsMask", PrintFlags::WithDefaultsMask) + .value("JsonNoNestedPrefix", PrintFlags::JsonNoNestedPrefix) .def("__or__", [](PrintFlags a, PrintFlags b){ return a | b; }) ; diff --git a/tests/conftest.py b/tests/conftest.py index 2677164..9f1c2c0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,8 +5,9 @@ @pytest.fixture(scope='function') def context_no_libyang(): + # libyang 4.7.x is stable here with RefImplemented; AllImplemented crashes during manual module loading. return ly.Context(str(Path(os.environ.get('CMAKE_CURRENT_SOURCE_DIR', os.getcwd())) / 'tests' / 'yang'), - ly.ContextOptions.AllImplemented | ly.ContextOptions.NoYangLibrary) + ly.ContextOptions.RefImplemented | ly.ContextOptions.NoYangLibrary) @pytest.fixture(scope='function') def context_with_modules(context_no_libyang): diff --git a/tests/test_context.py b/tests/test_context.py index 31bcc2e..3f99a05 100644 --- a/tests/test_context.py +++ b/tests/test_context.py @@ -57,5 +57,17 @@ def test_explicit_loading(context_no_libyang): def test_version(): assert len(ly.libyang_version_info()) == 3 - assert ly.libyang_version_info()[0] == 3 - assert ly.libyang_version()[0:2] == '3.' + major, minor, micro = ly.libyang_version_info() + assert ly.libyang_version() == f"{major}.{minor}.{micro}" + + +def test_enum_api_compatibility(): + assert ly.ParseOptions.LybSkipModuleCheck == ly.ParseOptions.LybModUpdate + assert ly.PrintFlags.Siblings == ly.PrintFlags.WithSiblings + assert ly.PrintFlags.EmptyContainers == ly.PrintFlags.KeepEmptyCont + + assert hasattr(ly.ParseOptions, "StoreOnly") + assert hasattr(ly.ParseOptions, "JsonNull") + assert hasattr(ly.ParseOptions, "JsonStringDataTypes") + assert hasattr(ly.PrintFlags, "JsonNoNestedPrefix") + assert hasattr(ly.ValidationOptions, "NotFinal") From 0fc0c3daf73234b80c041ff23b55d9f88f3e3aae Mon Sep 17 00:00:00 2001 From: EstherLerouzic Date: Thu, 21 May 2026 13:15:12 +0200 Subject: [PATCH 2/3] fix: remove the no-more-supported ubuntu20.04 tests since 1rst April 2025 Signed-off-by: EstherLerouzic --- .github/workflows/ci.yaml | 52 --------------------------------------- 1 file changed, 52 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index eee7632..36e47fc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,27 +34,6 @@ jobs: wheel: manylinux_2_35_x86_64 python-version: "3.13" - - name: "Ubuntu 20.04 with GCC 10 Python 3.11" - os: ubuntu-20.04 - build_type: Release - generators: Ninja - wheel: manylinux_2_31_x86_64 - python-version: "3.11" - - - name: "Ubuntu 20.04 with GCC 10 Python 3.12" - os: ubuntu-20.04 - build_type: Release - generators: Ninja - wheel: manylinux_2_31_x86_64 - python-version: "3.12" - - - name: "Ubuntu 20.04 with GCC 10 Python 3.13" - os: ubuntu-20.04 - build_type: Release - generators: Ninja - wheel: manylinux_2_31_x86_64 - python-version: "3.13" - - name: "Ubuntu 24.04 Python 3.13" os: ubuntu-24.04 build_type: Release @@ -198,13 +177,6 @@ jobs: run: | echo CXXFLAGS=" /wd4251 /wd4275" >> $GITHUB_ENV - - name: GCC 10 on Ubuntu 20.04 - if: matrix.os == 'ubuntu-20.04' - shell: bash - run: | - echo CC=gcc-10 >> $GITHUB_ENV - echo CXX=g++-10 >> $GITHUB_ENV - - name: GCC 14 on Mac OS 15 if: startsWith(matrix.os, 'macos-13') shell: bash @@ -419,15 +391,6 @@ jobs: export CMAKE_ARGS="${EXTRA_VCPKG_TARGET_TRIPLET:+${EXTRA_VCPKG_TARGET_TRIPLET} }${EXTRA_CMAKE_TOOLCHAIN_FILE:+${EXTRA_CMAKE_TOOLCHAIN_FILE} }${EXTRA_PKG_CONFIG_EXECUTABLE:+${EXTRA_PKG_CONFIG_EXECUTABLE}}" python3 -m build --skip-dependency-check --outdir '${{ github.workspace }}'/build-wheel '${{ github.workspace }}/' - - name: fix the wheel, Ubuntu 20.x - if: startsWith(matrix.os, 'ubuntu-20') && (matrix.wheel != '') - shell: bash - run: | - # we're on old Ubuntu to use an old manylinux tag, and newer auditwheel requires too fresh patchelf - pip install 'auditwheel<5.2.0' - find '${{ github.workspace }}'/build-wheel -name '*.whl' - auditwheel repair --plat '${{ matrix.wheel }}' '${{ github.workspace }}'/build-wheel/*.whl - - name: fix the wheel, Ubuntu 22.x if: startsWith(matrix.os, 'ubuntu-22') && (matrix.wheel != '') shell: bash @@ -494,21 +457,6 @@ jobs: python-version: "3.13" wheel: manylinux_2_35_x86_64 - - name: "Ubuntu 20.04 with GCC 10 Python 3.11" - os: ubuntu-20.04 - wheel: manylinux_2_31_x86_64 - python-version: "3.11" - - - name: "Ubuntu 20.04 with GCC 10 Python 3.12" - os: ubuntu-20.04 - wheel: manylinux_2_31_x86_64 - python-version: "3.12" - - - name: "Ubuntu 20.04 with GCC 10 Python 3.13" - os: ubuntu-20.04 - wheel: manylinux_2_31_x86_64 - python-version: "3.13" - - name: "Ubuntu 24.04 Python 3.13" os: ubuntu-24.04 python-version: "3.13" From 8f0ca90203a2d5116439380202770f6510384b0f Mon Sep 17 00:00:00 2001 From: EstherLerouzic Date: Thu, 21 May 2026 14:45:02 +0200 Subject: [PATCH 3/3] fix: remove unsupported win19 in actions since 30 june 2025 Signed-off-by: EstherLerouzic --- .github/workflows/ci.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 36e47fc..8fe2eec 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -462,11 +462,6 @@ jobs: python-version: "3.13" wheel: manylinux_2_35_x86_64 - - name: "Windows 2019 MSVC Python 3.11" - os: windows-2019 - wheel: win_amd64 - python-version: "3.11" - - name: "Windows 2022 MSVC Python 3.11" os: windows-2022 wheel: win_amd64