Skip to main content

A CLI tool to update velxio projects from local diagram.json and sketch.ino files

Project description

velxio-updater

A CLI tool to update velxio projects from local diagram.json and sketch.ino files.

Features

  • Automatically reads diagram.json and sketch.ino from your project directory
  • Converts Wokwi diagram format to velxio format
  • Uploads updates to velxio API with a single command
  • Configuration via environment variables or command-line arguments

Installation

From PyPI (recommended once published)

pip install velxio-updater

From source

git clone https://github.com/Samge0/velxio-updater.git
cd velxio-updater
pip install -e .

Configuration

Method 1: Environment Variables (Recommended)

Set the following environment variables:

Linux/macOS:

export VELXIO_BASE_URL="http://localhost:3080"
export VELXIO_PROJECT_ID="182883dc-xxxx-xxxx-xxxx-6143cbed1b92"
export VELXIO_ACCESS_TOKEN="your-access-token-here"

Windows (PowerShell):

$env:VELXIO_BASE_URL="http://localhost:3080"
$env:VELXIO_PROJECT_ID="182883dc-xxxx-xxxx-xxxx-6143cbed1b92"
$env:VELXIO_ACCESS_TOKEN="your-access-token-here"

Windows (Command Prompt):

set VELXIO_BASE_URL=http://localhost:3080
set VELXIO_PROJECT_ID=182883dc-xxxx-xxxx-xxxx-6143cbed1b92
set VELXIO_ACCESS_TOKEN=your-access-token-here

Method 2: .env File

Create a .env file in your project directory:

# .env file
VELXIO_BASE_URL=http://localhost:3080
VELXIO_PROJECT_ID=182883dc-xxxx-xxxx-xxxx-6143cbed1b92
VELXIO_ACCESS_TOKEN=your-access-token-here

The .env file will be automatically loaded when you run vup.

Note: Make sure to add .env to your .gitignore file to avoid committing sensitive credentials!

Method 3: Command-line Arguments

You can also pass configuration directly via command-line arguments:

vup --base-url http://localhost:3080 \
    --project-id 182883dc-xxxx-xxxx-xxxx-6143cbed1b92 \
    --access-token your-access-token-here

Usage

Basic Usage

Navigate to your project directory (containing diagram.json and sketch.ino) and run:

vup

Verbose Output

To see detailed progress information:

vup -v

Custom File Paths

If your files are not in the current directory:

vup --diagram /path/to/diagram.json --sketch /path/to/sketch.ino

Dry Run

Validate configuration without actually updating:

vup --dry-run

Using with Command-line Override

You can override environment variables with command-line arguments:

vup --base-url http://localhost:33080 --project-id different-project-id

Getting Your Credentials

Base URL

The base URL of your velxio server, e.g., http://localhost:3080

Project ID

The UUID of your velxio project. You can find it in the project URL:

http://localhost:3080/project/182883dc-xxxx-xxxx-xxxx-6143cbed1b92

Access Token

The JWT access token for authentication. You can find it in your browser's cookies after logging into velxio:

  1. Open your velxio instance in a browser
  2. Open Developer Tools (F12)
  3. Go to Application/Storage > Cookies
  4. Find the access_token cookie

Project Structure

Your project directory should contain:

my-project/
├── diagram.json    # Circuit diagram in Wokwi format
└── sketch.ino      # Arduino sketch code

Examples

Example 1: Update from project directory

cd ~/projects/my-arduino-project
vup

Example 2: Update with verbose output

vup -v
# Output:
# Reading files from: /home/user/projects/my-arduino-project
# Board Type: arduino-uno
# Group ID: group-arduino-uno
# Updating project: 182883dc-xxxx-xxxx-xxxx-6143cbed1b92
# Sending PUT request to: http://localhost:3080/api/projects/182883dc-xxxx-xxxx-xxxx-6143cbed1b92
#
# Update successful!
# Status code: 200
# Project URL: http://localhost:3080/project/182883dc-xxxx-xxxx-xxxx-6143cbed1b92

Example 3: Different configurations for different projects

You can use .env files in different project directories:

# Project A
cd ~/projects/project-a
echo "VELXIO_PROJECT_ID=project-a-id" > .env
vup

# Project B
cd ~/projects/project-b
echo "VELXIO_PROJECT_ID=project-b-id" > .env
vup

Development

Building the package

pip install build
python -m build

Installing in development mode

pip install -e ".[dev]"

Running tests

pytest

Troubleshooting

Error: Missing required configuration

Make sure you have set all required environment variables or provided them via command-line arguments.

Error: File not found

Ensure that diagram.json and sketch.ino exist in your project directory, or provide custom paths using --diagram and --sketch arguments.

Error: Invalid JSON in diagram.json

Check that your diagram.json file is valid JSON format.

Error: Request failed

  • Verify that your velxio server is running and accessible
  • Check that your access token is valid and not expired
  • Ensure the project ID is correct

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For issues and questions, please use the GitHub issue tracker.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

velxio_updater-0.1.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

velxio_updater-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file velxio_updater-0.1.0.tar.gz.

File metadata

  • Download URL: velxio_updater-0.1.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for velxio_updater-0.1.0.tar.gz
Algorithm Hash digest
SHA256 75184b9402b6314a81aa785b9dde4efc6e279e81bed30b68af97f4ca7eb85b47
MD5 b3a6aaff9e8dc642596310289574f44c
BLAKE2b-256 ad212b267b33ace16948a9b3e0b093924434ba298bb46bbe7e296a92a37fa1d6

See more details on using hashes here.

File details

Details for the file velxio_updater-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: velxio_updater-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for velxio_updater-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef28d8007337f873f1f72f470ef5334f0964fd9cb1d51afc4c66cc09de9fa966
MD5 78a85660cebac3fa4d05d3b4a5cd03b5
BLAKE2b-256 f9970f54d6ca0229908e6480647a485a65d9dd5771b876d3e1d98f04c6d7e0ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page