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

268 quickstart #276

Merged
merged 3 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 26 additions & 2 deletions docs/source/quickstart/index.rst
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
Copy link
Member

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?

Copy link
Member

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:

.. prompt:: bash

     pip install opendp

That requires the sphinx-prompt plugin, which I'm adding in #270. As part of that, I can come back and tweak this.

Copy link
Contributor Author

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.


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)
Copy link
Member

@Shoeboxam Shoeboxam Sep 10, 2021

Choose a reason for hiding this comment

The 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?

Copy link
Member

Choose a reason for hiding this comment

The 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!'
2 changes: 1 addition & 1 deletion docs/source/user/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ Once you've installed OpenDP, you can write your first program. In the example b
>>> from opendp.trans import make_identity
>>> from opendp.typing import SubstituteDistance

>>> identity = make_identity(M=SubstituteDistance, T=str)
>>> identity = make_identity(M=SubstituteDistance, TA=str)
>>> identity("Hello, world!")
'Hello, world!'