PyFranca
is a Python module and tools for working with
Franca interface definition language
(IDL) files (.fidl
). It is entirely written in Python and intended to be
used as a base for developing code generation and processing tools.
PyFranca
provides:
- abstract syntax tree (AST) representation for a subset of the Franca IDL v0.9.2 .
- a lexer and parser for the Franca IDL, based on Python Lex-Yacc (PLY).
- a processor for Franca IDL files that handles model imports and type references.
- a .fidl file command-line validator
The following extensions are envisioned:
- AST serializer
- diff tool for .fidl files for detecting interface changes
This project is a tool for exploring the capabilities (and ambiguities) of Franca. It is unstable and heavily under development.
Processing Franca IDL:
from pyfranca import Processor
processor = Processor()
processor.import_string("hello.fidl", """
package Example
interface Interface {
method Hello {}
}
""")
assert processor.packages["Example"].interfaces["Interface"].methods["Hello"].name == "Hello"
Listing the packages and interfaces, defined in a .fidl
file:
from pyfranca import Processor, LexerException, ParserException, ProcessorException
processor = Processor()
try:
processor.import_file("hello.fidl")
except (LexerException, ParserException, ProcessorException) as e:
print("ERROR: {}".format(e))
for package in processor.packages.values():
print(package.name)
for interface in package.interfaces.values():
print("\t", interface.name)
Visualizing Franca models:
fidl_dump.py model.fidl
Validating Franca models:
fidl_validator.py -I packages model.fidl
The following Franca features are not supported:
- dots in type collection and interface names
- complex constants
- expressions
- unions
- method overloading
- method error extending
- contracts
- Python 2.7 or 3.4
- PLY
Using pip:
pip install pyfranca
From source:
git clone http://github.com/zayfod/pyfranca.git
cd pyfranca
python setup.py install
API documentation is available here:
http://pyfranca.readthedocs.io/
Bug reports and patches should be sent via GitHub: