Skip to content
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

Test Python 3.9 and 3.12 on CI, test minimum dependencies #1029

Merged
merged 13 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 15 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
16 changes: 14 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
dlqqq marked this conversation as resolved.
Show resolved Hide resolved

[project.optional-dependencies]
build = []
Expand All @@ -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 = [".*"]

Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

set -eux
# install core packages
pip install jupyterlab~=4.0
cp playground/config.example.py playground/config.py
Expand Down
Loading