-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add an example on how to get started with the Python API #1474
Conversation
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.
Thanks for writing this! It might be worth considering linking to this from the main README
in this subdirectory.
I've left some general formatting and English prose suggestions below, but nothing too major.
This starts an HTTP server with default settings, which means that | ||
the server can be accessed at `http://localhost:8080/cryptol` |
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.
A general comment: this sentence should be indented three spaces so that it is at the same level of indentation as the "Run the Cryptol remote API server" sentence above. That way, GitHub will render this text with the same indentation as above. Currently, it looks like this:
Similar comments apply to all numbered bullet points below this one.
|
||
> cryptol-remote-api http /cryptol | ||
|
||
This starts an HTTP server with default settings, which means that |
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.
This starts an HTTP server with default settings, which means that | |
This starts an HTTP server with the default settings, which means that |
|
||
> poetry run python | ||
|
||
This runs a python shell within an environment setup by |
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.
This runs a python shell within an environment setup by | |
This runs a Python shell within an environment set up by |
|
||
The URL is the one where we started the server in step 1. The second parameter resets | ||
the state of the server. See `help("cryptol.connect")` for other options. | ||
At this point `cry` is an object that we can use to interact with Cryptol. |
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.
At this point `cry` is an object that we can use to interact with Cryptol. | |
At this point, `cry` is an object that we can use to interact with Cryptol. |
|
||
>>> it = cry.evaluate_expression("1+1") | ||
|
||
This command sends the expression `1 + 1` to the server and the value `it` contains |
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.
This command sends the expression `1 + 1` to the server and the value `it` contains | |
This command sends the expression `1 + 1` to the server, and the value `it` contains |
Just an example of how to get started with the Python API