From 5c631e9d5e0e9792125b056c5162bcd2241ef451 Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Wed, 25 Feb 2026 17:12:27 -0500 Subject: [PATCH 01/10] fix regression testing CI and centralize version matrices --- .github/workflows-config/os-versions.txt | 5 +++ .github/workflows-config/python-versions.txt | 5 +++ .github/workflows/build.yml | 34 +++++++++++++------- .github/workflows/regression-testing.yml | 26 ++++++++++++--- 4 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 .github/workflows-config/os-versions.txt create mode 100644 .github/workflows-config/python-versions.txt diff --git a/.github/workflows-config/os-versions.txt b/.github/workflows-config/os-versions.txt new file mode 100644 index 00000000..65095dba --- /dev/null +++ b/.github/workflows-config/os-versions.txt @@ -0,0 +1,5 @@ +ubuntu-22.04 +ubuntu-24.04 +macos-15 +macos-14 +windows-latest \ No newline at end of file diff --git a/.github/workflows-config/python-versions.txt b/.github/workflows-config/python-versions.txt new file mode 100644 index 00000000..af935eb5 --- /dev/null +++ b/.github/workflows-config/python-versions.txt @@ -0,0 +1,5 @@ +3.8 +3.9 +3.10 +3.11 +3.12 \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1fccf9c6..e59473a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,20 +3,33 @@ name: Build on: [push, pull_request] jobs: + load-matrix: + runs-on: ubuntu-latest + outputs: + python: ${{ steps.set-matrix.outputs.python }} + os: ${{ steps.set-matrix.outputs.os }} + steps: + - uses: actions/checkout@v4 + - id: set-matrix + run: | + echo "python=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/python-versions.txt)" >> $GITHUB_OUTPUT + echo "os=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/os-versions.txt)" >> $GITHUB_OUTPUT + test: + needs: load-matrix runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04, ubuntu-24.04, macos-15, macos-14, windows-latest] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + os: ${{ fromJson(needs.load-matrix.outputs.os) }} + python-version: ${{ fromJson(needs.load-matrix.outputs.python) }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -43,10 +56,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.8' @@ -79,10 +92,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' @@ -189,10 +202,9 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 - + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' diff --git a/.github/workflows/regression-testing.yml b/.github/workflows/regression-testing.yml index bf6af402..ae53f46e 100644 --- a/.github/workflows/regression-testing.yml +++ b/.github/workflows/regression-testing.yml @@ -1,25 +1,43 @@ name: Regression Testing on: + push: + branches: ['*'] + tags: ['*'] + pull_request: + branches: [ master ] schedule: - cron: 0 0 * * * jobs: + load-matrix: + runs-on: ubuntu-latest + outputs: + python: ${{ steps.set-matrix.outputs.python }} + os: ${{ steps.set-matrix.outputs.os }} + steps: + - uses: actions/checkout@v4 + - id: set-matrix + run: | + echo "python=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/python-versions.txt)" >> $GITHUB_OUTPUT + echo "os=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/os-versions.txt)" >> $GITHUB_OUTPUT + test: + needs: load-matrix runs-on: ${{ matrix.os }} strategy: max-parallel: 1 matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + os: ${{ fromJson(needs.load-matrix.outputs.os) }} + python-version: ${{ fromJson(needs.load-matrix.outputs.python) }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} From df8595f9e5999f770e3f9bfa5fb4e3cfbc20cdc7 Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Wed, 25 Feb 2026 17:27:28 -0500 Subject: [PATCH 02/10] Add python 3.13 and 3.14 support and drop python 3.7 --- .github/workflows-config/python-versions.txt | 4 +++- setup.py | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows-config/python-versions.txt b/.github/workflows-config/python-versions.txt index af935eb5..c8dc2a73 100644 --- a/.github/workflows-config/python-versions.txt +++ b/.github/workflows-config/python-versions.txt @@ -2,4 +2,6 @@ 3.9 3.10 3.11 -3.12 \ No newline at end of file +3.12 +3.13 +3.14 \ No newline at end of file diff --git a/setup.py b/setup.py index f1df6c49..f0b3fca1 100644 --- a/setup.py +++ b/setup.py @@ -77,19 +77,20 @@ def get_stubs_version_range() -> str: "console_scripts": ["lean=lean.main:main"] }, install_requires=install_requires, - python_requires=">= 3.7", + python_requires=">= 3.8", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Financial and Insurance Industry", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12" + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14" ], project_urls={ "Documentation": "https://www.lean.io/docs/v2/lean-cli/key-concepts/getting-started", From 32f922b932580c354c76940d486c2db566246c8d Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Wed, 25 Feb 2026 17:36:02 -0500 Subject: [PATCH 03/10] Remove python 3.14 due to pydantic v1 incompatibility --- .github/workflows-config/python-versions.txt | 3 +-- setup.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows-config/python-versions.txt b/.github/workflows-config/python-versions.txt index c8dc2a73..04636f5b 100644 --- a/.github/workflows-config/python-versions.txt +++ b/.github/workflows-config/python-versions.txt @@ -3,5 +3,4 @@ 3.10 3.11 3.12 -3.13 -3.14 \ No newline at end of file +3.13 \ No newline at end of file diff --git a/setup.py b/setup.py index f0b3fca1..df6f6c5b 100644 --- a/setup.py +++ b/setup.py @@ -89,8 +89,7 @@ def get_stubs_version_range() -> str: "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: 3.14" + "Programming Language :: Python :: 3.13" ], project_urls={ "Documentation": "https://www.lean.io/docs/v2/lean-cli/key-concepts/getting-started", From 8284c66fc320d66b195309322203a8bdc169ac49 Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Wed, 25 Feb 2026 18:12:49 -0500 Subject: [PATCH 04/10] Fix issues with python 3.13 --- lean/components/util/path_manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lean/components/util/path_manager.py b/lean/components/util/path_manager.py index a9574b88..6e9a3f5c 100644 --- a/lean/components/util/path_manager.py +++ b/lean/components/util/path_manager.py @@ -12,6 +12,7 @@ # limitations under the License. from pathlib import Path +from typing import Optional from lean.components import reserved_names, output_reserved_names, forbidden_characters from lean.components.config.lean_config_manager import LeanConfigManager @@ -29,13 +30,15 @@ def __init__(self, lean_config_manager: LeanConfigManager, platform_manager: Pla self._lean_config_manager = lean_config_manager self._platform_manager = platform_manager - def get_relative_path(self, destination: Path, source: Path = Path.cwd()) -> Path: + def get_relative_path(self, destination: Path, source: Optional[Path] = None) -> Path: """Returns a path relative to another one. :param destination: the path to point to :param source: the root where the relative path is relative to :return: the destination path relative to the source path, or destination path if it is not relative """ + if source is None: + source = Path.cwd() try: return destination.relative_to(source) except ValueError: From 3a48d5c98b56364a691c37cd75ecaa4115134748 Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Fri, 27 Feb 2026 14:47:46 -0500 Subject: [PATCH 05/10] Fix pyfakefs blocking setuptools data files in Python 3.9+ --- tests/conftest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 0aad21c2..885a351f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -17,6 +17,7 @@ import certifi import pytest +import setuptools from pyfakefs.fake_filesystem import FakeFilesystem from responses import RequestsMock @@ -95,6 +96,9 @@ def fake_filesystem(fs: FakeFilesystem) -> FakeFilesystem: # This is required to be able to send HTTP requests using requests fs.add_real_file(certifi.where()) + # Proxy access to setuptools to the real filesystem + fs.add_real_directory(os.path.dirname(setuptools.__file__), read_only=True) + # Proxy access to package data to the real filesystem fs.add_real_directory(os.path.join(os.path.dirname(__file__), "../lean/ssh")) From c82eb40ec92301a8f057d9f630f48a649e669ad4 Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Fri, 27 Feb 2026 15:33:43 -0500 Subject: [PATCH 06/10] Force pkg_resources import before pyfakefs to fix test failures --- tests/conftest.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 885a351f..1cc567ca 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -16,8 +16,8 @@ from unittest import mock import certifi +import pkg_resources import pytest -import setuptools from pyfakefs.fake_filesystem import FakeFilesystem from responses import RequestsMock @@ -96,9 +96,6 @@ def fake_filesystem(fs: FakeFilesystem) -> FakeFilesystem: # This is required to be able to send HTTP requests using requests fs.add_real_file(certifi.where()) - # Proxy access to setuptools to the real filesystem - fs.add_real_directory(os.path.dirname(setuptools.__file__), read_only=True) - # Proxy access to package data to the real filesystem fs.add_real_directory(os.path.join(os.path.dirname(__file__), "../lean/ssh")) From ad2bb6abe7f8c65017866ae76956d80252018e2c Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Fri, 27 Feb 2026 16:07:53 -0500 Subject: [PATCH 07/10] Install setuptools to support Python 3.12 --- .github/workflows/regression-testing.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/regression-testing.yml b/.github/workflows/regression-testing.yml index ae53f46e..9ca34930 100644 --- a/.github/workflows/regression-testing.yml +++ b/.github/workflows/regression-testing.yml @@ -42,7 +42,9 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies - run: pip install -r requirements.txt + run: | + pip install setuptools==69.5.1 wheel + pip install -r requirements.txt - name: Run normal tests run: python -m pytest -s -rs From da4a0a003b638e762ef97dfcfed3dd88c8457de0 Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Fri, 27 Feb 2026 17:23:01 -0500 Subject: [PATCH 08/10] Restore Python 3.7 support in setup.py --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index df6f6c5b..d3a270d4 100644 --- a/setup.py +++ b/setup.py @@ -77,13 +77,14 @@ def get_stubs_version_range() -> str: "console_scripts": ["lean=lean.main:main"] }, install_requires=install_requires, - python_requires=">= 3.8", + python_requires=">= 3.7", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: Financial and Insurance Industry", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", From 1810e5783b4cfee5c8124ccccfba6871fa31d78f Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Fri, 27 Feb 2026 17:37:44 -0500 Subject: [PATCH 09/10] Minor fix --- tests/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 1cc567ca..0aad21c2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -16,7 +16,6 @@ from unittest import mock import certifi -import pkg_resources import pytest from pyfakefs.fake_filesystem import FakeFilesystem from responses import RequestsMock From 529c912d8bed68f3032830bb1c6180ea28c5e585 Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Fri, 27 Feb 2026 18:50:15 -0500 Subject: [PATCH 10/10] Optimize test matrix for push events --- .github/workflows/regression-testing.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/regression-testing.yml b/.github/workflows/regression-testing.yml index 9ca34930..3cf269ae 100644 --- a/.github/workflows/regression-testing.yml +++ b/.github/workflows/regression-testing.yml @@ -19,8 +19,13 @@ jobs: - uses: actions/checkout@v4 - id: set-matrix run: | - echo "python=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/python-versions.txt)" >> $GITHUB_OUTPUT - echo "os=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/os-versions.txt)" >> $GITHUB_OUTPUT + if [ "${{ github.event_name }}" == "schedule" ]; then + echo "python=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/python-versions.txt)" >> $GITHUB_OUTPUT + echo "os=$(jq -Rsc 'split("\n") | map(select(length > 0))' .github/workflows-config/os-versions.txt)" >> $GITHUB_OUTPUT + else + echo 'python=["3.13"]' >> $GITHUB_OUTPUT + echo 'os=["ubuntu-24.04","macos-15","windows-latest"]' >> $GITHUB_OUTPUT + fi test: needs: load-matrix