-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow notebook env #11
Open
olivergiles
wants to merge
7
commits into
master
Choose a base branch
from
ogiles1999-allow-notebook-env
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a4546dd
add dill to requirements
olivergiles 065ca50
update to use dill
olivergiles 3a7a7b2
updated setup.py
olivergiles 409eff2
update to save notebook env
olivergiles 76e5207
Updated readme to explain new testcase
olivergiles 2187788
update test workflow to install requirements
olivergiles 62663ac
Update setup.py
olivergiles File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
|
||
dill |
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 |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
with open("README.md", "r", encoding="utf-8") as fh: | ||
long_description = fh.read() | ||
|
||
with open('requirements.txt') as f: | ||
required = [c.strip() for c in f.readlines()] | ||
|
||
setup(name='nbresult', | ||
version='0.0.9', | ||
description='Extract results from Jupyter notebooks', | ||
|
@@ -14,5 +17,6 @@ | |
author='Kevin Robert', | ||
author_email='[email protected]', | ||
packages=find_packages(include=["nbresult"]), | ||
install_requires=required, | ||
include_package_data=True | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rather than introducing a second use case for the package, why not systematically use
dill
so that lambdas are supported and the content writers do not need to wonder what they will be saving (which in time might be a source of bugs) in order to deal with that additionalnotebook_env
parameter ?if we keep a single use case, then the code only needs to deal with legacy content :
save :
load :
... then we can amend the package in the future when no content uses pickle anymore
WDYT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dill can load any file created with pickle so I don't think we need the fallback. Are you suggesting we abstract away the saving of the notebook env?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I miss read the
dump_session
function 🙌it is unclear to me why we need to save the state of the student
__main__
module : should not the content of the tested functions be independent from the state ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do this
you could not then pass this function alone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see the issue (I expect the code loading the dill files to deal with the package imports)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is specific to how pytest operates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I get the issue with the numpy import when using the ChallengeResult class. Even if I manually import numpy the
np.ones
in the lambda fails to find numpystackoverflow also points to
dump_session
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ogiles1999 I found the ugliest hack to have pytest work with the numpy reference in the lambda 🙈
test_solvers.py :
Test Dill.ipynb :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha that is very hacky 😓
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One part of me is not proud 😁