+
+
+
The plugin configuration above will be rendered as:
-
+
-
-
-
-
+
diff --git a/docs/_static/tutorial.zip b/docs/_static/tutorial.zip
index 286505c6b..3b956fd2b 100644
Binary files a/docs/_static/tutorial.zip and b/docs/_static/tutorial.zip differ
diff --git a/docs/changelog.md b/docs/changelog.md
index c1b70f36e..5a71ab65f 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -3,6 +3,7 @@
**v2.0.6:**
* Fixed requirements not found error for R notebooks in Otter Assign
+* Removed use of `re` in overriding `Notebook` test directory override in `otter.execute.execute_notebook` by adding `otter.Notebook._test_dir_override`
**v2.0.5:**
diff --git a/docs/tutorial/assign/assign-demo.ipynb b/docs/tutorial/assign/assign-demo.ipynb
index 76c6b5809..ac2e40433 100644
--- a/docs/tutorial/assign/assign-demo.ipynb
+++ b/docs/tutorial/assign/assign-demo.ipynb
@@ -7,7 +7,8 @@
"```\n",
"BEGIN ASSIGNMENT\n",
"solutions_pdf: true\n",
- "instructions: \"These are some submission instructions.\"\n",
+ "export_cell:\n",
+ " instructions: \"These are some submission instructions.\"\n",
"generate: true\n",
"```"
]
@@ -449,7 +450,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.6.5"
+ "version": "3.7.3"
},
"varInspector": {
"cols": {
diff --git a/otter/check/notebook.py b/otter/check/notebook.py
index 712375ddc..c3beebc2f 100644
--- a/otter/check/notebook.py
+++ b/otter/check/notebook.py
@@ -64,12 +64,18 @@ class Notebook:
test_dir (``str``, optional): path to tests directory
"""
+ # overrides test_dir arg in __init__, used for changing tests dir during grading
+ _tests_dir_override = None
+
def __init__(self, nb_path=None, test_dir="./tests"):
try:
global _API_KEY, _SHELVE
# assert os.path.isdir(test_dir), "{} is not a directory".format(test_dir)
- self._path = test_dir
+ if type(self)._tests_dir_override is not None:
+ self._path = type(self)._tests_dir_override
+ else:
+ self._path = test_dir
self._service_enabled = False
self._notebook = nb_path
diff --git a/otter/execute/execute_notebook.py b/otter/execute/execute_notebook.py
index da378ab31..f58d45b21 100644
--- a/otter/execute/execute_notebook.py
+++ b/otter/execute/execute_notebook.py
@@ -3,7 +3,7 @@
"""
import os
-import re
+# import re
import ast
import copy
@@ -80,6 +80,7 @@ def execute_notebook(nb, secret='secret', initial_env=None, ignore_errors=False,
# add dummy Notebook class so that we can collect results w/out altering how the CheckCallWrapper
# needs to function
from ..check.notebook import Notebook
+ Notebook._tests_dir_override = test_dir if test_dir is not None else './tests'
notebook_class_name = f"Notebook_{secret}"
global_env[notebook_class_name] = Notebook
@@ -121,19 +122,19 @@ def execute_notebook(nb, secret='secret', initial_env=None, ignore_errors=False,
# Filter out ipython magic commands
# Filter out interact widget
if not line.startswith('%'):
- if "interact(" not in line and not re.search(r"otter\.Notebook\(.*?\)", line):
- code_lines.append(line)
- if source_is_str_bool:
- code_lines.append('\n')
- elif re.search(r"otter\.Notebook\(.*?\)", line):
- # TODO: move this check into CheckCallWrapper
- # if gradescope:
- # line = re.sub(r"otter\.Notebook\(.*?\)", "otter.Notebook(\"/autograder/submission/tests\")", line)
- # el
- line = re.sub(r"otter\.Notebook\(.*?\)", f"otter.Notebook(\"{test_dir}\")", line)
+ if "interact(" not in line: # and not re.search(r"otter\.Notebook\(.*?\)", line):
code_lines.append(line)
if source_is_str_bool:
code_lines.append('\n')
+ # elif re.search(r"otter\.Notebook\(.*?\)", line):
+ # # TODO: move this check into CheckCallWrapper
+ # # if gradescope:
+ # # line = re.sub(r"otter\.Notebook\(.*?\)", "otter.Notebook(\"/autograder/submission/tests\")", line)
+ # # el
+ # line = re.sub(r"otter\.Notebook\(.*?\)", f"otter.Notebook(\"{test_dir}\")", line)
+ # code_lines.append(line)
+ # if source_is_str_bool:
+ # code_lines.append('\n')
if seed is not None:
cell_source = "np.random.seed({})\nrandom.seed({})\n".format(seed, seed) + isp.transform_cell(''.join(code_lines))
else:
@@ -180,5 +181,8 @@ def execute_notebook(nb, secret='secret', initial_env=None, ignore_errors=False,
except:
if not ignore_errors:
raise
+
+ # reset tests dir
+ Notebook._tests_dir_override = None
return global_env
diff --git a/otter/generate/templates/python/requirements.txt b/otter/generate/templates/python/requirements.txt
index 4be728ddb..67606ded5 100644
--- a/otter/generate/templates/python/requirements.txt
+++ b/otter/generate/templates/python/requirements.txt
@@ -13,6 +13,6 @@ nbformat
dill
jupytext
numpy
-otter-grader==2.0.5
+git+https://github.com/ucbds-infra/otter-grader.git@1dd48ebfcc66e24f5d443f9ad94a422dad29d2ec
{% endif %}{% if other_requirements %}
{{ other_requirements }}{% endif %}
\ No newline at end of file
diff --git a/otter/generate/templates/r/environment.yml b/otter/generate/templates/r/environment.yml
index 0949db280..5916f34c4 100644
--- a/otter/generate/templates/r/environment.yml
+++ b/otter/generate/templates/r/environment.yml
@@ -8,5 +8,6 @@ dependencies:
- r-base
- r-essentials
- r-devtools
+ - libgit2
- pip:
- -r file:requirements.txt
diff --git a/otter/generate/templates/r/requirements.txt b/otter/generate/templates/r/requirements.txt
index 3a17f921f..be7ce18e6 100644
--- a/otter/generate/templates/r/requirements.txt
+++ b/otter/generate/templates/r/requirements.txt
@@ -14,4 +14,4 @@ dill
rpy2
jupytext
numpy
-otter-grader==2.0.5
+git+https://github.com/ucbds-infra/otter-grader.git@1dd48ebfcc66e24f5d443f9ad94a422dad29d2ec
diff --git a/otter/generate/templates/r/setup.sh b/otter/generate/templates/r/setup.sh
index 1203ee2c2..caaeb0739 100644
--- a/otter/generate/templates/r/setup.sh
+++ b/otter/generate/templates/r/setup.sh
@@ -15,9 +15,14 @@ apt-get install -y /tmp/wkhtmltopdf.deb
# update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
+# try to set up R
apt-get clean
+apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
+add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
+
+add-apt-repository ppa:cran/libgit2
apt-get update
-apt-get install -y build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev libcurl4-openssl-dev libgit2-dev
+apt-get install -y build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev libgit2-dev
# install conda
wget -nv -O {{ autograder_dir }}/source/miniconda_install.sh "{{ miniconda_install_url }}"
diff --git a/test/test-assign/gs-autograder-correct/requirements.txt b/test/test-assign/gs-autograder-correct/requirements.txt
index 3bba508de..b93ce8e91 100644
--- a/test/test-assign/gs-autograder-correct/requirements.txt
+++ b/test/test-assign/gs-autograder-correct/requirements.txt
@@ -13,4 +13,4 @@ nbformat
dill
jupytext
numpy
-otter-grader==2.0.5
+git+https://github.com/ucbds-infra/otter-grader.git@1dd48ebfcc66e24f5d443f9ad94a422dad29d2ec
diff --git a/test/test-assign/rmd-autograder-correct/environment.yml b/test/test-assign/rmd-autograder-correct/environment.yml
index c4aa84656..8b89e043e 100644
--- a/test/test-assign/rmd-autograder-correct/environment.yml
+++ b/test/test-assign/rmd-autograder-correct/environment.yml
@@ -8,5 +8,6 @@ dependencies:
- r-base
- r-essentials
- r-devtools
+ - libgit2
- pip:
- -r file:requirements.txt
\ No newline at end of file
diff --git a/test/test-assign/rmd-autograder-correct/requirements.txt b/test/test-assign/rmd-autograder-correct/requirements.txt
index d1ba950e6..6fdad6b87 100644
--- a/test/test-assign/rmd-autograder-correct/requirements.txt
+++ b/test/test-assign/rmd-autograder-correct/requirements.txt
@@ -14,4 +14,4 @@ dill
rpy2
jupytext
numpy
-otter-grader==2.0.5
\ No newline at end of file
+git+https://github.com/ucbds-infra/otter-grader.git@1dd48ebfcc66e24f5d443f9ad94a422dad29d2ec
\ No newline at end of file
diff --git a/test/test-assign/rmd-autograder-correct/setup.sh b/test/test-assign/rmd-autograder-correct/setup.sh
index c1000f980..2df8b4d8a 100644
--- a/test/test-assign/rmd-autograder-correct/setup.sh
+++ b/test/test-assign/rmd-autograder-correct/setup.sh
@@ -15,9 +15,14 @@ apt-get install -y /tmp/wkhtmltopdf.deb
# update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1
+# try to set up R
apt-get clean
+apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
+add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/'
+
+add-apt-repository ppa:cran/libgit2
apt-get update
-apt-get install -y build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev libcurl4-openssl-dev libgit2-dev
+apt-get install -y build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev libgit2-dev
# install conda
wget -nv -O /autograder/source/miniconda_install.sh "https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-Linux-x86_64.sh"
diff --git a/test/test-run/autograder/source/requirements.txt b/test/test-run/autograder/source/requirements.txt
index 47089a09f..331b91c5b 100644
--- a/test/test-run/autograder/source/requirements.txt
+++ b/test/test-run/autograder/source/requirements.txt
@@ -13,6 +13,6 @@ nbformat
dill
jupytext
numpy
-otter-grader==2.0.5
+git+https://github.com/ucbds-infra/otter-grader.git@1dd48ebfcc66e24f5d443f9ad94a422dad29d2ec
tqdm
diff --git a/test/test_generate/test-autograder/autograder-correct/requirements.txt b/test/test_generate/test-autograder/autograder-correct/requirements.txt
index 47089a09f..331b91c5b 100644
--- a/test/test_generate/test-autograder/autograder-correct/requirements.txt
+++ b/test/test_generate/test-autograder/autograder-correct/requirements.txt
@@ -13,6 +13,6 @@ nbformat
dill
jupytext
numpy
-otter-grader==2.0.5
+git+https://github.com/ucbds-infra/otter-grader.git@1dd48ebfcc66e24f5d443f9ad94a422dad29d2ec
tqdm