Skip to main content

A clean, modern SMI/MIB compiler

Project description

trishul-smi

A clean, modern SNMP MIB compiler written in Python.

PyPI Python License: MIT

trishul-smi fetches, parses, and compiles SNMP MIB definitions (SMIv1 and SMIv2) into structured JSON or pysnmp-compatible Python modules. It resolves transitive imports automatically, caches compiled modules on disk, and ships a CLI that works out-of-the-box with no SNMP toolchain required.


Features

  • Full import closure — resolves every transitive dependency automatically
  • Two output formats — structured JSON and pysnmp-compatible Python
  • Concurrent fetching — parallel async HTTP with retry and timeout
  • Pluggable readersFileReader, HttpReader, ZipReader, composable via ReaderChain
  • Disk cache — compiled modules cached with mtime-based TTL; atomic writes
  • Cycle detection — Kahn's algorithm with actionable error messages
  • SMIv1 + SMIv2 — separate Lark grammars, auto-detected per MIB

Installation

pip install trishul-smi

Requires Python ≥ 3.10.


Quick Start

# Compile IF-MIB and all its dependencies to JSON
trishul-smi compile IF-MIB

# Compile to both JSON and pysnmp Python modules
trishul-smi compile IF-MIB IP-MIB -f json -f pysnmp -o ./out

Python API:

import asyncio
from pathlib import Path
from trishul_smi import MibCompiler, CompilerConfig
from trishul_smi.reader import FileReader, HttpReader

async def main():
    config = CompilerConfig(output_dir=Path("./out"))
    async with HttpReader(config.sources) as http:
        compiler = (
            MibCompiler(config)
            .add_reader(FileReader("/usr/share/snmp/mibs"))
            .add_reader(http)
        )
        results = await compiler.compile("IF-MIB", "IP-MIB")
    for r in results:
        print(r.name, r.status, r.output_paths)

asyncio.run(main())

Documentation


License

MIT — see LICENSE.

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

trishul_smi-0.1.1.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

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

trishul_smi-0.1.1-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

Details for the file trishul_smi-0.1.1.tar.gz.

File metadata

  • Download URL: trishul_smi-0.1.1.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for trishul_smi-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c5e501ae5f2fa5750207cc9f8a973775429f70f9f56872255b9b98c487812248
MD5 6dc2181205ae19989ccafa1afafa7624
BLAKE2b-256 020c0880602ed1f5bc400459eb2b362c66c640c7f3c3fac07d976925622141d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for trishul_smi-0.1.1.tar.gz:

Publisher: release.yml on tosumitdhaka/trishul-smi

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

File details

Details for the file trishul_smi-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: trishul_smi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 44.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for trishul_smi-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9724c43337422627055d9edd6813ee30a6e1a9c39dcfb8509ad0422486b463da
MD5 b7c828011d67b166812567714555f2c6
BLAKE2b-256 72d726e4f71d4231e6f50ff3756d19194e643145be2176ca97ee1757ec7616d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for trishul_smi-0.1.1-py3-none-any.whl:

Publisher: release.yml on tosumitdhaka/trishul-smi

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