Skip to content

chore: refactor the experimental code off nbdev #2087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e7a2d88
added scafolding for tests
jjmachan Jun 21, 2025
e43441d
migrated all the tests
jjmachan Jun 21, 2025
18c9ba3
removed unused imports
jjmachan Jun 21, 2025
0a78c80
simplified Makefile
jjmachan Jun 21, 2025
1282bac
fix format
jjmachan Jun 21, 2025
e882b49
simplified the make file
jjmachan Jun 21, 2025
bc54634
added the ci
jjmachan Jun 21, 2025
0799188
fix install
jjmachan Jun 21, 2025
c715555
added dependencies
jjmachan Jun 21, 2025
9f892f5
document how to code with this project
jjmachan Jun 21, 2025
576cca4
update CI
jjmachan Jun 21, 2025
47c8644
added group to uv
jjmachan Jun 21, 2025
dd92f28
removed autogenerated comments
jjmachan Jun 21, 2025
91facf8
refactored off `@patch`
jjmachan Jun 22, 2025
41dc6d5
added a plugin system for backend
jjmachan Jun 23, 2025
32f5b83
added plugin docs
jjmachan Jun 23, 2025
ab4023a
fixed type issue for backend
jjmachan Jun 23, 2025
83c5e98
fixed some issue from PR
jjmachan Jun 23, 2025
0f18152
refactored the rest
jjmachan Jun 23, 2025
dc6d283
removed settings.ini
jjmachan Jun 23, 2025
adc0cf9
formating
jjmachan Jun 23, 2025
a976d89
removed all the old files completely
jjmachan Jun 24, 2025
d56e2f7
fixed CI
jjmachan Jun 24, 2025
5370057
fix formatting
jjmachan Jun 24, 2025
205180f
unified the monorepo configurations to workspace.yaml
jjmachan Jun 24, 2025
735110e
fix circular imports
jjmachan Jun 24, 2025
1cfa066
optimized the CI
jjmachan Jun 24, 2025
ce3a710
fix the CI and comment out type test for experimental
jjmachan Jun 24, 2025
849fffa
fixing some names
jjmachan Jun 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 142 additions & 35 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
outputs:
related: ${{ steps.filter.outputs.related }}
ragas: ${{ steps.filter.outputs.ragas }}
ragas_experimental: ${{ steps.filter.outputs.ragas_experimental }}
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@v4
Expand All @@ -35,12 +36,16 @@ jobs:
- codecov.yml
- pyproject.toml
- requirements/test.txt
- Makefile
ragas:
- *related
- "ragas/src/ragas/**"
- "ragas/tests/**"
ragas_experimental:
- *related
- "experimental/ragas_experimental/**"
- "experimental/tests/**"
- "experimental/pyproject.toml"
docs:
- *related
- requirements/docs-requirements.txt
Expand All @@ -53,11 +58,24 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
include:
# Critical path: Latest + oldest Python on Ubuntu (full test suite)
- os: ubuntu-latest
python-version: "3.9"
test-type: "full"
- os: ubuntu-latest
python-version: "3.12"
test-type: "full"
# Cross-platform validation (essential tests only)
- os: macos-latest
python-version: "3.11"
test-type: "essential"
- os: windows-latest
python-version: "3.10"
test-type: "essential"

if: ${{ (github.event_name == 'pull_request' && needs.diff.outputs.ragas == 'true') || github.event_name == 'push' }}
name: python${{ matrix.python-version }}_unit_tests (${{ matrix.os }})
name: python${{ matrix.python-version }}_unit_tests (${{ matrix.os }}, ${{ matrix.test-type }})
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -71,80 +89,169 @@ jobs:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.os == 'macos-latest' && 'arm64' || 'x64' }}

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Get pip cache dir
id: cache-dir
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: Cache pip dependencies
uses: actions/cache@v3
id: cache-pip
- name: Cache dependencies (UV cache)
uses: actions/cache@v4
id: cache-deps
with:
path: ${{ steps.cache-dir.outputs.dir }}
key: ${{ runner.os }}-tests-${{ hashFiles('requirements/test.txt') }}
path: |
${{ steps.cache-dir.outputs.dir }}
~/.cache/uv
key: deps-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('ragas/pyproject.toml', 'requirements/*.txt') }}
restore-keys: |
deps-${{ runner.os }}-py${{ matrix.python-version }}-
deps-${{ runner.os }}-py3.11-
deps-${{ runner.os }}-

- name: Install dependencies
run: |
pip install "./ragas"
pip install -r requirements/test.txt

# Use UV with system installation for CI (simpler and more reliable)
uv pip install --system -e "./ragas[dev]" --cache-dir ~/.cache/uv

- name: Run unit tests
run: |
# OPTS=(--cov-config pyproject.toml --cov=src/bentoml --cov-append)
# Configure test options based on OS and test type
if [ "${{ matrix.os }}" != 'windows-latest' ]; then
# we will use pytest-xdist to improve tests run-time.
# Use pytest-xdist to improve test run-time on Linux/macOS
OPTS=(--dist loadfile -n auto)
fi
# Now run the unit tests
pytest --nbmake ragas/tests/unit "${OPTS[@]}"

