Skip to main content

Private Python

Overview

Private Python is a specialised version of Python created by Oblivious that offers a user-friendly and accessible coding environment. It is designed specifically for working with differentially private data, ensuring privacy protections are embedded at every step.

Private Python users can confidently write secure, type-safe, and efficient code for data analysis while upholding the highest privacy and security standards. It ensures reliability, predictability, and ease of maintenance by promoting pure functions and enforcing import restrictions to prevent unintended behaviours or vulnerabilities.

Private Python Principles

Private Python was developed based on three principles to provide a reliable and secure development experience.

By following these principles, Private Python provides at-the-end code that is more predictable, easier to maintain, and less prone to unintended side effects.

How Does It Work?

When operating a Jupyter notebook, Private Python runs in a secure remote Jupyter kernel segregated from the local so that users never get direct access to sensitive data directly, but only through the approved private Python interface.

Users can interact with it by adding the Jupyter magic command %%ag at the start of any code in their local Jupyter notebook.

For example, if a user wants to set a variable within the Private Python, they can do it as follows:

%%ag
a = 10

The variable a is now declared in the Private Python but not in the local environment. Users can effectively export this variable to be used in the local notebook.

%%ag
export(a, 'variable_a')

The local notebook now has variable_a declared with the same value as the variable a of the Private Python.

Tip

Only a predefined set of imports and their methods are permitted in Private Python and are meticulously designed to produce differentially private outcomes. To learn more about how to use Private Python and Jupyter notebooks, please see the Working with AGENT page.