etoon 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- etoon-0.1.0/.github/workflows/ci.yml +53 -0
- etoon-0.1.0/.github/workflows/release.yml +194 -0
- etoon-0.1.0/.gitignore +8 -0
- etoon-0.1.0/ATTRIBUTION.md +20 -0
- etoon-0.1.0/Cargo.lock +556 -0
- etoon-0.1.0/Cargo.toml +35 -0
- etoon-0.1.0/PKG-INFO +124 -0
- etoon-0.1.0/README.md +98 -0
- etoon-0.1.0/README.zh-TW.md +98 -0
- etoon-0.1.0/pyproject.toml +38 -0
- etoon-0.1.0/python/etoon/__init__.py +31 -0
- etoon-0.1.0/src/bin/bench.rs +70 -0
- etoon-0.1.0/src/bin/etoon.rs +92 -0
- etoon-0.1.0/src/lib.rs +20 -0
- etoon-0.1.0/src/toon.rs +429 -0
- etoon-0.1.0/tests/fixtures/encode/arrays-nested.json +105 -0
- etoon-0.1.0/tests/fixtures/encode/arrays-objects.json +158 -0
- etoon-0.1.0/tests/fixtures/encode/arrays-primitive.json +87 -0
- etoon-0.1.0/tests/fixtures/encode/arrays-tabular.json +62 -0
- etoon-0.1.0/tests/fixtures/encode/delimiters.json +253 -0
- etoon-0.1.0/tests/fixtures/encode/key-folding.json +218 -0
- etoon-0.1.0/tests/fixtures/encode/objects.json +220 -0
- etoon-0.1.0/tests/fixtures/encode/primitives.json +251 -0
- etoon-0.1.0/tests/fixtures/encode/whitespace.json +44 -0
- etoon-0.1.0/tests/test_spec_fixtures.py +51 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
name: Test (Linux x86_64)
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
- name: Create virtualenv + install
|
|
19
|
+
run: |
|
|
20
|
+
python -m venv .venv
|
|
21
|
+
. .venv/bin/activate
|
|
22
|
+
pip install maturin pytest
|
|
23
|
+
maturin develop --release
|
|
24
|
+
- name: Run 111 TOON spec fixtures
|
|
25
|
+
run: |
|
|
26
|
+
. .venv/bin/activate
|
|
27
|
+
python -m pytest tests/test_spec_fixtures.py -q
|
|
28
|
+
- name: Build CLI binary
|
|
29
|
+
run: cargo build --release --bin etoon --no-default-features
|
|
30
|
+
- name: Smoke-test CLI
|
|
31
|
+
run: |
|
|
32
|
+
echo '{"a":[1,2,3],"b":"hi"}' | ./target/release/etoon
|
|
33
|
+
./target/release/etoon --help
|
|
34
|
+
|
|
35
|
+
rustfmt:
|
|
36
|
+
name: rustfmt
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
steps:
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
41
|
+
with:
|
|
42
|
+
components: rustfmt
|
|
43
|
+
- run: cargo fmt --all -- --check
|
|
44
|
+
|
|
45
|
+
clippy:
|
|
46
|
+
name: clippy
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
51
|
+
with:
|
|
52
|
+
components: clippy
|
|
53
|
+
- run: cargo clippy --no-default-features --all-targets -- -D warnings
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
tags:
|
|
7
|
+
- "v*"
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
# ========================================================================
|
|
11
|
+
# Build Python wheels for PyPI (Linux, macOS, Windows × x86_64/aarch64)
|
|
12
|
+
# ========================================================================
|
|
13
|
+
wheels-linux:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
target: [x86_64, aarch64]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.x"
|
|
23
|
+
- name: Build wheels
|
|
24
|
+
uses: PyO3/maturin-action@v1
|
|
25
|
+
with:
|
|
26
|
+
target: ${{ matrix.target }}
|
|
27
|
+
manylinux: auto
|
|
28
|
+
args: --release --out dist --interpreter 3.10 3.11 3.12 3.13
|
|
29
|
+
- uses: actions/upload-artifact@v4
|
|
30
|
+
with:
|
|
31
|
+
name: wheels-linux-${{ matrix.target }}
|
|
32
|
+
path: dist
|
|
33
|
+
|
|
34
|
+
wheels-macos:
|
|
35
|
+
runs-on: macos-14
|
|
36
|
+
strategy:
|
|
37
|
+
matrix:
|
|
38
|
+
target: [x86_64, aarch64]
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
- uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version: "3.x"
|
|
44
|
+
- name: Build wheels
|
|
45
|
+
uses: PyO3/maturin-action@v1
|
|
46
|
+
with:
|
|
47
|
+
target: ${{ matrix.target }}
|
|
48
|
+
args: --release --out dist --interpreter 3.10 3.11 3.12 3.13
|
|
49
|
+
- uses: actions/upload-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
name: wheels-macos-${{ matrix.target }}
|
|
52
|
+
path: dist
|
|
53
|
+
|
|
54
|
+
wheels-windows:
|
|
55
|
+
runs-on: windows-latest
|
|
56
|
+
steps:
|
|
57
|
+
- uses: actions/checkout@v4
|
|
58
|
+
- uses: actions/setup-python@v5
|
|
59
|
+
with:
|
|
60
|
+
python-version: "3.x"
|
|
61
|
+
architecture: x64
|
|
62
|
+
- name: Build wheels
|
|
63
|
+
uses: PyO3/maturin-action@v1
|
|
64
|
+
with:
|
|
65
|
+
target: x64
|
|
66
|
+
args: --release --out dist --interpreter 3.10 3.11 3.12 3.13
|
|
67
|
+
- uses: actions/upload-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
name: wheels-windows-x64
|
|
70
|
+
path: dist
|
|
71
|
+
|
|
72
|
+
sdist:
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/checkout@v4
|
|
76
|
+
- name: Build sdist
|
|
77
|
+
uses: PyO3/maturin-action@v1
|
|
78
|
+
with:
|
|
79
|
+
command: sdist
|
|
80
|
+
args: --out dist
|
|
81
|
+
- uses: actions/upload-artifact@v4
|
|
82
|
+
with:
|
|
83
|
+
name: sdist
|
|
84
|
+
path: dist
|
|
85
|
+
|
|
86
|
+
# ========================================================================
|
|
87
|
+
# Build native CLI binaries for GitHub Releases
|
|
88
|
+
# ========================================================================
|
|
89
|
+
cli-binaries:
|
|
90
|
+
strategy:
|
|
91
|
+
matrix:
|
|
92
|
+
include:
|
|
93
|
+
- target: x86_64-unknown-linux-gnu
|
|
94
|
+
os: ubuntu-latest
|
|
95
|
+
name: etoon-linux-x86_64
|
|
96
|
+
- target: aarch64-unknown-linux-gnu
|
|
97
|
+
os: ubuntu-latest
|
|
98
|
+
name: etoon-linux-aarch64
|
|
99
|
+
cross: true
|
|
100
|
+
- target: x86_64-apple-darwin
|
|
101
|
+
os: macos-13
|
|
102
|
+
name: etoon-macos-x86_64
|
|
103
|
+
- target: aarch64-apple-darwin
|
|
104
|
+
os: macos-14
|
|
105
|
+
name: etoon-macos-aarch64
|
|
106
|
+
- target: x86_64-pc-windows-msvc
|
|
107
|
+
os: windows-latest
|
|
108
|
+
name: etoon-windows-x86_64.exe
|
|
109
|
+
runs-on: ${{ matrix.os }}
|
|
110
|
+
steps:
|
|
111
|
+
- uses: actions/checkout@v4
|
|
112
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
113
|
+
with:
|
|
114
|
+
targets: ${{ matrix.target }}
|
|
115
|
+
- name: Install cross (for aarch64 Linux)
|
|
116
|
+
if: matrix.cross
|
|
117
|
+
run: cargo install cross --locked
|
|
118
|
+
- name: Build (native)
|
|
119
|
+
if: '!matrix.cross'
|
|
120
|
+
run: cargo build --release --bin etoon --no-default-features --target ${{ matrix.target }}
|
|
121
|
+
- name: Build (cross)
|
|
122
|
+
if: matrix.cross
|
|
123
|
+
run: cross build --release --bin etoon --no-default-features --target ${{ matrix.target }}
|
|
124
|
+
- name: Rename binary
|
|
125
|
+
shell: bash
|
|
126
|
+
run: |
|
|
127
|
+
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
|
|
128
|
+
cp target/${{ matrix.target }}/release/etoon.exe ${{ matrix.name }}
|
|
129
|
+
else
|
|
130
|
+
cp target/${{ matrix.target }}/release/etoon ${{ matrix.name }}
|
|
131
|
+
fi
|
|
132
|
+
- uses: actions/upload-artifact@v4
|
|
133
|
+
with:
|
|
134
|
+
name: cli-${{ matrix.target }}
|
|
135
|
+
path: ${{ matrix.name }}
|
|
136
|
+
|
|
137
|
+
# ========================================================================
|
|
138
|
+
# Publish to PyPI (on tag push)
|
|
139
|
+
# ========================================================================
|
|
140
|
+
publish-pypi:
|
|
141
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
142
|
+
needs: [wheels-linux, wheels-macos, wheels-windows, sdist]
|
|
143
|
+
runs-on: ubuntu-latest
|
|
144
|
+
steps:
|
|
145
|
+
- uses: actions/download-artifact@v4
|
|
146
|
+
with:
|
|
147
|
+
pattern: "wheels-*"
|
|
148
|
+
path: dist
|
|
149
|
+
merge-multiple: true
|
|
150
|
+
- uses: actions/download-artifact@v4
|
|
151
|
+
with:
|
|
152
|
+
name: sdist
|
|
153
|
+
path: dist
|
|
154
|
+
- name: Publish to PyPI
|
|
155
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
156
|
+
with:
|
|
157
|
+
password: ${{ secrets.PYPI_TOKEN }}
|
|
158
|
+
skip-existing: true
|
|
159
|
+
|
|
160
|
+
# ========================================================================
|
|
161
|
+
# Publish to crates.io (on tag push)
|
|
162
|
+
# Disabled until CARGO_REGISTRY_TOKEN secret is added.
|
|
163
|
+
# ========================================================================
|
|
164
|
+
# publish-crates:
|
|
165
|
+
# if: startsWith(github.ref, 'refs/tags/v')
|
|
166
|
+
# runs-on: ubuntu-latest
|
|
167
|
+
# steps:
|
|
168
|
+
# - uses: actions/checkout@v4
|
|
169
|
+
# - uses: dtolnay/rust-toolchain@stable
|
|
170
|
+
# - name: Publish to crates.io
|
|
171
|
+
# run: cargo publish --no-default-features --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
172
|
+
|
|
173
|
+
# ========================================================================
|
|
174
|
+
# Create GitHub Release with CLI binaries (on tag push)
|
|
175
|
+
# ========================================================================
|
|
176
|
+
github-release:
|
|
177
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
178
|
+
needs: [cli-binaries]
|
|
179
|
+
runs-on: ubuntu-latest
|
|
180
|
+
permissions:
|
|
181
|
+
contents: write
|
|
182
|
+
steps:
|
|
183
|
+
- uses: actions/download-artifact@v4
|
|
184
|
+
with:
|
|
185
|
+
pattern: "cli-*"
|
|
186
|
+
path: cli
|
|
187
|
+
merge-multiple: true
|
|
188
|
+
- name: Create release
|
|
189
|
+
uses: softprops/action-gh-release@v1
|
|
190
|
+
with:
|
|
191
|
+
files: cli/*
|
|
192
|
+
draft: false
|
|
193
|
+
prerelease: false
|
|
194
|
+
generate_release_notes: true
|
etoon-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Attribution
|
|
2
|
+
|
|
3
|
+
## Test Fixtures
|
|
4
|
+
|
|
5
|
+
`tests/fixtures/encode/*.json` are copied from the [toons](https://github.com/alesanfra/toons)
|
|
6
|
+
project by Alessandro Sanfratello, licensed under the Apache License 2.0.
|
|
7
|
+
|
|
8
|
+
These fixtures implement the TOON v1.4 encoding specification test suite.
|
|
9
|
+
No modifications have been made to the fixture contents.
|
|
10
|
+
|
|
11
|
+
## TOON Specification
|
|
12
|
+
|
|
13
|
+
The TOON (Token-Oriented Object Notation) format is defined by the
|
|
14
|
+
[toon-format/toon](https://github.com/toon-format/toon) project (MIT License).
|
|
15
|
+
|
|
16
|
+
## License
|
|
17
|
+
|
|
18
|
+
This project is licensed under the Apache License 2.0, consistent with the
|
|
19
|
+
upstream `toons` project to facilitate fixture reuse and potential contributions
|
|
20
|
+
back to the TOON ecosystem.
|