-
Notifications
You must be signed in to change notification settings - Fork 46
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
268 quickstart #276
268 quickstart #276
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,30 @@ | ||
Quickstart | ||
========== | ||
|
||
(In the future, this section will describe how to use the `OpenDP Library`_.) | ||
.. contents:: |toctitle| | ||
:local: | ||
|
||
.. _OpenDP Library: https://github.com/opendp/opendp | ||
Installation | ||
------------ | ||
|
||
The easiest way to get started with OpenDP is from Python. Use ``pip`` to install the `opendp <https://pypi.org/project/opendp/>`_ package from PyPI. | ||
|
||
.. code-block:: bash | ||
|
||
% pip install opendp | ||
|
||
This will make the OpenDP modules available to your local environment. | ||
|
||
Hello, OpenDP! | ||
-------------- | ||
|
||
Once you've installed OpenDP, you can write your first program. In the example below, we'll construct an identity ``Transformation``, then invoke it on a string. | ||
|
||
.. doctest:: | ||
|
||
>>> from opendp.trans import make_identity | ||
>>> from opendp.typing import SubstituteDistance | ||
|
||
>>> identity = make_identity(M=SubstituteDistance, TA=str) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The identity transformation seems like a simple transform, but the nature of the function is so unconstrained that it has many free variables. We also generally work with SymmetricDistance, so using SubstituteDistance in the quickstart may be confusing. The identity function also doesn't have much of a use. Perhaps we could switch to clamp? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also my cruft from an old example. We need a simple example for #270 also, so let's figure out something for that, then update this afterward. |
||
>>> identity("Hello, world!") | ||
'Hello, world!' |
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 percent reminds me of the
%pip
magic command from notebooks. But the percent is not necessary in a terminal. Why is the percent here?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.
That's an Andy-ism. Now that I know sphinx a little better, I think the right thing to do is this:
That requires the sphinx-prompt plugin, which I'm adding in #270. As part of that, I can come back and tweak this.
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 had the same thought but let it go (it was copied from the Getting Started page). I typically see
$
instead of%
for my shell prompt. That said, I like the idea of simply removing it.Even without the sphinx-prompt plugin (I haven't heard of it), we can still do
.. code-block:: bash
. There are examples on the Logistics page in the Dev Guide.