Skip to content

Commit 57e5c89

Browse files
tylerhutchersonSam Partee
andauthored
Incorporate notebook tests (#53)
This PR introduces Jupyter notebook tests using the `treon` framework: https://github.com/ReviewNB/treon To run notebook tests: ``` treon docs/ -v ``` Co-authored-by: Sam Partee <sam.partee@redis.com>
1 parent 9b5a13a commit 57e5c89

File tree

7 files changed

+16
-12
lines changed

7 files changed

+16
-12
lines changed

.github/workflows/run_tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
OPENAI_API_KEY: ${{ secrets.OPENAI_KEY }}
4141
run: |
4242
make test-cov
43+
- name: Run notebooks
44+
env:
45+
OPENAI_API_KEY: ${{ secrets.OPENAI_KEY }}
46+
run: |
47+
cd docs/ && treon -v --exclude="./examples/openai_qna.ipynb"
4348
- name: Publish coverage results
4449
uses: codecov/codecov-action@v2
4550
with:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ redisvl.egg-info/
44
.coverage
55
scratch
66
.DS_Store
7-
*.csv
7+
*.csv
8+
wiki_schema.yaml

docs/examples/openai_qna.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@
849849
"name": "python",
850850
"nbconvert_exporter": "python",
851851
"pygments_lexer": "ipython3",
852-
"version": "3.8.13"
852+
"version": "3.9.12"
853853
},
854854
"orig_nbformat": 4
855855
},

docs/user_guide/hybrid_queries_02.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@
697697
"name": "python",
698698
"nbconvert_exporter": "python",
699699
"pygments_lexer": "ipython3",
700-
"version": "3.8.13"
700+
"version": "3.10.10"
701701
},
702702
"orig_nbformat": 4,
703703
"vscode": {

docs/user_guide/llmcache_03.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@
2929
"import getpass\n",
3030
"os.environ[\"TOKENIZERS_PARALLELISM\"] = \"False\"\n",
3131
"\n",
32-
"api_key = os.getenv(\"OPENAI_API_KEY\", None)\n",
33-
"if not api_key:\n",
34-
" api_key = getpass.getpass(\"Enter your OpenAI API key: \")\n",
32+
"\n",
33+
"api_key = os.getenv(\"OPENAI_API_KEY\") or getpass.getpass(\"Enter your OpenAI API key: \")\n",
3534
"\n",
3635
"openai.api_key = api_key\n",
3736
"\n",
@@ -377,7 +376,7 @@
377376
"name": "python",
378377
"nbconvert_exporter": "python",
379378
"pygments_lexer": "ipython3",
380-
"version": "3.8.13"
379+
"version": "3.10.10"
381380
},
382381
"orig_nbformat": 4
383382
},

docs/user_guide/vectorizers_03.ipynb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@
6969
"import getpass\n",
7070
"\n",
7171
"# setup the API Key\n",
72-
"api_key = os.environ.get(\"OPENAI_API_KEY\")\n",
73-
"if not api_key:\n",
74-
" api_key = getpass.getpass(\"Enter your OpenAI API key: \")"
72+
"api_key = os.environ.get(\"OPENAI_API_KEY\") or getpass.getpass(\"Enter your OpenAI API key: \")"
7573
]
7674
},
7775
{
@@ -379,7 +377,7 @@
379377
"name": "python",
380378
"nbconvert_exporter": "python",
381379
"pygments_lexer": "ipython3",
382-
"version": "3.8.13"
380+
"version": "3.10.10"
383381
},
384382
"orig_nbformat": 4,
385383
"vscode": {

requirements-dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ pytest-asyncio
77
mypy
88
types-redis
99
types-pyyaml
10-
types-tabulate
10+
types-tabulate
11+
treon

0 commit comments

Comments
 (0)