Skip to main content

asnkit-gen-python

A plugin for asnkitcc that generates Python code from ASN.1. The generated module imports asnkitrt and, by default, embeds the compiled specification as bytes. It has a data class for each SEQUENCE and SET, an enumeration for each ENUMERATED and a class for each alternative of a CHOICE, all with methods to encode and decode.

$ pip install asnkit-gen-python
$ asnkitcc generate --plugin python -o out foo.asn    # Writes out/foo.py.
>>> from foo import Question
>>> encoded = Question(id=1, question='Is 1+1=3?').encode('uper')
>>> Question.decode(encoded, 'uper')
Question(id=1, question='Is 1+1=3?')

Options, given with --plugin-opt KEY=VALUE:

name

The name of the module, without .py. Default: the name of the first ASN.1 file.

codec

The codec used when none is given. Default: ber.

embed

false to leave the compiled specification out of the module, as for one sent signed or encrypted. The module then has use_asni(data, ...), which takes the contents of the .asni file with the options of asnkitrt.load_asni() (nonce, bound_to, verification_keys, decryption_keys and those to accept any), checks it once and uses it for every codec. Until it is called, encoding and decoding raise RuntimeError. The file has to be compiled from the same specification. Default: true.

Names are converted to Python style: fooBar becomes foo_bar and a type Foo-Bar becomes FooBar. If two names end up the same in Python, generation fails with an error.

License

Apache License 2.0 (LICENSE-COMPILER). The generated code, with the helper code copied into it, is yours to use under terms of your choice, as the header of each file it writes says. The generated code depends on asnkitrt, which is MIT licensed.

Metadata

Release files for asnkit-gen-python 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asnkit-gen-python 1.1.0
File Size Uploaded Provenance
asnkit_gen_python-1.1.0.tar.gz 14.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for asnkit-gen-python 1.1.0
File Interpreter ABI Platform
asnkit_gen_python-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.4 kB

Release files / asnkit_gen_python-1.1.0.tar.gz

Download URL asnkit_gen_python-1.1.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1b0f0e944e51d30f2e127355a10b8fef27e23d5d7ff47a7dbb3267833544f0e6
BLAKE2b-256 checksum
How to use checksums
0f6ef40f3324aee3e185cb9a728fac57df70b4d8e1cb40bbff5c60037149040b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Release files / asnkit_gen_python-1.1.0-py3-none-any.whl

Download URL asnkit_gen_python-1.1.0-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4be7f9cc1388e3d983341ffe7789a3c9a7adeb2956313142591d069af46f4411
BLAKE2b-256 checksum
How to use checksums
139628c8a5a880a138ad60a223a1cd4834a63deedd1224f8d23a6b6926897853
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

Security for asnkit-gen-python 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for asnkit_gen_python-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page