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.jsonandsketch.inofrom 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)
Install the latest stable release:
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:
- Open your velxio instance in a browser
- Open Developer Tools (F12)
- Go to Application/Storage > Cookies
- Find the
access_tokencookie
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file velxio_updater-0.1.1.tar.gz.
File metadata
- Download URL: velxio_updater-0.1.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
510a1d0f127fabfba134b4a241f3100caf5e8d83762d9dc4df6994598f694b6b
|
|
| MD5 |
35ff9263c7c6d45aaee9cfaacbf11a6c
|
|
| BLAKE2b-256 |
c488dc221e5d36d4435be178760c049d7935f99b5eb65f6e7a3d3f373ad6ce29
|
File details
Details for the file velxio_updater-0.1.1-py3-none-any.whl.
File metadata
- Download URL: velxio_updater-0.1.1-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ea31c55826c73083176f9a68ee2c07e17c2f25714d68d1f62e2cca10808c942
|
|
| MD5 |
387707e975bf9e76f3b10de070c15d10
|
|
| BLAKE2b-256 |
6a3d467bcf32a08c0ce9814cfc58bb3f35ae2d77b6d2b89ff0564002497bb510
|