# Run different test suites based on test type
if [ "${{ matrix.test-type }}" = "full" ]; then
# Full test suite with notebook tests
cd ragas && pytest --nbmake tests/unit "${OPTS[@]}"
else
# Essential tests only (faster for cross-platform validation)
cd ragas && pytest tests/unit -k "not slow" "${OPTS[@]}"
fi
env:
__RAGAS_DEBUG_TRACKING: true
RAGAS_DO_NOT_TRACK: true

codestyle_check:
runs-on: ubuntu-latest
experimental_tests:
needs:
- diff

if: ${{ (github.event_name == 'pull_request' && needs.diff.outputs.ragas == 'true') || github.event_name == 'push' }}
strategy:
fail-fast: false
matrix:
include:
# Focus on stable Python versions for experimental features
- os: ubuntu-latest
python-version: "3.11"
test-type: "full"
- os: ubuntu-latest
python-version: "3.12"
test-type: "full"

if: ${{ (github.event_name == 'pull_request' && needs.diff.outputs.ragas_experimental == 'true') || github.event_name == 'push' }}
name: python${{ matrix.python-version }}_experimental_tests (${{ matrix.os }})
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags and branches

- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10.6"
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Get pip cache dir
id: cache-dir
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: Fetch origin
run: git fetch origin "$GITHUB_BASE_REF"
- name: Cache dependencies (UV cache)
uses: actions/cache@v4
id: cache-deps
with:
path: |
${{ steps.cache-dir.outputs.dir }}
~/.cache/uv
key: deps-${{ runner.os }}-py${{ matrix.python-version }}-exp-${{ hashFiles('ragas/pyproject.toml', 'experimental/pyproject.toml') }}
restore-keys: |
deps-${{ runner.os }}-py${{ matrix.python-version }}-exp-
deps-${{ runner.os }}-py${{ matrix.python-version }}-
deps-${{ runner.os }}-py3.11-
deps-${{ runner.os }}-

- name: Install dependencies
run: |
# Use UV with system installation for CI (simpler and more reliable)
uv pip install --system -e "./ragas[dev]" --cache-dir ~/.cache/uv
uv pip install --system -e "./experimental[dev]" --cache-dir ~/.cache/uv

- name: Run experimental tests
run: |
cd experimental && pytest -v --tb=short
env:
__RAGAS_DEBUG_TRACKING: true
RAGAS_DO_NOT_TRACK: true

code_quality_check:
runs-on: ubuntu-latest
needs:
- diff

if: ${{ (github.event_name == 'pull_request' && (needs.diff.outputs.ragas == 'true' || needs.diff.outputs.ragas_experimental == 'true')) || github.event_name == 'push' }}

steps:
- uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v3
- name: Setup python
uses: actions/setup-python@v5
with:
node-version: "17"
python-version: "3.11"
architecture: x64

- name: Cache pip dependencies
uses: actions/cache@v3
id: cache-pip
- name: Install uv
uses: astral-sh/setup-uv@v4

- name: Get pip cache dir
id: cache-dir
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies (UV cache)
uses: actions/cache@v4
id: cache-deps
with:
path: ${{ steps.cache-dir.outputs.dir }}
key: codestyle-${{ hashFiles('requirements/dev.txt') }}
path: |
${{ steps.cache-dir.outputs.dir }}
~/.cache/uv
key: deps-ubuntu-py3.11-codestyle-${{ hashFiles('ragas/pyproject.toml', 'experimental/pyproject.toml', 'requirements/*.txt') }}
restore-keys: |
deps-ubuntu-py3.11-codestyle-
deps-ubuntu-py3.11-
deps-ubuntu-

- name: Install dependencies
run: |
pip install ./ragas
pip install -r requirements/dev.txt
# Use UV with system installation for CI (simpler and more reliable)
uv pip install --system -e "./ragas[dev]" --cache-dir ~/.cache/uv
uv pip install --system -e "./experimental[dev]" --cache-dir ~/.cache/uv

- name: Format check (dry run)
run: |
# Check if code is properly formatted (without making changes)
echo "Checking ragas formatting..."
black --check --config ragas/pyproject.toml ragas/src ragas/tests docs
ruff check ragas/src docs ragas/tests
echo "Checking experimental formatting..."
cd experimental && black --check ragas_experimental && ruff check ragas_experimental

- name: Lint check
run: make lint
- name: Type check
if: ${{ github.event_name == 'pull_request' }}
run: make type
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@ uv.lock
# nbdev
_proc/
site/
**/old_nbs/*.md
3 changes: 2 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,5 @@ analytics_logger.addHandler(console_handler)

## Memories

- whenever you create such docs put in in /experiments because that is gitignored and you can use it as a scratchpad or tmp directory for storing these
- whenever you create such docs put in in /experiments because that is gitignored and you can use it as a scratchpad or tmp directory for storing these
- always use uv to run python and python related commandline tools like isort, ruff, pyright ect. This is because we are using uv to manage the .venv and dependencies.
Loading
Loading