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 GitHub Stars GitHub Forks GitHub Issues

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 from a local MIB directory
tsmi compile IF-MIB --mib-dir /usr/share/snmp/mibs

# Fetch from the internet and compile to JSON + pysnmp
tsmi compile IF-MIB IP-MIB -f json -f pysnmp --online -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"))
    compiler = MibCompiler(config).add_reader(FileReader("/usr/share/snmp/mibs"))
    # optionally add HTTP: async with HttpReader(*config.sources) as http: compiler.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.2.0.tar.gz (87.0 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.2.0-py3-none-any.whl (54.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: trishul_smi-0.2.0.tar.gz
  • Upload date:
  • Size: 87.0 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.2.0.tar.gz
Algorithm Hash digest
SHA256 3bdfe3b863684c97376623dbfa69b636560b42e4c4186dd69b209bba9d42d589
MD5 0accb23410a06ad2ee5a04e8b0a86f5b
BLAKE2b-256 cf610e722327fb4292b093bab34a449c5a3664e1fddfef03278869af2c259d90

See more details on using hashes here.

Provenance

The following attestation bundles were made for trishul_smi-0.2.0.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: trishul_smi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 54.9 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 554232600b4353954c7de07186189675e2bb0dee4f451b0a62f2078feee0a816
MD5 b319b48a3df5ec2c3bb8f4f5d9374f8d
BLAKE2b-256 264b3655f8c036989513c5728322ff923daee9c85723f539e47c1e553c8aa5ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for trishul_smi-0.2.0-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