Skip to main content

idl_parser

Test Status Coverage Documentation Status

Description

OMG IDL file parser. This library just parse IDL files, and output intermidiate type objects.

Documentation

API reference and usage: https://idl-parser.readthedocs.io/

Example

"""
example for idl_parser package
"""

from idl_parser import parser
parser_ = parser.IDLParser()
idl_str = """
module my_module {
  struct Time {
    long sec;
    long usec;
  };

  typedef sequence<double> DoubleSeq;

  struct TimedDoubleSeq {
    Time tm;
    DoubleSeq data;
  };

  enum RETURN_VALUE {
    RETURN_OK,
    RETURN_FAILED,
  };

  interface DataGetter {
    RETURN_VALUE getData(out TimedDoubleSeq data);
  };

};
"""

global_module = parser_.load(idl_str)
my_module = global_module.module_by_name('my_module')
dataGetter = my_module.interface_by_name('DataGetter')
print('DataGetter interface')
for m in dataGetter.methods:
  print('- method:')
  print('  name:', m.name)
  print('  returns:', m.returns.name)
  print('  arguments:')
  for a in m.arguments:
    print('    name:', a.name)
    print('    type:', a.type)
    print('    direction:', a.direction)

doubleSeq = my_module.typedef_by_name('DoubleSeq')
print('typedef %s %s' % (doubleSeq.type.name, doubleSeq.name))

timedDoubleSeq = my_module.struct_by_name('TimedDoubleSeq')
print('TimedDoubleSeq')
for m in timedDoubleSeq.members:
  print('- member:')
  print('  name:', m.name)
  print('  type:', m.type.name)

More examples are in the examples folder of the repository:

  • example.py: the smallest example: a module and an interface

  • argument_direction_example.py: directions of method arguments (in, out and inout)

  • struct_example.py: structs and their member types

  • struct_inheritance_map_example.py: struct inheritance (struct B : A) and map<K, V> types

  • any_fixed_example.py: any, Object, ValueBase and fixed-point (fixed<d, s>) types

  • preprocessor_example.py: #define macros, #if / #elif / #else, and macros given from outside with IDLParser(defines=...)

  • conditional_include_example.py: #include in #if / #elif / #else branches: only the files of the kept branch are read

  • enum_example.py: enums and their values

  • enum_value_example.py: enumerator values set with @value(n) (literals or const names)

  • const_expr_example.py: constant expressions (N * 2, (1 << 3)) in const values, array sizes and bounds

  • typedef_template_module_example.py: types declared inside a typedef (typedef enum E { ... } EE;), and template modules, which are skipped with a warning

  • union_example.py: unions (discriminator kinds, case and default labels, member types)

  • annotation_example.py: IDL 4 annotations (@key, @range, …) and struct keys

  • repository_id_example.py: repository IDs (IDL:omg.org/CosNaming/NamingContext:1.0) from #pragma prefix / ID / version, typeid and typeprefix

  • scoped_name_example.py: same-named types in several modules (relative X, C::X and absolute ::B::X names)

https://github.com/sugarsweetrobotics/idl_parser/tree/main/examples

How to install

sudo pip install idl_parser

Metadata

Release files for idl-parser 0.6.2

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

Source distribution (sdist)

Source distribution for idl-parser 0.6.2
File Size Uploaded Provenance Actions
idl_parser-0.6.2.tar.gz 234.5 kB With provenance Details for idl_parser-0.6.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for idl-parser 0.6.2
File Interpreter ABI Platform Actions
idl_parser-0.6.2-py3-none-any.whl Python 3 none any Details for idl_parser-0.6.2-py3-none-any.whl

Total release size: 340.9 kB

Release files / idl_parser-0.6.2.tar.gz

Download URL idl_parser-0.6.2.tar.gz
Size 234.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0283b19218eb503d954da1e7638dd1a9ae87aa6b7dbf7e92f28834bf67cce549
BLAKE2b-256 checksum
How to use checksums
44a293052f1219241e0dd8873b17ec7b0f59603a22deed21117a0bcfbee1df11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 28, 2026.

Transparency log

Release files / idl_parser-0.6.2-py3-none-any.whl

Download URL idl_parser-0.6.2-py3-none-any.whl
Size 106.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6dd4c411aafa7e8b9fa4d23ce4a610c4cd4e6cb094296817ac27989c186b3bf
BLAKE2b-256 checksum
How to use checksums
577ba7db9b7848baff9922733d5f5a7e43ece7aca2f33009463cf0afc80ab0b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 28, 2026.

Transparency log

Security for idl-parser 0.6.2

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 idl_parser-0.6.2.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 28, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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