From 2039104bd30ba785dee41830d9482be2d9c2cf14 Mon Sep 17 00:00:00 2001 From: SavioNYJC Date: Fri, 24 Apr 2026 16:17:02 +0800 Subject: [PATCH 1/5] feat: implemented CI workflows for python 3.12 --- .github/workflows/integration-tests.yml | 14 +++++--- .github/workflows/python-ci.yml | 43 +++++++++++++++++++++++++ .github/workflows/sanity-check.yml | 10 ++++-- .github/workflows/type-check.yml | 8 ++++- .github/workflows/unit-tests.yml | 8 ++++- 5 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/python-ci.yml diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index d7303ab9..bb41fcc8 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -12,11 +12,17 @@ env: jobs: integration-tests: + name: Integration Tests (${{ matrix.python-version }}) runs-on: ubuntu-latest timeout-minutes: 8 - # Run integration tests for all target branches - # Required to pass for staging/main, optional for weekly - continue-on-error: ${{ github.base_ref == 'weekly' || (github.event_name == 'push' && github.ref_name == 'weekly') }} + # Run integration tests for both supported versions. + # Python 3.12 remains visible-but-optional during the migration window. + # Weekly branch integration failures remain non-blocking as before. + continue-on-error: ${{ matrix.python-version == '3.12' || github.base_ref == 'weekly' || (github.event_name == 'push' && github.ref_name == 'weekly') }} + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.12'] env: ENV: testing steps: @@ -24,7 +30,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: ${{ matrix.python-version }} - name: Install Poetry run: | python -m pip install --upgrade pip diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml new file mode 100644 index 00000000..8c52014c --- /dev/null +++ b/.github/workflows/python-ci.yml @@ -0,0 +1,43 @@ +name: Python CI + +on: + push: + pull_request: + +jobs: + test: + name: Python CI (${{ matrix.python-version }}) + runs-on: ubuntu-latest + # Keep 3.12 visible in CI while upstream Campus dependencies finish their own migration. + continue-on-error: ${{ matrix.python-version == '3.12' }} + strategy: + fail-fast: false + matrix: + python-version: ["3.11", "3.12"] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + run: pip install poetry + + - name: Install project dependencies + run: poetry install --no-root + + - name: Run sanity checks + run: poetry run python tests/run_tests.py sanity + + - name: Run unit tests + run: poetry run python tests/run_tests.py unit + + - name: Run Ruff + run: poetry run ruff check . + + - name: Run Pyright + run: poetry run python tests/run_tests.py type diff --git a/.github/workflows/sanity-check.yml b/.github/workflows/sanity-check.yml index d182604d..43ded883 100644 --- a/.github/workflows/sanity-check.yml +++ b/.github/workflows/sanity-check.yml @@ -12,14 +12,20 @@ env: jobs: sanity-check: + name: Sanity Check (${{ matrix.python-version }}) runs-on: ubuntu-latest timeout-minutes: 2 + continue-on-error: ${{ matrix.python-version == '3.12' }} + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.12'] steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: ${{ matrix.python-version }} - name: Install Poetry run: | python -m pip install --upgrade pip @@ -29,4 +35,4 @@ jobs: - name: Install Campus Suite run: poetry install --no-root - name: Run Sanity Checks - run: poetry run tests/run_tests.py sanity + run: poetry run python tests/run_tests.py sanity diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml index 8dc7179e..5be7c2a6 100644 --- a/.github/workflows/type-check.yml +++ b/.github/workflows/type-check.yml @@ -9,8 +9,14 @@ on: jobs: type-check: + name: Type Check (${{ matrix.python-version }}) runs-on: ubuntu-latest timeout-minutes: 3 + continue-on-error: ${{ matrix.python-version == '3.12' }} + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.12'] env: ENV: testing steps: @@ -18,7 +24,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: ${{ matrix.python-version }} - name: Install Poetry run: | python -m pip install --upgrade pip diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index c45ff557..72d9dc99 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -12,8 +12,14 @@ env: jobs: unit-tests: + name: Unit Tests (${{ matrix.python-version }}) runs-on: ubuntu-latest timeout-minutes: 3 + continue-on-error: ${{ matrix.python-version == '3.12' }} + strategy: + fail-fast: false + matrix: + python-version: ['3.11', '3.12'] env: ENV: testing steps: @@ -21,7 +27,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: ${{ matrix.python-version }} - name: Install Poetry run: | python -m pip install --upgrade pip From 38ae674a3559186800286dc006f020892ca0d0cb Mon Sep 17 00:00:00 2001 From: SavioNYJC Date: Fri, 24 Apr 2026 16:18:33 +0800 Subject: [PATCH 2/5] feat: updated docs to include support for python 3.12 --- AGENTS.md | 13 ++++++++----- README.md | 4 ++-- docs/GETTING-STARTED.md | 15 +++++++++------ tests/sanity_check.py | 2 +- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 8422202b..48a68030 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -9,19 +9,22 @@ Essential reminders for working on the Campus codebase. This guide applies to bo Campus uses pyenv for Python version management and pipx for Poetry installation. **Prerequisites:** -- pyenv with Python 3.11 installed +- pyenv with Python 3.11 and/or 3.12 installed - pipx with Poetry installed - `~/.local/bin` and pyenv shims in PATH (configured in `~/.bashrc`) **Installation:** ```bash # Install pyenv (via package manager) -# Install Python 3.11 +# Install supported Python versions pyenv install 3.11.11 -pyenv local 3.11.11 +pyenv install 3.12.0 -# Install Poetry via pipx (user-level, isolated) -pipx install --python python3.11 poetry +# Prefer 3.12 for new setups; 3.11 remains supported +pyenv local 3.12.0 + +# Install Poetry via pipx using the active interpreter +pipx install poetry ``` ### 2. Running Python Commands diff --git a/README.md b/README.md index aebd6bc0..30912d33 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Campus -[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/) +[![Python 3.11 | 3.12](https://img.shields.io/badge/python-3.11%20%7C%203.12-blue.svg)](https://www.python.org/downloads/) [![Flask 3.0+](https://img.shields.io/badge/flask-3.0+-green.svg)](https://flask.palletsprojects.com/) [![Poetry](https://img.shields.io/badge/dependency%20management-poetry-blue.svg)](https://python-poetry.org/) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) @@ -23,7 +23,7 @@ Campus is a comprehensive educational management platform that provides: ### Prerequisites -- Python 3.11 or higher +- Python 3.11 or 3.12 - Poetry for dependency management - PostgreSQL and MongoDB (for vault and storage services; extensible to support other storage backends) diff --git a/docs/GETTING-STARTED.md b/docs/GETTING-STARTED.md index c5ebf6de..4c5169e2 100644 --- a/docs/GETTING-STARTED.md +++ b/docs/GETTING-STARTED.md @@ -33,7 +33,7 @@ For those deploying or using Campus: ### Prerequisites - **pyenv** for Python version management -- **Python 3.11** (managed via pyenv) +- **Python 3.11 or 3.12** (managed via pyenv; prefer 3.12 for new setups) - **pipx** for installing Poetry - **Poetry** for dependency management (installed via pipx) - PostgreSQL (for auth service database) @@ -43,14 +43,17 @@ For those deploying or using Campus: ```bash # 1. Install pyenv (Arch: pacman -S python-pyenv) -# 2. Install Python 3.11 +# 2. Install supported Python versions pyenv install 3.11.11 -pyenv local 3.11.11 +pyenv install 3.12.0 -# 3. Install Poetry via pipx (user-level, isolated) -pipx install --python python3.11 poetry +# 3. Select the interpreter for this repo (3.12 preferred; 3.11 also supported) +pyenv local 3.12.0 -# 4. Configure PATH in ~/.bashrc: +# 4. Install Poetry via pipx (user-level, isolated) +pipx install poetry + +# 5. Configure PATH in ~/.bashrc: export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/shims:$PATH" # pyenv shims first export PATH="$HOME/.local/bin:$PATH" # pipx binaries diff --git a/tests/sanity_check.py b/tests/sanity_check.py index 6affb7eb..eb34e650 100644 --- a/tests/sanity_check.py +++ b/tests/sanity_check.py @@ -161,7 +161,7 @@ def test_python_version_matches_requirements(self): "Could not find python requirement in pyproject.toml" ) - # Parse version constraint (e.g., ">=3.11.0,<3.12") + # Parse version constraint (e.g., ">=3.11.0,<3.13") runtime_version = sys.version_info runtime_version_str = f"{runtime_version.major}.{runtime_version.minor}.{runtime_version.micro}" From 9d9e13001c3cb2476f880a9682e51ed74ee70c11 Mon Sep 17 00:00:00 2001 From: SavioNYJC Date: Fri, 24 Apr 2026 16:19:19 +0800 Subject: [PATCH 3/5] feat: updated pyprojec.toml to support python 3.12 (actual dependencies still does not support it) --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f94bcf9a..6b121b57 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ readme = "README.md" packages = [{include = "campus"}] [tool.poetry.dependencies] -python = ">=3.11.0,<3.12" +python = ">=3.11.0,<3.13" # Campus internal dependencies campus-api-python = {git = "https://github.com/nyjc-computing/campus-api-python.git", branch = "main"} From c95505d2f36c161871fd9ff129b8128c7232e144 Mon Sep 17 00:00:00 2001 From: SavioNYJC Date: Fri, 24 Apr 2026 08:40:38 +0000 Subject: [PATCH 4/5] feat: reverted pyproject until dependencies are settled --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6b121b57..f94bcf9a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ readme = "README.md" packages = [{include = "campus"}] [tool.poetry.dependencies] -python = ">=3.11.0,<3.13" +python = ">=3.11.0,<3.12" # Campus internal dependencies campus-api-python = {git = "https://github.com/nyjc-computing/campus-api-python.git", branch = "main"} From f0e666c2117b641acaefabb716e8d7468fc84d1a Mon Sep 17 00:00:00 2001 From: JS Ng Date: Fri, 24 Apr 2026 19:02:17 +0800 Subject: [PATCH 5/5] Delete .github/workflows/python-ci.yml Workflow file that runs all the tests again, not required --- .github/workflows/python-ci.yml | 43 --------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 .github/workflows/python-ci.yml diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml deleted file mode 100644 index 8c52014c..00000000 --- a/.github/workflows/python-ci.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Python CI - -on: - push: - pull_request: - -jobs: - test: - name: Python CI (${{ matrix.python-version }}) - runs-on: ubuntu-latest - # Keep 3.12 visible in CI while upstream Campus dependencies finish their own migration. - continue-on-error: ${{ matrix.python-version == '3.12' }} - strategy: - fail-fast: false - matrix: - python-version: ["3.11", "3.12"] - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Poetry - run: pip install poetry - - - name: Install project dependencies - run: poetry install --no-root - - - name: Run sanity checks - run: poetry run python tests/run_tests.py sanity - - - name: Run unit tests - run: poetry run python tests/run_tests.py unit - - - name: Run Ruff - run: poetry run ruff check . - - - name: Run Pyright - run: poetry run python tests/run_tests.py type