Skip to content

Commit

Permalink
docs: set up MkDocs with Material theme and GitHub Actions deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
dirvine committed Dec 29, 2024
1 parent e3efc79 commit d02abbc
Show file tree
Hide file tree
Showing 5 changed files with 469 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Deploy Documentation
on:
push:
branches:
- main
- data_further_refactor
pull_request:
branches:
- main

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs-material mkdocstrings mkdocstrings-python mkdocs-git-revision-date-localized-plugin
- name: Deploy Documentation
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
mkdocs gh-deploy --force
140 changes: 140 additions & 0 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Installation Guide

This guide will help you install the Autonomi client for your preferred programming language.

## Prerequisites

- Node.js 16+ (for Node.js client)
- Python 3.8+ (for Python client)
- Rust toolchain (for Rust client)
- Docker (for local network)

## Node.js Installation

```bash
# Using npm
npm install @autonomi/client

# Using yarn
yarn add @autonomi/client

# Using pnpm
pnpm add @autonomi/client
```

### TypeScript Configuration

Add these settings to your `tsconfig.json`:

```json
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}
}
```

## Python Installation

```bash
# Using pip
pip install autonomi-client

# Using poetry
poetry add autonomi-client
```

### Virtual Environment (recommended)

```bash
# Create virtual environment
python -m venv venv

# Activate virtual environment
source venv/bin/activate # Unix
.\venv\Scripts\activate # Windows

# Install package
pip install autonomi-client
```

## Rust Installation

Add to your `Cargo.toml`:

```toml
[dependencies]
autonomi = "0.1.0"
```

Or using cargo-edit:

```bash
cargo add autonomi
```

## Docker Setup (for Local Network)

1. Install Docker:
- [Docker Desktop for Mac](https://docs.docker.com/desktop/mac/install/)
- [Docker Desktop for Windows](https://docs.docker.com/desktop/windows/install/)
- [Docker Engine for Linux](https://docs.docker.com/engine/install/)

2. Pull the Autonomi image:

```bash
docker pull autonomi/node:latest
```

## Verifying Installation

### Node.js

```typescript
import { Client } from '@autonomi/client';

async function verify() {
const client = new Client();
await client.connect();
console.log('Connected successfully!');
}

verify().catch(console.error);
```

### Python

```python
import asyncio
from autonomi import Client

async def verify():
client = Client()
await client.connect()
print('Connected successfully!')

asyncio.run(verify())
```

### Rust

```rust
use autonomi::Client;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new()?;
println!("Connected successfully!");
Ok(())
}
```

## Next Steps

- [Quick Start Guide](quickstart.md)
- [Local Network Setup](../guides/local_network.md)
- [API Reference](../api/nodejs/README.md)
162 changes: 162 additions & 0 deletions docs/getting-started/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Quick Start Guide

This guide will help you get started with Autonomi quickly. We'll create a simple application that stores and retrieves data using linked lists.

## Choose Your Language

=== "Node.js"
```typescript
import { Client, LinkedList } from '@autonomi/client';

async function main() {
// Initialize client
const client = new Client();
await client.connect();
// Create a linked list
const list = new LinkedList();
list.append("Hello");
list.append("World");
// Store the list
const address = await client.linkedListPut(list);
console.log(`List stored at: ${address}`);
// Retrieve the list
const retrieved = await client.linkedListGet(address);
console.log(retrieved.toString()); // "Hello World"
}

main().catch(console.error);
```

=== "Python"
```python
import asyncio
from autonomi import Client, LinkedList

async def main():
# Initialize client
client = Client()
await client.connect()
# Create a linked list
list_obj = LinkedList()
list_obj.append("Hello")
list_obj.append("World")
# Store the list
address = await client.linked_list_put(list_obj)
print(f"List stored at: {address}")
# Retrieve the list
retrieved = await client.linked_list_get(address)
print(str(retrieved)) # "Hello World"

asyncio.run(main())
```

=== "Rust"
```rust
use autonomi::{Client, LinkedList, Result};

fn main() -> Result<()> {
// Initialize client
let client = Client::new()?;
// Create a linked list
let mut list = LinkedList::new();
list.append("Hello");
list.append("World");
// Store the list
let address = client.linked_list_put(&list)?;
println!("List stored at: {}", address);
// Retrieve the list
let retrieved = client.linked_list_get(&address)?;
println!("{}", retrieved);
Ok(())
}
```

## Working with Pointers

Pointers allow you to create references to data in the network:

=== "Node.js"
```typescript
import { Client, Pointer } from '@autonomi/client';

async function main() {
const client = new Client();
await client.connect();
// Create a pointer
const pointer = new Pointer();
pointer.setTarget("example-target");
// Store the pointer
const address = await client.pointerPut(pointer);
console.log(`Pointer stored at: ${address}`);
// Retrieve the pointer
const retrieved = await client.pointerGet(address);
console.log(`Target: ${retrieved.getTarget()}`);
}
```

=== "Python"
```python
import asyncio
from autonomi import Client, Pointer

async def main():
client = Client()
await client.connect()
# Create a pointer
pointer = Pointer()
pointer.set_target("example-target")
# Store the pointer
address = await client.pointer_put(pointer)
print(f"Pointer stored at: {address}")
# Retrieve the pointer
retrieved = await client.pointer_get(address)
print(f"Target: {retrieved.get_target()}")

asyncio.run(main())
```

=== "Rust"
```rust
use autonomi::{Client, Pointer, Result};

fn main() -> Result<()> {
let client = Client::new()?;
// Create a pointer
let mut pointer = Pointer::new();
pointer.set_target("example-target");
// Store the pointer
let address = client.pointer_put(&pointer)?;
println!("Pointer stored at: {}", address);
// Retrieve the pointer
let retrieved = client.pointer_get(&address)?;
println!("Target: {}", retrieved.target());
Ok(())
}
```

## Next Steps

- [Local Network Setup](../guides/local_network.md)
- [EVM Integration](../guides/evm_integration.md)
- [Testing Guide](../guides/testing_guide.md)
- [API Reference](../api/nodejs/README.md)
Loading

0 comments on commit d02abbc

Please sign in to comment.