Skip to content
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

Merged
merged 2 commits into from
Nov 28, 2022
Merged

Conversation

yav
Copy link
Member

@yav yav commented Nov 23, 2022

Just an example of how to get started with the Python API

Copy link
Contributor

@RyanGlScott RyanGlScott left a 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.

Comment on lines 5 to 6
This starts an HTTP server with default settings, which means that
the server can be accessed at `http://localhost:8080/cryptol`
Copy link
Contributor

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:

cryptol

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

@yav yav merged commit bf17c70 into master Nov 28, 2022
@RyanGlScott RyanGlScott deleted the python-example branch March 22, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants