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.3.2.tar.gz (43.8 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.3.2-py3-none-any.whl (23.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: genvm_linter-0.3.2.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for genvm_linter-0.3.2.tar.gz
Algorithm Hash digest
SHA256 c6491f1719260329e131d05189feba4bccd4233d3ad3255fb75c50a6f8975cd6
MD5 408b0c3fffb184e2fa51c67b581a5634
BLAKE2b-256 d97dfc5cd3f8911e4c7d2ed7afcfdec4d35b00113513b76a49321f72669f5c0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genvm_linter-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 23.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for genvm_linter-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 509d07b34e9f8f3a25327f9d403f341a84fd8128ea3679a5cfe301d5c181d5d1
MD5 2032e0f63cc15ae53a5c802c5288f7e2
BLAKE2b-256 9755fd39d8810387ed5ecf3023c7d6e69770a3e8cfab2b41536766a54b19bd67

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