Skip to content
Protocol Buffers, JSON, XML data serialization system for Erlang
Erlang Makefile Shell
Find file
Latest commit 1cc0194 Jan 25, 2015 @alavrik Bump copyright year
Failed to load latest commit information.
doc Add a new piqic-erlang --include-lib option Sep 15, 2014
examples Get rid of Makefile.piqi files Mar 16, 2014
include Bump copyright year Jan 25, 2015
piqic-erlang Fix #7: "rebar generate" can't handle recursive and broken symlinks Apr 4, 2013
priv/bin Add priv/bin/piqi -- so that it can be used from Makefiles Mar 11, 2013
src Bump copyright year Jan 26, 2015
tests Optionally preserve unknown Protobuf fields Apr 7, 2014
.gitignore Add .rebar to gitignore Mar 16, 2014
.travis-ci.sh
.travis.yml Update travis-ci script Dec 29, 2014
CHANGES piqi-erlang v0.7.2 release Dec 29, 2014
LICENSE Add README, LICENSE, THANKS Mar 15, 2013
Makefile Add pre-built "piqi" executable as dependency Mar 12, 2013
README.md Add TODO list Apr 8, 2014
THANKS Add Dennis Docter to THANKS Jun 11, 2013
TODO Add TODO list Apr 8, 2014
get-piqi-binary Run ./get-piqi-binary from pre- compile hook instead of post- get-deps Dec 8, 2014
make-wrapper Fix #15 by renaming make to make-wrapper Sep 15, 2014
rebar.config Bump piqi-binary dependency to the latest stable upstream version (v0… Jan 25, 2015
rebar.config.script Add the ability to use a locally installed "piqi" binary Apr 9, 2013

README.md

Build Status

Piqi is a multi-format data serialization system for Erlang. It provides a uniform interface for serializing Erlang data structures to JSON, XML and Protocol Buffers formats.

A typical Piqi usage scenario involves the following steps:

1. Include Piqi as a rebar depedency -- add this entry to your rebar.config file:

{deps, [
    ...
    {piqi, "", {git, "git://github.com/alavrik/piqi-erlang.git", {branch, "master"}}},
    ...
]}.

2. Describe data structures using the Piqi data definition language or Protocol Buffers .proto files

The Piqi data definition language can describe many Erlang types, both primitive and user-defined. This includes integers, floats, booleans, strings, binaries, lists, records and variants (i.e. {tag, Value} tuples).

.piqi modules can be converted to and from Protocol Buffers .proto files:

piqi to-proto X.piqi
piqi of-proto X.proto

3. Call the Piqi compiler to generate Erlang type definitions and serialization code

4. Use generated serializes/deserializers in a user's program -- the desired serialization format can be specified at runtime. For examples:

% deserialize a data structure from Protocol Buffers
AddressBook = addressbook_piqi:parse_address_book(Bytes, 'pb'),

% serialize it as JSON
Json = addressbook_piqi:gen_address_book(AddressBook, 'json'),

% serialize it as pretty-printed JSON
JsonPretty = addressbook_piqi:gen_address_book(AddressBook, 'json_pretty'),

% serialize it as XML
Xml = addressbook_piqi:gen_address_book(AddressBook, 'xml').

Examples

See examples/addressbook and other projects in the examples directory.

Documentation

Piqi Erlang documentation is available at http://piqi.org/doc/erlang/

The master copy is located in the repository: doc/piqi-erlang.md

Bugs

Please report found problems using GitHub issues.

Mailing list

http://groups.google.com/group/piqi

Advanced installation

Sometimes, it may be useful or even necessary to use a custom version of the piqi binary executable instead of the pre-built one that comes with piqi-erlang.

For example, there may not be a pre-built piqi for your platform. Or organization policies may prohibit installing third-party binaries.

In this case, you can build the piqi binary from source code, put it somewhere in the local filesystem and point to it using the PIQI environment variable before running any rebar commands and starting the piqi Erlang application. For example:

export PIQI=/usr/local/bin/piqi

Contributing

Your contributions are always welcome. Just open a pull request. Check TODO list for ideas.

Some useful commands:

make deps  # the same as "rebar get-deps"
make       # the same as "rebar compile"

make test
make dialyzer
make -C tests all test
make -C tests clean

License

Apache License Version 2.0

Something went wrong with that request. Please try again.