git.delta.rocks / jrsonnet / refs/commits / a5cec24e9cdc

difftreelog

doc: feed readme.md with useful links/badges

Yaroslav Bolyukin2021-07-09parent: #6d0cadc.patch.diff
in: master

1 file changed

modifiedREADME.mddiffbeforeafterboth
1# jrsonnet1# jrsonnet
22
3![Crates.io](https://img.shields.io/crates/v/jrsonnet-evaluator)3[![release](https://img.shields.io/github/v/tag/CertainLach/jrsonnet?color=%23fb4934&label=latest%20release&style=for-the-badge)](https://github.com/CertainLach/jrsonnet/releases)
4[![license](https://img.shields.io/github/license/CertainLach/jrsonnet?color=%2383a598&label=license&style=for-the-badge)](/LICENSE)
5[![opencollective](https://img.shields.io/opencollective/all/jrsonnet?color=%238ec07c&style=for-the-badge)](https://opencollective.com/jrsonnet)
46
5## What is it7## What is it
68
7[Jsonnet](https://jsonnet.org/) is a data templating language9[Jsonnet](https://jsonnet.org/) is a data templating language
810
9This Rust crate implements both jsonnet library and an alternative `jsonnet` executable based on it. For more information see [bindings](#Bindings).11This Rust crate implements both jsonnet library and an alternative `jsonnet` executable based on it. For more information see [bindings](#Bindings).
1012
13## Install
14
15### NixOS
16
17jrsonnet is packaged in nixpkgs and maintained by @CertainLach
18
19```sh
20nix-env -iA nixpkgs.jrsonnet
21```
22
23### MacOS
24
25jrsonnet is packaged to brew and maintained by @messense
26
27```sh
28brew install jrsonnet
29```
30
31### Windows/other linux distributions
32
33You can get latest build of jrsonnet in [releases](https://github.com/CertainLach/jrsonnet/releases)
34
35### Build from sources
36
37jrsonnet should build on latest stable Rust version (probally on olders, but there is no MSRV policy provided)
38
39Debug build will work too, but it is much slower than release
40
41```
42cargo build --release
43```
44
11## Why?45## Why?
1246
13There already are multiple implementations of this standard implemented in different languages: [C++](https://github.com/google/jsonnet), [Go](https://github.com/google/go-jsonnet/), [Scala](https://github.com/databricks/sjsonnet).47There already are multiple implementations of this standard implemented in different languages: [C++](https://github.com/google/jsonnet), [Go](https://github.com/google/go-jsonnet/), [Scala](https://github.com/databricks/sjsonnet).
1650
17In the end, it's always fun to implement something in Rust.51In the end, it's always fun to implement something in Rust.
1852
19## Compliance with the [specification](https://jsonnet.org/ref/spec.html)53## Bindings
2054
21- Passes all the original `examples` tests55### Rust
2256
23- Passes all the original `test_suite` tests except for those which require stacktraces identical to the default implementation (while also being available, vanilla-like stacktraces are not 100% identical):57[![crates.io](https://img.shields.io/crates/v/jrsonnet-evaluator)](https://crates.io/crates/jrsonnet-evaluator)
58[![docs.rs](https://docs.rs/jrsonnet-evaluator/badge.svg)](https://docs.rs/jrsonnet-evaluator)
2459
25 ```jsonnet60Jrsonnet is written in rust itself, so just add it as dependency
26 ## Explaining format
27 ​```
28 RuntimeError("3")
29 --> /home/lach/jsonnet-rs/a.jsonnet:1:25
30 |
31 1 | local a = "%0 10.20d" % error "3";
32 | ^^^^^^^^^ error statement
33 |
34 --> /home/lach/jsonnet-rs/a.jsonnet:1:11
35 |
36 1 | local a = "%0 10.20d" % error "3";
37 | ^^^^^^^^^^^^^^^^^^^^^^^ function <mod> call
38 |
39 --> /home/lach/jsonnet-rs/a.jsonnet:6:6
40 |
41 6 | a: a,
42 | ^ variable <a>
43 |
44 --> /home/lach/jsonnet-rs/a.jsonnet:3:6
45 |
46 3 | b: self.a,
47 | ^^^^^^ field access
48 |
49 --> /home/lach/jsonnet-rs/a.jsonnet:9:1
50 |
51 9 | e.b
52 | ^^^ field access
53 |
54 ​```
5561
56 ## Compact format (default)62### Python
57 ​```
58 RuntimeError("3")
59 /home/lach/jsonnet-rs/a.jsonnet:1:25-35: error statement
60 /home/lach/jsonnet-rs/a.jsonnet:6:6-8 : variable <a>
61 /home/lach/jsonnet-rs/a.jsonnet:3:6-13 : field access
62 /home/lach/jsonnet-rs/a.jsonnet:9:1-5 : field access
63 ​```
6463
65 ## Vanilla format
66 ​```
67 RUNTIME ERROR: 364[![crates.io](https://img.shields.io/pypi/v/rjsonnet)](https://pypi.org/project/rjsonnet/)
68 a.jsonnet:1:25-34 thunk <a> from <$>
69 <std>:237:21-22 thunk from <function <anonymous>>
70 <std>:754:20-24 thunk from <function <anonymous>>
71 <std>:32:25-26 thunk from <function <anonymous>>
72 <std>:32:16-27 function <anonymous>
73 <std>:754:8-25 function <anonymous>
74 <std>:237:7-23 function <anonymous>
7565
76 a.jsonnet:6:6-7 object <d>66Bindings are created and maintained by @messense
77 a.jsonnet:3:6-12 object <c>
78 a.jsonnet:9:1-4 $
79 During evaluation
80 ​```
81 ```
8267
83## Bindings68### C/C++
8469
85Jrsonnet provides a standard `libjsonnet.so` shared library and should work as drop-in replacement for it70Jrsonnet provides a standard `libjsonnet.so` shared library and should work as drop-in replacement for it
8671
72### Other
73
87WASM bingings are also available, Java bindings (Both JNI and WASM compiled to .class) are in progress74WASM bingings are also available, Java bindings (Both JNI and WASM compiled to .class) are in progress
8875
89See [bindings](./bindings/) for more information.76See [bindings](./bindings/) for more information.
95Official benchmark results are available [in this gist](https://gist.github.com/CertainLach/5770d7ad4836066f8e0bd91e823e451b) which may get updated sometimes. It shows tests against Golang, C++ and Scala implementations showing the best performance in all cases.82Official benchmark results are available [in this gist](https://gist.github.com/CertainLach/5770d7ad4836066f8e0bd91e823e451b) which may get updated sometimes. It shows tests against Golang, C++ and Scala implementations showing the best performance in all cases.
9683
97You can generate this report via provided nix flake84You can generate this report via provided nix flake
98
99## TO-DO list
100
101- [ ] Create docker container for easier benchmarking and/or benchmark in CI
102- [ ] Implement and utilize mutable strings, arrays and objects instead of COWing when possible
10385