Unlike many other RPC framworks/IDL compilers, Nirum's single unit of compilation is not a source file, but a package of source files. Each package is compiled to a package of target language (e.g. Python package with setup.py file). The following example is an ordinary Nirum package:
- /
- foo/
- bar.nrm
- baz.nrm
- baz/
- qux.nrm
- quux.nrm
- package.toml
- foo/
If the target is Python the above package is compiled to the below Python package:
- /
- foo/
- __init__.py
- bar/
- __init__.py
- baz/
- __init__.py
- baz/
- __init__.py
- qux/
- __init__.py
- quux/
- __init__.py
- setup.py
- foo/
Every Nirum package has its own package.toml file. It contains metadata
about the package (e.g. version
, authors
). The following TOML code
is an example:
version = "1.0.0" # (required)
description = "Short description on the package"
license = "MIT"
keywords = "sample example nirum"
[[authors]]
name = "John Doe" # (required)
email = "[email protected]"
uri = "http://example.com/~johndoe/"
It consists of the following fields (emphasized fields are required):
version
(string)
: The required semver of the package.
description
(string)
: An optional short description of the package.
license
(string)
: An optional license of the package.
keywords
(string)
: An optional keywords of the package.
authors
(array of tables)
: The list of authors. Note that it can be empty, but name
field is
required if any author is provided. Each author table consists of
the following fields:
*`name`* (string)
: The required full name of the author.
`email` (string)
: An optional email address of the author.
`uri` (string)
: An optional URI to author's website.
targets
(table)
: Settings of each target. See also the below target settings section
for details.
Beside common metadata to every target, there can be configurations specific
to each target. For example, Python target need a PyPI distribution name
(which is specified of setup()
function's name
parameter in setup.py file)
of the package to be generated by Nirum, hence name
:
[targets.python]
name = "py-foobar" # will be submitted to: pypi.python.org/pypi/py-foobar
All files in a Nirum package must be in UTF-8:
- A package manifest file (package.toml) must be in UTF-8, as the TOML specification requires.
- Nirum module source files must be in UTF-8. If a file has a leading BOM (byte order mark) it will be ignored.