Skip to content

Commit

Permalink
Merge pull request #103 from NillionNetwork/chore/python-client
Browse files Browse the repository at this point in the history
Chore: Python client instructions and onBrokenAnchor
  • Loading branch information
oceans404 authored Oct 3, 2024
2 parents fc5ffb9 + 3088218 commit 4182986
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 76 deletions.
2 changes: 1 addition & 1 deletion docs/guide-testnet-connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import SupportedWallets from './\_testnet_supported_wallets.mdx';

# Creating a Nillion Wallet

Create a Nillion wallet to connect to the [Nillion Testnet](/network#nillion-testnet-coordination-layer) and access your assets.
Create a Nillion wallet to connect to the [Nillion Testnet](/network) and access your assets.

## Supported Wallets

Expand Down
2 changes: 1 addition & 1 deletion docs/js-quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ You've successfully build your first blind app by writing a Nada program, storin

- reading about [Nillion concepts](/concepts) and the [Nada Language](nada-lang)
- learning how to interact with and manage programs, secrets, and permissions on the Nillion Network with [Nillion Client](/js-client)
- challenging yourself to create a page that solves the [Millionaires Problem](/multi-party-computation#classic-scenario-the-millionaires-problem)
- challenging yourself to create a page that solves the [Millionaires Problem](/multi-party-computation#applied-mpc)

:::tip

Expand Down
71 changes: 0 additions & 71 deletions docs/python-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,75 +4,4 @@ import TabItem from '@theme/TabItem';

# Python Client

[py-nillion-client](https://pypi.org/project/py-nillion-client/) is a Python client for building on top of the Nillion Network. It can be used to manage Nada programs, store and retrieve secrets, and run computations.

## Installation

Install the [py-nillion-client](https://pypi.org/project/py-nillion-client/) PyPi package in an existing Python application

```bash
pip install --upgrade py-nillion-client
```

## Usage

### Import Python Client

```python3
import py_nillion_client as nillion
```

### Initialize a client

Initialize an instance of the NillionClient connected to the Nillion Network using [helpers](https://github.com/NillionNetwork/nillion-python-starter/tree/main/helpers) from [nillion-python-starter](https://github.com/NillionNetwork/nillion-python-starter)

<Tabs>
<TabItem value="main" label="main.py" default>
```python
import os
from dotenv import load_dotenv # pip install python-dotenv
from helpers.nillion_client_helper import create_nillion_client
from helpers.nillion_keypath_helper import getUserKeyFromFile, getNodeKeyFromFile

# Loads environment variables from the .env file
load_dotenv()

def main():
userkey = getUserKeyFromFile(os.getenv("NILLION_USERKEY_PATH_PARTY_1"))
nodekey = getNodeKeyFromFile(os.getenv("NILLION_NODEKEY_PATH_PARTY_1"))
# Initialize Nillion Client instance
client = create_nillion_client(userkey, nodekey)
# Print the user id
print(client.user_id)

if __name__ == "__main__":
main()
```
</TabItem>

<TabItem value="client" label="nillion_client_helper.py">
```python reference showGithubLink
https://github.com/NillionNetwork/nillion-python-starter/blob/main/helpers/nillion_client_helper.py
```
</TabItem>

<TabItem value="keypath" label="nillion_keypath_helper.py">
```python reference showGithubLink
https://github.com/NillionNetwork/nillion-python-starter/blob/main/helpers/nillion_keypath_helper.py
```
</TabItem>

<TabItem value="env" label=".env">
```python reference showGithubLink
https://github.com/NillionNetwork/nillion-python-starter/blob/main/.env.sample
```
</TabItem>
<TabItem value="bootstrap" label="bootstrap_script">
```python reference showGithubLink
https://github.com/NillionNetwork/nillion-python-starter/blob/main/bootstrap-local-environment.sh
```
</TabItem>
</Tabs>
## Resources

<DocCardList/>
2 changes: 1 addition & 1 deletion docs/quickstart-testnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ https://github.com/NillionNetwork/cra-nillion/blob/main/vercel.json

- reading about [Nillion concepts](/concepts) and the [Nada Language](nada-lang)
- learning how to interact with and manage programs, secrets, and permissions on the Nillion Network with [Nillion Client](/js-client)
- challenging yourself to create a page that solves the [Millionaires Problem](/multi-party-computation#classic-scenario-the-millionaires-problem)
- challenging yourself to create a page that solves the [Millionaires Problem](/multi-party-computation#applied-mpc)
4 changes: 2 additions & 2 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ const config = {
trailingSlash: false,

onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',

onBrokenMarkdownLinks: 'throw',
onBrokenAnchors: 'throw',
// Even if you don't use internationalization, you can use this field to set
// useful metadata like html lang. For example, if your site is Chinese, you
// may want to replace "en" with "zh-Hans".
Expand Down

0 comments on commit 4182986

Please sign in to comment.