Skip to main content

A Vyper linter for fine sneks.

Project description

Natrix

Natrix is a vyper linter that checks for common mistakes in vyper contracts. It is designed to be your vyper copilot, helping you to write code that is more secure and efficient.

Installation

You can install Natrix using pip:

pip install natrix

Currently natrix requires uv to be installed to function correctly.

Usage

To check a contract:

natrix lint file_to_lint.vy

To check all vyper contract in the current directory:

natrix lint
# or simply
natrix

To generate explicit exports for a contract:

natrix codegen exports path/to/contract.vy

Command Line Options

natrix --help                         # Show help message
natrix --version                      # Show version information
natrix lint --list-rules               # List all available rules
natrix lint --disable NTX1 NTX2       # Disable specific rules
natrix lint --rule-config RuleName.param=value  # Configure rule parameters
natrix lint -p /path/to/libs /another/path  # Add extra paths for imports
natrix codegen exports contract.vy    # Generate explicit exports

Configuration

You can configure Natrix using a pyproject.toml file in your project root:

[tool.natrix]
# Files or directories to lint (relative to pyproject.toml)
files = ["contracts/", "tests/contracts/"]

# Additional paths to search for imports
path = ["lib", "vendor/contracts"]

# Rules to disable
disabled_rules = ["NTX1", "NTX2"]

# Rule-specific configurations
[tool.natrix.rule_configs.RuleName]
param = "value"

Pre-commit hook

Natrix can also be used as a pre-commit hook. This allows to have your contracts checked automatically before you can commit.

To add natrix just add the following lines to your pre-commit-config.yaml config file:

repos:
  - repo: https://github.com/albertocentonze/natrix
    rev: v0.1.8  # Use the latest version
    hooks:
      - id: natrix

and then install pre-commit in your repository by doing:

pre-commit install

Disclaimer

Natrix is highly experimental software, I do not take any responsibility for changes to the codebase suggested by this linter that might lead to loss of funds or any other issue.

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

natrix-0.1.8.tar.gz (110.3 kB view details)

Uploaded Source

Built Distribution

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

natrix-0.1.8-py3-none-any.whl (38.6 kB view details)

Uploaded Python 3

File details

Details for the file natrix-0.1.8.tar.gz.

File metadata

  • Download URL: natrix-0.1.8.tar.gz
  • Upload date:
  • Size: 110.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for natrix-0.1.8.tar.gz
Algorithm Hash digest
SHA256 aae8e7f65ae689bfdcf174fb4b8643ad678a5cc9fa07f26ad4cf3b751ef98102
MD5 30a54ff1dcd566819b667ef25b5921fd
BLAKE2b-256 bd8b199b99060b0ad03ac2056111eb76d308c6163af22b091a465aa31a164f04

See more details on using hashes here.

Provenance

The following attestation bundles were made for natrix-0.1.8.tar.gz:

Publisher: release.yml on AlbertoCentonze/natrix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file natrix-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: natrix-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 38.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for natrix-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f550a6e90affb6c3dfead229b774ea45b51db551617caaffd48b04ba2837fcbe
MD5 b9b81b27b5d610ca92a1c4211c4f576a
BLAKE2b-256 844b0eac7eefa56a8264eb840ea6065808bc48c955e45c05d176f8d39be71573

See more details on using hashes here.

Provenance

The following attestation bundles were made for natrix-0.1.8-py3-none-any.whl:

Publisher: release.yml on AlbertoCentonze/natrix

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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