Skip to main content

Grammar-driven ASN.1 (X.680/X.690 DER subset) parser plugin for swarmauri-sdk using Lark Earley.

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_parser_asn1 Discord

swarmauri-asn1

Grammar-driven ASN.1 schema parsing (X.680) + minimal DER decoding (X.690) for swarmauri-sdk.

  • Parser uses Lark Earley (MIT-only path; no standalone LALR).
  • Includes a minimal DER TLV decoder covering common UNIVERSAL types, SEQUENCE/SET[/OF], CHOICE, OPTIONAL/DEFAULT, and basic tagging.

Layout

swarmauri_asn1/
  ├─ swarmauri_asn1/
  │  ├─ grammar/asn1.lark
  │  ├─ parser.py
  │  ├─ tool.py
  │  ├─ der_codec.py
  │  ├─ transformer.py
  │  ├─ ir.py
  │  └─ __init__.py
  ├─ specs/Example.asn
  ├─ examples/standalone_decode.py
  └─ examples/data/question.der

Quick demo (standalone)

python examples/standalone_decode.py

Expected output:

{"id": 42, "question": "Hello"}

swarmauri integration

Install into the same environment as swarmauri-sdk, then instantiate the parser:

from swarmauri.parsers import ASN1Parser

parser = ASN1Parser(asn1_files=["./specs/Example.asn"])
docs = parser.parse("examples/data/question.der", type_name="Question")
print(docs[0].content)

Ensure you have swarmauri-sdk installed; this package registers via entry points.

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

swarmauri_parser_asn1-0.11.0.dev1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

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

swarmauri_parser_asn1-0.11.0.dev1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file swarmauri_parser_asn1-0.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_parser_asn1-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_parser_asn1-0.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 bce1ac187082fa136b00d6a841b7fb4e1e77d6e6213f9e8b7e4627b9d59d8a31
MD5 688d0545b106e371d0be9acba1c0cdb4
BLAKE2b-256 013c2c5ed69f5354010b693d716d47f88a3c54c705de073f369ecd434ff2e91b

See more details on using hashes here.

File details

Details for the file swarmauri_parser_asn1-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_parser_asn1-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for swarmauri_parser_asn1-0.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6af961a37d040ff09d7b8e185678fe27b6f8927343368ec00218c2afeb5eab3
MD5 b36064516572ba165f88980ee946942c
BLAKE2b-256 c62a8c7024ec9891477edd39d444362636c051a6285bf2d1b627b4e8392f313e

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