-
Notifications
You must be signed in to change notification settings - Fork 8
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
MyPy + Jupyter Notebooks with Testing + Handle Txn Params #17
Conversation
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
…nally erroring cell
7 tasks
tzaffi
commented
May 17, 2022
tzaffi
commented
May 17, 2022
tzaffi
commented
May 17, 2022
Fix typos observed during PR review
michaeldiamant
approved these changes
May 18, 2022
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.
@tzaffi Great work here to improve our correctness confidence! ☕
Add provenance note for lsig_factorizer_game_1_5_7.teal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
mypy
Enabling
mypy
by incorporating #16 and making other similar changes to new code. This makes it possible for downstream dependencies that incorporate graviton to be mypy-compliant as well.Allow handling of Transaction Params in Logic Sig and App Dry-Runs
Previously, graviton was using the old Python SDK
DryRunHelper
which hard-coded the transaction information associated with a dry run. This made it impossible to write logic sigs that vallidated the transaction information in their program. This PR fixes this situation. In fact, the image below was only possible to create thanks to this new addition.Jupyter Notebooks
Introducing
notebooks/quadratic_factoring_game.ipynb
which shows how to leverage graviton for creating graphs in jupyter such as below. The notebook also runs during integration testing.Summary of Important Changes
.github/workflows/build.yml
+Makefile
:mypy
tolint
graviton/
:README.md
- move the top-level tutorial hereabi_strategy.py
- includesABIStrategy
which lets you generate random ABI instances as well as runningmutate_for_dryrun()
which emulates the logic in theroundtrip
teal programs and allows for verification that abi decoding/manipulation/encoding all work as expectedblackbox.py
:mypy
dryrun.py
:mypy
deprecated_dry_run.py
: new module that contains functionality mostly used by the now deprecatedDryRunTestCaseMixin
deprecated_dryrun_mixin.py
: where the now deprecatedDryRunTestCaseMixin
is defineddryrun.py
:mypy
passpprint()
now returns a string, in addition to printinginvariant.py
: makemypy
passmodels.py
: new module that contains lightweight models such as theApp
andLSig
dataclassespy.typed
- needed formypy
mypy.ini
: needed by mypynotebooks
: new directory for Jupyter notebooks. It contains:IMAGES.md
: a static file that shows examples of 3D graphs of dry-runsnotebooks_test.ipynb
: explains how to test notebooks withpytest
and includes an intentionally erroring cell with a modification of the notebook's configuration to allow it to be run in CI without failingquadratic_factoring_game.ipynb
: Notebook that demonstrates logic sig factoring gamesetup.py
: new Jupyter notebooks requirements, and declaration for receiving projects that this package is typedtests
integration/
abi_test.py
: adding the roundtrip test that iterates over teal files intests/teal/roundtrip
and based on the filename encodes a random ABI instance and runs the roundtrip teal program on it via dry-run. In particular includes "round trips" test preparer that:f
and return(x, f(x), f(f(x)))
algod_test.py
: separate out the test thatalgod
is alive and well into a seperate integration test, for easier debuggingblackbox_test.py
: small refactoring, mostly formypy
dryrun_mixin_docs_test.py
: refactoring mostly due to deprecationslsig_test.py
: test that was described during an April Demo and whichteal/
directory - many teal programs created via PyTEAL which are used for dry-run testsroundtrip/
- roundtrip teal programs used byabi_test.py