diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 05224180e..70c270cd6 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -12,18 +12,32 @@ on: jobs: unit-tests: - name: Unit tests + name: Unit tests (Python ${{ matrix.python-version }}, ${{ matrix.dependency-type }} dependencies) runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - dependency-type: minimum + python-version: "3.9" + - dependency-type: standard + python-version: "3.12" steps: - name: Checkout uses: actions/checkout@v4 - name: Base Setup uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 + with: + python_version: ${{ matrix.python-version }} + dependency_type: ${{ matrix.dependency-type }} - name: Install extension dependencies and build the extension run: ./scripts/install.sh + - name: List installed versions + run: pip list + - name: Execute unit tests run: | set -eux diff --git a/packages/jupyter-ai-magics/jupyter_ai_magics/tests/test_magics.py b/packages/jupyter-ai-magics/jupyter_ai_magics/tests/test_magics.py index 6e6b34fe9..bd440a97a 100644 --- a/packages/jupyter-ai-magics/jupyter_ai_magics/tests/test_magics.py +++ b/packages/jupyter-ai-magics/jupyter_ai_magics/tests/test_magics.py @@ -91,8 +91,9 @@ def test_max_history(ip, transcript, max_history, expected_context): ai_magics.transcript = transcript.copy() ai_magics.max_history = max_history provider = ai_magics._get_provider("openrouter") - with patch.object(provider, "generate") as generate, patch.dict( - os.environ, OPENROUTER_API_KEY="123" + with ( + patch.object(provider, "generate") as generate, + patch.dict(os.environ, OPENROUTER_API_KEY="123"), ): generate.return_value.generations = [[Mock(text="Leet code")]] result = ip.run_cell_magic( diff --git a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py index d8610fcf6..d3b81a839 100644 --- a/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py +++ b/packages/jupyter-ai/jupyter_ai/document_loaders/directory.py @@ -136,7 +136,7 @@ def collect_filepaths(path, all_files: bool): filepaths = walk_directory(path, all_files) else: filepaths = [] - for glob_path in iglob(str(path), include_hidden=all_files, recursive=True): + for glob_path in iglob(str(path), recursive=True): if os.path.isfile(glob_path): filepaths.append(Path(glob_path)) valid_exts = {j.lower() for j in SUPPORTED_EXTS} diff --git a/pyproject.toml b/pyproject.toml index d10ce4594..322177455 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,8 +5,11 @@ build-backend = "hatchling.build" [project] name = "jupyter_ai_monorepo" dynamic = ["version", "description", "authors", "urls", "keywords"] -requires-python = ">=3.8" -dependencies = [] +requires-python = ">=3.9" +dependencies = [ + "jupyter-ai-magics @ {root:uri}/packages/jupyter-ai-magics", + "jupyter-ai @ {root:uri}/packages/jupyter-ai" +] [project.optional-dependencies] build = [] @@ -22,6 +25,15 @@ text = "BSD 3-Clause License" source = "nodejs" path = "package.json" +[tool.hatch.build] +packages = [ + "packages/jupyter-ai-magics", + "packages/jupyter-ai" +] + +[tool.hatch.metadata] +allow-direct-references = true + [tool.check-manifest] ignore = [".*"] diff --git a/scripts/install.sh b/scripts/install.sh index ae5de0ffd..bfe594b03 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,5 +1,5 @@ #!/bin/bash - +set -eux # install core packages pip install jupyterlab~=4.0 cp playground/config.example.py playground/config.py