feat: modularize installation and enforce feature dependency boundaries

This commit is contained in:
Bingxi Zhao (Frank)
2026-10-28 01:02:29 +08:00
parent e347c0c2e0
commit fbab59acbf
204 changed files with 6273 additions and 2699 deletions

28
.github/workflows/modules.yml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Modular installation
on:
pull_request:
paths:
- 'deeptutor/**'
- 'deeptutor_cli/**'
- 'pyproject.toml'
- 'build_support.py'
- 'setup.py'
- 'scripts/*module*'
- 'scripts/check_minimal_install.py'
- '.github/workflows/modules.yml'
workflow_dispatch:
jobs:
wheel-lifecycle:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.11', '3.13']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- run: python -m pip install --upgrade pip setuptools wheel
- run: python scripts/sync_module_requirements.py --check
- run: python scripts/build_modules.py --output dist/modules --module core --module solve --module parsing --module research --module calendar
- run: python scripts/check_module_install.py --wheelhouse dist/modules --extended

View File

@@ -1,11 +1,9 @@
name: PyPI Release
# Triggered when a GitHub Release is published.
# Publishes the full app package with the version derived from the release tag:
# - deeptutor (Python backend/CLI + packaged Next.js standalone assets)
#
# The CLI-only package is intentionally not published to PyPI; install it from
# a local checkout with `python -m pip install -e ./packaging/deeptutor-cli`.
# Builds disjoint core, feature, server and Web wheels from one revision.
# Each distribution needs this workflow configured as its trusted publisher.
# The CLI compatibility distribution contains metadata only.
#
# Expected tag format: vMAJOR.MINOR.PATCH, with PEP 440-compatible suffixes allowed.
# Example: GitHub release tag v1.3.10 -> PyPI version 1.3.10.
@@ -95,7 +93,7 @@ jobs:
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build packaging twine
python -m pip install --upgrade build packaging twine setuptools wheel
- name: Verify release tag matches deeptutor/__version__.py
id: version
@@ -148,12 +146,7 @@ jobs:
run: |
set -euo pipefail
mkdir -p dist/deeptutor
# Run from /tmp so any repository-local build/ directory cannot shadow
# PyPA's `build` module during repeated package builds.
# Wheels are the supported public install artifacts. The full app
# wheel contains packaged Next.js assets; source distributions would
# either duplicate those large assets or require a frontend build.
(cd /tmp && python -m build --wheel --outdir "$GITHUB_WORKSPACE/dist/deeptutor" "$GITHUB_WORKSPACE")
python scripts/build_modules.py --output dist/deeptutor
- name: Verify package metadata
run: |
@@ -175,7 +168,7 @@ jobs:
raise SystemExit(f"Missing expected distributions: {missing}")
PY
- name: Publish deeptutor to PyPI
- name: Publish module distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/deeptutor/

View File

@@ -54,7 +54,7 @@ jobs:
with:
python-version: "3.11"
- name: Install compatibility adapters
run: pip install -r requirements/server.txt -r requirements/partners.txt pytest pytest-asyncio
run: pip install -r requirements/full.txt -r requirements/partners.txt pytest pytest-asyncio
- name: Create synthetic model configuration
run: |
mkdir -p data/user/settings
@@ -238,14 +238,14 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/server.txt', 'requirements/cli.txt') }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/full.txt', 'requirements/cli.txt') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install minimal dependencies for import check
run: |
python -m pip install --upgrade pip
pip install -r requirements/server.txt
pip install -r requirements/full.txt
# Exercise project metadata too, especially `requires-python`.
pip install -e . --no-deps
@@ -310,14 +310,14 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/server.txt', 'requirements/cli.txt', 'requirements/partners.txt', 'pyproject.toml') }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements/full.txt', 'requirements/cli.txt', 'requirements/partners.txt', 'pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Install smoke test dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/server.txt
pip install -r requirements/full.txt
pip install -r requirements/partners.txt
pip install pytest pytest-asyncio
@@ -367,7 +367,7 @@ jobs:
with:
python-version: "3.11"
- name: Install test dependencies
run: pip install -r requirements/server.txt pytest pytest-asyncio
run: pip install -r requirements/full.txt pytest pytest-asyncio
- name: Check real rendering, isolation, cancellation and timeout
env:
DEEPTUTOR_TEST_VIDEO_SANDBOX: "1"