-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #187 from andreytaboola/master
Add support of keeping the local context of the python scripts and notebooks by preserving working directory
- Loading branch information
Showing
14 changed files
with
166 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.6.2" | ||
__version__ = "0.6.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Hello, World! | ||
This is a sample text file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def print_hello(): | ||
print("Hello, World!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "c63308ae-fa0a-4cd3-8e48-c5c2f16836c2", | ||
"metadata": { | ||
"editable": true, | ||
"execution": { | ||
"iopub.execute_input": "2024-06-26T09:33:30.963587Z", | ||
"iopub.status.busy": "2024-06-26T09:33:30.963239Z", | ||
"iopub.status.idle": "2024-06-26T09:33:30.974539Z", | ||
"shell.execute_reply": "2024-06-26T09:33:30.973885Z", | ||
"shell.execute_reply.started": "2024-06-26T09:33:30.963543Z" | ||
}, | ||
"slideshow": { | ||
"slide_type": "" | ||
}, | ||
"tags": [] | ||
}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Hello, World!\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import hello_module\n", | ||
"\n", | ||
"hello_module.print_hello()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"lines_to_next_cell": 0, | ||
"tags": [ | ||
"parameters" | ||
] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"plots = 5\n" | ||
], | ||
"id": "e4425e0625d403a" | ||
} | ||
], | ||
"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.8.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
filename = "hello.txt" | ||
|
||
# Open the file and read its content | ||
with open(filename, "r") as file: | ||
content = file.read() | ||
|
||
# Print the content | ||
print(content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import datetime | ||
import os | ||
import uuid | ||
|
||
import pytest | ||
|
||
from notebooker.execute_notebook import _run_checks | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def py_template_base_dir(): | ||
import tests.regression.local_context as local_context | ||
|
||
return os.path.abspath(local_context.__path__[0]) | ||
|
||
|
||
def all_templates(): | ||
return ["local_read", "local_import"] | ||
|
||
|
||
@pytest.mark.parametrize("template_name", all_templates()) | ||
def test_execution_of_templates_with_local_context( | ||
template_name, template_dir, output_dir, flask_app, py_template_base_dir | ||
): | ||
with flask_app.app_context(): | ||
_run_checks( | ||
"job_id_{}".format(str(uuid.uuid4())[:6]), | ||
datetime.datetime.now(), | ||
template_name, | ||
template_name, | ||
output_dir, | ||
template_dir, | ||
{}, | ||
py_template_base_dir=py_template_base_dir, | ||
execute_at_origin=True, | ||
generate_pdf_output=False, | ||
) |