diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index ac8e9a60..00000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,69 +0,0 @@ -### Description - - - -### Environment - -- GraphRAG version: -- Python version: -- Operating System: - -### Steps to Reproduce (for bugs) - - - -1. Step 1 -2. Step 2 -3. ... - -### Expected Behavior - - - -### Actual Behavior - - - -### Screenshots / Logs (if applicable) - - - -### GraphRAG Configuration - - - -### Additional Information - - - -### Possible Solution (if you have one) - - - -### Is this a Bug or Feature Request? - - - -### Any related issues? - - - -### Any relevant discussions? - - - -### Checklist - - - -- [ ] I have searched for similar issues and didn't find any duplicates. -- [ ] I have provided a clear and concise description of the issue. -- [ ] I have included the necessary environment details. -- [ ] I have outlined the steps to reproduce the issue. -- [ ] I have included any relevant logs or screenshots. -- [ ] I have included the GraphRAG configuration for this run. -- [ ] I have indicated whether this is a bug or a feature request. - -### Additional Comments - - diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index ca5c5262..b27dcdc0 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -84,10 +84,6 @@ jobs: poetry run python -m pip install gensim poetry install - - name: Check Semversioner - run: | - poetry run semversioner check - - name: Check run: | poetry run poe check diff --git a/.github/workflows/python-notebook-tests.yml b/.github/workflows/python-notebook-tests.yml new file mode 100644 index 00000000..9ec1bed7 --- /dev/null +++ b/.github/workflows/python-notebook-tests.yml @@ -0,0 +1,70 @@ +name: Python Notebook Tests +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + pull-requests: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + # Only run the for the latest commit + cancel-in-progress: true + +env: + POETRY_VERSION: 1.8.3 + +jobs: + python-ci: + strategy: + matrix: + python-version: ["3.11"] + os: [ubuntu-latest, windows-latest] + fail-fast: false # Continue running all jobs even if one fails + env: + DEBUG: 1 + GRAPHRAG_API_KEY: ${{ secrets.OPENAI_NOTEBOOK_KEY }} + GRAPHRAG_LLM_MODEL: ${{ secrets.GRAPHRAG_LLM_MODEL }} + GRAPHRAG_EMBEDDING_MODEL: ${{ secrets.GRAPHRAG_EMBEDDING_MODEL }} + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + python: + - 'graphrag/**/*' + - 'poetry.lock' + - 'pyproject.toml' + - '**/*.py' + - '**/*.toml' + - '**/*.ipynb' + - '.github/workflows/python*.yml' + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + uses: abatilo/actions-poetry@v3.0.0 + with: + poetry-version: $POETRY_VERSION + + - name: Install dependencies + shell: bash + run: | + poetry self add setuptools wheel + poetry run python -m pip install gensim + poetry install + + + - name: Notebook Test + run: | + poetry run poe test_notebook diff --git a/pyproject.toml b/pyproject.toml index 470c36b5..40651657 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,6 +125,7 @@ _test_all = "coverage run -m pytest ./tests" test_unit = "pytest ./tests/unit" test_integration = "pytest ./tests/integration" test_smoke = "pytest ./tests/smoke" +test_notebook = "pytest ./tests/notebook" index = "python -m graphrag.index" query = "python -m graphrag.query" prompt_tune = "python -m graphrag.prompt_tune" diff --git a/tests/notebook/test_notebooks.py b/tests/notebook/test_notebooks.py index 9c1e789c..466bd173 100644 --- a/tests/notebook/test_notebooks.py +++ b/tests/notebook/test_notebooks.py @@ -1,38 +1,33 @@ # Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License import subprocess -import tempfile from pathlib import Path import nbformat import pytest -DOCS_PATH = Path("../../docsite") +NOTEBOOKS_PATH = Path("examples_notebooks") -notebooks_list = list(DOCS_PATH.rglob("*.ipynb")) +notebooks_list = list(NOTEBOOKS_PATH.rglob("*.ipynb")) def _notebook_run(filepath: Path): """Execute a notebook via nbconvert and collect output. :returns execution errors """ - with tempfile.NamedTemporaryFile(suffix=".ipynb") as temp_file: - args = [ - "jupyter", - "nbconvert", - "--to", - "notebook", - "--execute", - "-y", - "--no-prompt", - "--output", - temp_file.name, - filepath.absolute().as_posix(), - ] - subprocess.check_call(args) - - temp_file.seek(0) - nb = nbformat.read(temp_file, nbformat.current_nbformat) + args = [ + "jupyter", + "nbconvert", + "--to", + "notebook", + "--execute", + "-y", + "--no-prompt", + "--stdout", + filepath.absolute().as_posix(), + ] + notebook = subprocess.check_output(args) + nb = nbformat.reads(notebook, nbformat.current_nbformat) return [ output