Skip to content
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
11 changes: 11 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ jobs:
python3 generator.py ../changed_notebooks/
echo "Generated services:"
ls -la services/ || echo "No services directory"

- name: Install Test Dependencies
run: |
pip install pytest pytest-cov httpx fastapi starlette

- name: Run Tests on Generated Service
run: |
cd ../
export PYTHONPATH=$PYTHONPATH:$(pwd):$(pwd)/src
python -m pytest --cov=src --cov-report=term-missing -s
cd src/

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/tests.yml
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a separate workflow file so it can be manually triggered if needed

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run Tests

on:
push:
branches:
- N2R-31
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Run generator (create Dockerfile, main.py and requirements.txt)
run: |
pip install nbformat
rm -rf src/services/
cd src/
python3 generator.py ../notebooks/
echo "Generated services:"
ls -la services/ || echo "No services directory"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov httpx nbformat fastapi papermill uvicorn pandas lxml

- name: Run tests with coverage
run: |
cd ../
export PYTHONPATH=$PYTHONPATH:$(pwd):$(pwd)/src
python -m pytest --cov=src --cov-report=term-missing -s
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.DS_Store
.coverage

.terraform/
*.tfstate
*.tfstate.backup
*.auto.tfvars

/src/services
/src/services

__pycache__
112 changes: 112 additions & 0 deletions notebooks/dataframe/dataframe_output.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"df = pd.DataFrame({\n",
" \"user\": [\"A\", \"B\", \"C\"],\n",
" \"score\": [10, 15, 8]\n",
"})"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>user</th>\n",
" <th>score</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>A</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>B</td>\n",
" <td>15</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>C</td>\n",
" <td>8</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" user score\n",
"0 A 10\n",
"1 B 15\n",
"2 C 8"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.7"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
46 changes: 46 additions & 0 deletions notebooks/error/error_output.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "ZeroDivisionError",
"evalue": "division by zero",
"output_type": "error",
"traceback": [
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
"\u001b[31mZeroDivisionError\u001b[39m Traceback (most recent call last)",
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m \u001b[32;43m1\u001b[39;49m\u001b[43m \u001b[49m\u001b[43m/\u001b[49m\u001b[43m \u001b[49m\u001b[32;43m0\u001b[39;49m\n",
"\u001b[31mZeroDivisionError\u001b[39m: division by zero"
]
}
],
"source": [
"1 / 0"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.10"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
2 changes: 2 additions & 0 deletions notebooks/linearRegression/docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Description
This example notebook runs linear regression on Kaggle advertising dataset. Contains longer running process and combination of outputs (text,images,dataframe)
Loading
Loading