Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
.PHONY: all clean install dev venv deps help nilup activate devnet example check_venv check_nillion

VENV := venv
PYTHON := $(VENV)/bin/python
PIP := $(VENV)/bin/pip
CONFIG_DIR := $(HOME)/.config/nillion
SHELL := /bin/bash
QUICK_START_DIR := $(shell pwd)/quickstart_complete/nada_quickstart_programs
SEPARATOR := "=================================================="

ifeq ($(OS),Windows_NT)
VENV_ACTIVATE := $(VENV)/Scripts/activate
else
VENV_ACTIVATE := $(VENV)/bin/activate
endif

.DEFAULT_GOAL := help

help:
@echo $(SEPARATOR)
@echo " Usage:"
@echo
@echo " make nilup Install nilup and Nillion SDK"
@echo " make install Install all dependencies and setup environment (requires nilup)"
@echo " make dev Setup development environment"
@echo " make clean Remove virtual environment and cached files"
@echo " make deps Install/update dependencies only"
@echo " make activate Activate the virtual environment"
@echo " make devnet Start the Nillion devnet"
@echo " make example Build the quickstart example"
@echo " make help Show this help message"
@echo $(SEPARATOR)

check_venv:
@if [ -z "$$VIRTUAL_ENV" ]; then \
echo $(SEPARATOR); \
echo " Error: Virtual environment is not activated"; \
echo; \
echo " Please run 'make activate' and follow the instructions"; \
echo $(SEPARATOR); \
exit 1; \
fi

check_nillion:
@if ! command -v nillion > /dev/null; then \
echo $(SEPARATOR); \
echo " Error: nillion command not found"; \
echo; \
echo " Please run 'make install' first to set up the environment"; \
echo $(SEPARATOR); \
exit 1; \
fi

activate:
@if [ ! -d "$(VENV)" ]; then \
echo $(SEPARATOR); \
echo " Error: Virtual environment not found"; \
echo; \
echo " Please run 'make install' first to set up the environment"; \
echo $(SEPARATOR); \
exit 1; \
fi
@echo $(SEPARATOR)
@echo " To activate the virtual environment, run:"
@echo
@echo " source $(VENV_ACTIVATE)"
@echo $(SEPARATOR)

nilup:
@echo $(SEPARATOR)
@if ! command -v nilup > /dev/null; then \
echo " Installing nilup..."; \
curl -s https://nilup.nilogy.xyz/install.sh | bash; \
echo; \
echo " Please close and reopen your terminal, then run 'make install'"; \
echo $(SEPARATOR); \
exit 1; \
fi
@echo " nilup is already installed"
@echo $(SEPARATOR)


$(VENV):
virtualenv $(VENV)
$(PIP) install --upgrade pip

deps: $(VENV)
$(PIP) install -r requirements.txt

$(CONFIG_DIR):
mkdir -p $(CONFIG_DIR)

install: $(VENV) deps $(CONFIG_DIR)
@if ! command -v nilup > /dev/null; then \
echo $(SEPARATOR); \
echo " Error: nilup not found. Please run 'make nilup' first"; \
echo $(SEPARATOR); \
exit 1; \
fi
@if ! command -v nillion > /dev/null; then \
nilup install latest; \
nilup use latest; \
fi

devnet: check_venv check_nillion
nillion-devnet

dev: install
@echo $(SEPARATOR)
@echo " Development environment ready"
@echo
@echo " Run 'make activate' to activate the virtual environment"
@echo " Run 'make devnet' in a separate terminal to start the devnet"
@echo $(SEPARATOR)

example: check_venv check_nillion
@if [ ! -d "$(QUICK_START_DIR)" ]; then \
echo $(SEPARATOR); \
echo " Error: Quickstart directory not found at $(QUICK_START_DIR)"; \
echo; \
echo " Please ensure you have the correct project structure"; \
echo $(SEPARATOR); \
exit 1; \
fi
cd $(QUICK_START_DIR) && nada build

clean:
rm -rf $(VENV)
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@ Welcome to the start of your Nillion developer journey.

This repo corresponds to the Nillion Python quickstart. To get started with Nillion head over to the [Python QuickStart docs](https://docs.nillion.com/python-quickstart) and follow the quickstart guide.

## Quick Setup

First, make sure that you have `virtualenv` and `make` installed. if not, installed them for your OS.

And then:
```bash
# Install nilup (Nillion SDK manager)
make nilup

# Install dependencies and setup development environment
make dev
```
After setup is complete, follow the displayed instructions to start developing with Nillion.

To build the quickstart example, run:
```bash
make example
```

## Available Commands
To see all available commands, run
```bash
make help
```

## Manual Setup

If you prefer to set up manually, head over to the [Python QuickStart docs](https://docs.nillion.com/python-quickstart) and follow the instructions.


## Examples

For more python examples, check out https://github.com/NillionNetwork/python-examples which contains the following:
- core_concept_multi_party_compute
- core_concept_permissions
Expand Down