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.2.tar.gz (69.1 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.2-py3-none-any.whl (44.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: trishul_smi-0.1.2.tar.gz
  • Upload date:
  • Size: 69.1 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.2.tar.gz
Algorithm Hash digest
SHA256 7d6ceb78581e56e5925cd2d179c75f752af335adad929fb3fb878ebb9ed7f50d
MD5 b9ab119e0d2625a06ed10997de876cad
BLAKE2b-256 4cf8ca99d62202c52943cf682fb55d2bedde6bf09ad8a2985f8a749308fd22e1

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: trishul_smi-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 411211566d5d06f08ee7b1aed4fa2d1932cb1d1b2a1972670f4ac3a6c7066ba7
MD5 0bfec75b9aa10675ec3ded7c09d3b215
BLAKE2b-256 51af41c06f1646a3a4b496a347b1337e1c26ae21626451d030b78154783e7e2a

See more details on using hashes here.

Provenance

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