Skip to content

Commit 41bccfe

Browse files
Test Python 3.9 and 3.12 on CI, test minimum dependencies (jupyterlab#1029)
* Test Python 3.9 and 3.13 on CI, test minimum dependencies * Bump versions in pyproject.toml files, define hatch build * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix spurious dev install in Python unit tests job * Restore the install from script, add pip list * Fix the issue * Satisfy mypy typing, fix missing import * Fail if any of commands in install script fails * Revert back the attempt to use 3.13 * Add local dependencies specification * Update the `requires-python` to `>=3.9,<3.13` in monorepo * Drop `include_hidden=all_files` from `iglob` instead as per review users can still do `/learn .*` and it would be in line how `bash`/`zsh` works (e.g. `ls * -a` does not files in hidden directories but `ls .*` does). * Update Python pin to just `>3.9` --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 7c3d3a9 commit 41bccfe

File tree

5 files changed

+34
-7
lines changed

5 files changed

+34
-7
lines changed

.github/workflows/unit-tests.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,32 @@ on:
1212

1313
jobs:
1414
unit-tests:
15-
name: Unit tests
15+
name: Unit tests (Python ${{ matrix.python-version }}, ${{ matrix.dependency-type }} dependencies)
1616
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- dependency-type: minimum
22+
python-version: "3.9"
23+
- dependency-type: standard
24+
python-version: "3.12"
1725
steps:
1826
- name: Checkout
1927
uses: actions/checkout@v4
2028

2129
- name: Base Setup
2230
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
31+
with:
32+
python_version: ${{ matrix.python-version }}
33+
dependency_type: ${{ matrix.dependency-type }}
2334

2435
- name: Install extension dependencies and build the extension
2536
run: ./scripts/install.sh
2637

38+
- name: List installed versions
39+
run: pip list
40+
2741
- name: Execute unit tests
2842
run: |
2943
set -eux

packages/jupyter-ai-magics/jupyter_ai_magics/tests/test_magics.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,9 @@ def test_max_history(ip, transcript, max_history, expected_context):
9191
ai_magics.transcript = transcript.copy()
9292
ai_magics.max_history = max_history
9393
provider = ai_magics._get_provider("openrouter")
94-
with patch.object(provider, "generate") as generate, patch.dict(
95-
os.environ, OPENROUTER_API_KEY="123"
94+
with (
95+
patch.object(provider, "generate") as generate,
96+
patch.dict(os.environ, OPENROUTER_API_KEY="123"),
9697
):
9798
generate.return_value.generations = [[Mock(text="Leet code")]]
9899
result = ip.run_cell_magic(

packages/jupyter-ai/jupyter_ai/document_loaders/directory.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def collect_filepaths(path, all_files: bool):
136136
filepaths = walk_directory(path, all_files)
137137
else:
138138
filepaths = []
139-
for glob_path in iglob(str(path), include_hidden=all_files, recursive=True):
139+
for glob_path in iglob(str(path), recursive=True):
140140
if os.path.isfile(glob_path):
141141
filepaths.append(Path(glob_path))
142142
valid_exts = {j.lower() for j in SUPPORTED_EXTS}

pyproject.toml

+14-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ build-backend = "hatchling.build"
55
[project]
66
name = "jupyter_ai_monorepo"
77
dynamic = ["version", "description", "authors", "urls", "keywords"]
8-
requires-python = ">=3.8"
9-
dependencies = []
8+
requires-python = ">=3.9"
9+
dependencies = [
10+
"jupyter-ai-magics @ {root:uri}/packages/jupyter-ai-magics",
11+
"jupyter-ai @ {root:uri}/packages/jupyter-ai"
12+
]
1013

1114
[project.optional-dependencies]
1215
build = []
@@ -22,6 +25,15 @@ text = "BSD 3-Clause License"
2225
source = "nodejs"
2326
path = "package.json"
2427

28+
[tool.hatch.build]
29+
packages = [
30+
"packages/jupyter-ai-magics",
31+
"packages/jupyter-ai"
32+
]
33+
34+
[tool.hatch.metadata]
35+
allow-direct-references = true
36+
2537
[tool.check-manifest]
2638
ignore = [".*"]
2739

scripts/install.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
2+
set -eux
33
# install core packages
44
pip install jupyterlab~=4.0
55
cp playground/config.example.py playground/config.py

0 commit comments

Comments
 (0)