Fast validation and schema extraction for GenLayer intelligent contracts
Project description
genvm-linter
Fast validation and schema extraction for GenLayer intelligent contracts.
Installation
pip install genvm-linter
Usage
# Run both lint and validate (default)
genvm-lint check contract.py
# Fast AST safety checks only (~50ms)
genvm-lint lint contract.py
# Full SDK semantic validation (~200ms cached)
genvm-lint validate contract.py
# Extract ABI schema
genvm-lint schema contract.py
genvm-lint schema contract.py --output abi.json
# Pre-download GenVM artifacts
genvm-lint download # Latest
genvm-lint download --version v0.2.12 # Specific version
genvm-lint download --list # Show cached
# Agent-friendly JSON output
genvm-lint check contract.py --json
How It Works
Layer 1: AST Lint Checks (Fast)
- Forbidden imports (
random,os,time, etc.) - Non-deterministic patterns (
float(),time.time()) - Structure validation (dependency header)
Layer 2: SDK Validation (Accurate)
- Downloads GenVM release artifacts (cached at
~/.cache/genvm-linter/) - Loads exact SDK version specified in contract header
- Validates types, decorators, storage fields
- Extracts ABI schema
Exit Codes
0- All checks passed1- Lint or validation errors2- Contract file not found3- SDK download failed
VS Code Extension
This linter is used by the GenLayer VS Code Extension for real-time contract validation.
Development
git clone https://github.com/genlayerlabs/genvm-linter.git
cd genvm-linter
pip install -e ".[dev]"
pytest
License
MIT
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
genvm_linter-0.5.3.tar.gz
(46.9 kB
view details)
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 genvm_linter-0.5.3.tar.gz.
File metadata
- Download URL: genvm_linter-0.5.3.tar.gz
- Upload date:
- Size: 46.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4f841c07d23a43315f2e07888104ca0a7d971c32d2ab57e27bb651450ab785e
|
|
| MD5 |
5c05e5eabedfdd7e03eb70671ec96f86
|
|
| BLAKE2b-256 |
be0c1f8fbe4dc7aa62717a2d6e51b403481e8b620630c91c1f93b8f74d78fd80
|
File details
Details for the file genvm_linter-0.5.3-py3-none-any.whl.
File metadata
- Download URL: genvm_linter-0.5.3-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbaa2eac37bff1e41bd1533dad312deede7d913d0e5c11f57fc8fdee9f89d4c6
|
|
| MD5 |
a0c0fba273da116cd65eacbb690cddb7
|
|
| BLAKE2b-256 |
737c02e8d146f76489ab5c642f4298c5b8345d11e141dd01b507978d2fd0d2a8
|