Skip to main content

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 passed
  • 1 - Lint or validation errors
  • 2 - Contract file not found
  • 3 - 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


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.2.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

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

genvm_linter-0.2.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file genvm_linter-0.2.0.tar.gz.

File metadata

  • Download URL: genvm_linter-0.2.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for genvm_linter-0.2.0.tar.gz
Algorithm Hash digest
SHA256 95540edcaca8b562cec214f6381cde6f2d98c1eae0eb140246c1909d3ac57d40
MD5 86a5d39b877f5e071e946445c3894c7b
BLAKE2b-256 d69e8d35234c232a8005bcd957e3a8657ad84efcceafc075dd41e85b2a5a889c

See more details on using hashes here.

File details

Details for the file genvm_linter-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: genvm_linter-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for genvm_linter-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db6f6d3b8ace9197f3ef74aab7211b46d4f8a2eced738ba0fae8f007b4e4a247
MD5 0b3550890a9cc8d7f40a20e44018bb31
BLAKE2b-256 4376d0187af95df18a820acf9400723e9aee4b82512c1fb0d4a946a8fd39f1cd

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