flow-toon-format 0.9.0b2__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.
- flow_toon_format-0.9.0b2/.devcontainer/Dockerfile.dev +27 -0
- flow_toon_format-0.9.0b2/.devcontainer/README.md +120 -0
- flow_toon_format-0.9.0b2/.devcontainer/devcontainer.json +30 -0
- flow_toon_format-0.9.0b2/.devcontainer/devcontainer.local.json.example +32 -0
- flow_toon_format-0.9.0b2/.editorconfig +22 -0
- flow_toon_format-0.9.0b2/.github/CODEOWNERS +8 -0
- flow_toon_format-0.9.0b2/.github/workflows/lint.yml +39 -0
- flow_toon_format-0.9.0b2/.github/workflows/publish.yml +83 -0
- flow_toon_format-0.9.0b2/.github/workflows/test.yml +52 -0
- flow_toon_format-0.9.0b2/.gitignore +110 -0
- flow_toon_format-0.9.0b2/CONTRIBUTING.md +106 -0
- flow_toon_format-0.9.0b2/LICENSE +24 -0
- flow_toon_format-0.9.0b2/PKG-INFO +200 -0
- flow_toon_format-0.9.0b2/PUBLISHING.md +212 -0
- flow_toon_format-0.9.0b2/README.md +172 -0
- flow_toon_format-0.9.0b2/docs/README.md +140 -0
- flow_toon_format-0.9.0b2/docs/api.md +447 -0
- flow_toon_format-0.9.0b2/docs/format.md +672 -0
- flow_toon_format-0.9.0b2/docs/llm-integration.md +623 -0
- flow_toon_format-0.9.0b2/pyproject.toml +97 -0
- flow_toon_format-0.9.0b2/src/toon_format/__init__.py +40 -0
- flow_toon_format-0.9.0b2/src/toon_format/__main__.py +13 -0
- flow_toon_format-0.9.0b2/src/toon_format/_literal_utils.py +70 -0
- flow_toon_format-0.9.0b2/src/toon_format/_parsing_utils.py +167 -0
- flow_toon_format-0.9.0b2/src/toon_format/_scanner.py +289 -0
- flow_toon_format-0.9.0b2/src/toon_format/_string_utils.py +169 -0
- flow_toon_format-0.9.0b2/src/toon_format/_validation.py +150 -0
- flow_toon_format-0.9.0b2/src/toon_format/cli.py +217 -0
- flow_toon_format-0.9.0b2/src/toon_format/constants.py +84 -0
- flow_toon_format-0.9.0b2/src/toon_format/decoder.py +788 -0
- flow_toon_format-0.9.0b2/src/toon_format/encoder.py +56 -0
- flow_toon_format-0.9.0b2/src/toon_format/encoders.py +456 -0
- flow_toon_format-0.9.0b2/src/toon_format/logging_config.py +92 -0
- flow_toon_format-0.9.0b2/src/toon_format/normalize.py +237 -0
- flow_toon_format-0.9.0b2/src/toon_format/primitives.py +171 -0
- flow_toon_format-0.9.0b2/src/toon_format/py.typed +0 -0
- flow_toon_format-0.9.0b2/src/toon_format/types.py +64 -0
- flow_toon_format-0.9.0b2/src/toon_format/utils.py +187 -0
- flow_toon_format-0.9.0b2/src/toon_format/writer.py +53 -0
- flow_toon_format-0.9.0b2/tests/README.md +218 -0
- flow_toon_format-0.9.0b2/tests/__init__.py +1 -0
- flow_toon_format-0.9.0b2/tests/conftest.py +122 -0
- flow_toon_format-0.9.0b2/tests/fixtures/decode/arrays-nested.json +194 -0
- flow_toon_format-0.9.0b2/tests/fixtures/decode/arrays-primitive.json +111 -0
- flow_toon_format-0.9.0b2/tests/fixtures/decode/arrays-tabular.json +51 -0
- flow_toon_format-0.9.0b2/tests/fixtures/decode/blank-lines.json +153 -0
- flow_toon_format-0.9.0b2/tests/fixtures/decode/delimiters.json +237 -0
- flow_toon_format-0.9.0b2/tests/fixtures/decode/indentation-errors.json +197 -0
- flow_toon_format-0.9.0b2/tests/fixtures/decode/objects.json +238 -0
- flow_toon_format-0.9.0b2/tests/fixtures/decode/primitives.json +189 -0
- flow_toon_format-0.9.0b2/tests/fixtures/decode/validation-errors.json +63 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/arrays-nested.json +99 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/arrays-objects.json +138 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/arrays-primitive.json +87 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/arrays-tabular.json +62 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/delimiters.json +253 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/normalization.json +107 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/objects.json +220 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/options.json +88 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/primitives.json +226 -0
- flow_toon_format-0.9.0b2/tests/fixtures/encode/whitespace.json +29 -0
- flow_toon_format-0.9.0b2/tests/fixtures.schema.json +106 -0
- flow_toon_format-0.9.0b2/tests/test_api.py +288 -0
- flow_toon_format-0.9.0b2/tests/test_cli.py +329 -0
- flow_toon_format-0.9.0b2/tests/test_decoder.py +142 -0
- flow_toon_format-0.9.0b2/tests/test_encoder.py +200 -0
- flow_toon_format-0.9.0b2/tests/test_internationalization.py +299 -0
- flow_toon_format-0.9.0b2/tests/test_normalization.py +418 -0
- flow_toon_format-0.9.0b2/tests/test_normalize_functions.py +321 -0
- flow_toon_format-0.9.0b2/tests/test_parsing_utils.py +331 -0
- flow_toon_format-0.9.0b2/tests/test_scanner.py +243 -0
- flow_toon_format-0.9.0b2/tests/test_security.py +304 -0
- flow_toon_format-0.9.0b2/tests/test_spec_fixtures.py +204 -0
- flow_toon_format-0.9.0b2/tests/test_string_utils.py +209 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
ARG UV_VERSION=0.8.13
|
|
2
|
+
|
|
3
|
+
FROM ghcr.io/astral-sh/uv:${UV_VERSION} AS uv
|
|
4
|
+
|
|
5
|
+
FROM mcr.microsoft.com/devcontainers/base:bookworm
|
|
6
|
+
|
|
7
|
+
COPY --from=uv /uv /uvx /bin/
|
|
8
|
+
|
|
9
|
+
# Python environment variables for development
|
|
10
|
+
ENV PYTHONUNBUFFERED=1 \
|
|
11
|
+
PYTHONDONTWRITEBYTECODE=1 \
|
|
12
|
+
PYTHONIOENCODING=utf-8 \
|
|
13
|
+
PIP_NO_CACHE_DIR=1 \
|
|
14
|
+
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
15
|
+
UV_NO_CACHE=1 \
|
|
16
|
+
UV_PROJECT_ENVIRONMENT=/app/.venv \
|
|
17
|
+
LANG=C.UTF-8 \
|
|
18
|
+
LC_ALL=C.UTF-8
|
|
19
|
+
|
|
20
|
+
USER vscode
|
|
21
|
+
|
|
22
|
+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
23
|
+
|
|
24
|
+
WORKDIR /app
|
|
25
|
+
|
|
26
|
+
HEALTHCHECK --interval=60s --timeout=5s --start-period=60s --retries=3 \
|
|
27
|
+
CMD test -d /app && whoami || exit 1
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Development Container
|
|
2
|
+
|
|
3
|
+
This project uses a [Development Container](https://containers.dev/) to provide a consistent development environment.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. Install [Docker Desktop](https://www.docker.com/products/docker-desktop)
|
|
8
|
+
2. Install [VS Code](https://code.visualstudio.com/) and the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
|
|
9
|
+
3. Open this folder in VS Code
|
|
10
|
+
4. When prompted, click "Reopen in Container" (or run command: `Dev Containers: Reopen in Container`)
|
|
11
|
+
|
|
12
|
+
## Local Customization
|
|
13
|
+
|
|
14
|
+
To customize your local development environment without modifying the committed configuration, create a `.devcontainer/devcontainer.local.json` file (this file is gitignored).
|
|
15
|
+
|
|
16
|
+
### Example: Add Additional VS Code Extensions
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"customizations": {
|
|
21
|
+
"vscode": {
|
|
22
|
+
"extensions": [
|
|
23
|
+
"esbenp.prettier-vscode",
|
|
24
|
+
"usernamehw.errorlens"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Example: Mount Additional Volumes
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mounts": [
|
|
36
|
+
"source=${localEnv:HOME}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,consistency=cached"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Example: Override or Add Environment Variables
|
|
42
|
+
|
|
43
|
+
The container sets several Python-related environment variables by default (see `Dockerfile.dev`). You can override them or add new ones using `remoteEnv`:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"remoteEnv": {
|
|
48
|
+
"PYTHONUNBUFFERED": "0",
|
|
49
|
+
"DEBUG": "1",
|
|
50
|
+
"LOG_LEVEL": "DEBUG"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
See `devcontainer.local.json.example` for a complete list of default environment variables that can be overridden.
|
|
56
|
+
|
|
57
|
+
Alternatively, create a `.devcontainer/.env` file (also gitignored):
|
|
58
|
+
```bash
|
|
59
|
+
DEBUG=1
|
|
60
|
+
LOG_LEVEL=DEBUG
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
And reference it in `devcontainer.local.json`:
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"runArgs": ["--env-file", ".devcontainer/.env"]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Example: Forward Additional Ports
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"forwardPorts": [8080, 3000]
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## How It Works
|
|
79
|
+
|
|
80
|
+
The Dev Container will:
|
|
81
|
+
- Build from `Dockerfile.dev`
|
|
82
|
+
- Mount your workspace to `/app`
|
|
83
|
+
- Install Git and GitHub CLI features
|
|
84
|
+
- Run `uv sync --all-groups` to create a virtual environment at `/app/.venv`
|
|
85
|
+
- Configure VS Code to use the virtual environment's Python interpreter
|
|
86
|
+
- Set up bash as the default terminal
|
|
87
|
+
|
|
88
|
+
### Default Environment Variables
|
|
89
|
+
|
|
90
|
+
The following Python-related environment variables are set in the container:
|
|
91
|
+
|
|
92
|
+
- **`PYTHONUNBUFFERED=1`** - Ensures real-time output in logs
|
|
93
|
+
- **`PYTHONDONTWRITEBYTECODE=1`** - Prevents `.pyc` file creation
|
|
94
|
+
- **`PYTHONIOENCODING=utf-8`** - Ensures UTF-8 encoding for I/O
|
|
95
|
+
- **`PIP_NO_CACHE_DIR=1`** - Disables pip caching to reduce container size
|
|
96
|
+
- **`PIP_DISABLE_PIP_VERSION_CHECK=1`** - Suppresses pip update warnings
|
|
97
|
+
- **`UV_NO_CACHE=1`** - Disables uv caching
|
|
98
|
+
- **`UV_PROJECT_ENVIRONMENT=/app/.venv`** - Sets the virtual environment location for uv
|
|
99
|
+
- **`LANG=C.UTF-8`** - Sets locale for proper Unicode handling
|
|
100
|
+
- **`LC_ALL=C.UTF-8`** - Sets all locale categories to UTF-8
|
|
101
|
+
|
|
102
|
+
These can be overridden in `devcontainer.local.json` using the `remoteEnv` property.
|
|
103
|
+
|
|
104
|
+
### Virtual Environment
|
|
105
|
+
|
|
106
|
+
The project uses `uv` to manage dependencies. When the container is created:
|
|
107
|
+
1. `uv sync --all-groups` is automatically run to create a virtual environment at `/app/.venv`
|
|
108
|
+
2. VS Code is configured to use `/app/.venv/bin/python` as the Python interpreter
|
|
109
|
+
3. All dependencies from `pyproject.toml` (including dev groups) are installed
|
|
110
|
+
|
|
111
|
+
To manually update dependencies, run:
|
|
112
|
+
```bash
|
|
113
|
+
uv sync --all-groups
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Rebuilding the Container
|
|
117
|
+
|
|
118
|
+
If you modify the Dockerfile or devcontainer configuration:
|
|
119
|
+
1. Run command: `Dev Containers: Rebuild Container`
|
|
120
|
+
2. Or run: `Dev Containers: Rebuild Container Without Cache` for a clean build
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
// To customize this for your local environment without committing changes,
|
|
3
|
+
// create a .devcontainer/devcontainer.local.json file (it's gitignored).
|
|
4
|
+
// See .devcontainer/README.md for examples.
|
|
5
|
+
"name": "toon-python (devcontainer)",
|
|
6
|
+
"build": {
|
|
7
|
+
"dockerfile": "Dockerfile.dev",
|
|
8
|
+
"context": ".."
|
|
9
|
+
},
|
|
10
|
+
"workspaceFolder": "/app",
|
|
11
|
+
"mounts": [
|
|
12
|
+
"source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached"
|
|
13
|
+
],
|
|
14
|
+
"features": {
|
|
15
|
+
"ghcr.io/devcontainers/features/git:1": {},
|
|
16
|
+
"ghcr.io/devcontainers/features/github-cli:1": {}
|
|
17
|
+
},
|
|
18
|
+
"remoteEnv": {
|
|
19
|
+
// Python environment variables (can be overridden in devcontainer.local.json)
|
|
20
|
+
// These supplement the ENV vars set in Dockerfile.dev
|
|
21
|
+
},
|
|
22
|
+
"postCreateCommand": "uv sync --all-groups",
|
|
23
|
+
"customizations": {
|
|
24
|
+
"vscode": {
|
|
25
|
+
"settings": {
|
|
26
|
+
"python.defaultInterpreterPath": "/app/.venv/bin/python"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Example local devcontainer configuration
|
|
3
|
+
// Copy this to devcontainer.local.json and customize as needed
|
|
4
|
+
// This file is gitignored and won't be committed
|
|
5
|
+
|
|
6
|
+
"remoteEnv": {
|
|
7
|
+
// Override Python environment variables
|
|
8
|
+
// Uncomment and modify any of these to override defaults from Dockerfile.dev:
|
|
9
|
+
|
|
10
|
+
// "PYTHONUNBUFFERED": "0",
|
|
11
|
+
// "PYTHONDONTWRITEBYTECODE": "0",
|
|
12
|
+
// "PYTHONIOENCODING": "utf-8",
|
|
13
|
+
// "PIP_NO_CACHE_DIR": "0",
|
|
14
|
+
// "PIP_DISABLE_PIP_VERSION_CHECK": "0",
|
|
15
|
+
// "UV_NO_CACHE": "0",
|
|
16
|
+
// "UV_PROJECT_ENVIRONMENT": "/custom/path/.venv",
|
|
17
|
+
// "LANG": "en_US.UTF-8",
|
|
18
|
+
// "LC_ALL": "en_US.UTF-8",
|
|
19
|
+
|
|
20
|
+
// Add custom environment variables for local development:
|
|
21
|
+
// "DEBUG": "1",
|
|
22
|
+
// "LOG_LEVEL": "DEBUG"
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
// You can also override other devcontainer settings:
|
|
26
|
+
// "features": {},
|
|
27
|
+
// "customizations": {
|
|
28
|
+
// "vscode": {
|
|
29
|
+
// "extensions": []
|
|
30
|
+
// }
|
|
31
|
+
// }
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
charset = utf-8
|
|
5
|
+
end_of_line = lf
|
|
6
|
+
insert_final_newline = true
|
|
7
|
+
trim_trailing_whitespace = true
|
|
8
|
+
|
|
9
|
+
[*.{py,pyi}]
|
|
10
|
+
indent_style = space
|
|
11
|
+
indent_size = 4
|
|
12
|
+
|
|
13
|
+
[*.{yml,yaml}]
|
|
14
|
+
indent_style = space
|
|
15
|
+
indent_size = 2
|
|
16
|
+
|
|
17
|
+
[*.{json,toml}]
|
|
18
|
+
indent_style = space
|
|
19
|
+
indent_size = 2
|
|
20
|
+
|
|
21
|
+
[*.md]
|
|
22
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
name: Lint and Type Check
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v5
|
|
16
|
+
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v7
|
|
19
|
+
with:
|
|
20
|
+
enable-cache: true
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v6
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
uv sync
|
|
30
|
+
uv pip install ruff mypy pytest
|
|
31
|
+
|
|
32
|
+
- name: Run ruff check
|
|
33
|
+
run: uv run ruff check src/ tests/
|
|
34
|
+
|
|
35
|
+
- name: Run ruff format check
|
|
36
|
+
run: uv run ruff format --check src/ tests/
|
|
37
|
+
|
|
38
|
+
- name: Run mypy
|
|
39
|
+
run: uv run mypy src/
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
name: Build distribution
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v5
|
|
18
|
+
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
uses: actions/setup-python@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.x"
|
|
23
|
+
|
|
24
|
+
- name: Install build dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install build twine
|
|
28
|
+
|
|
29
|
+
- name: Build package
|
|
30
|
+
run: python -m build
|
|
31
|
+
|
|
32
|
+
- name: Check package
|
|
33
|
+
run: twine check dist/*
|
|
34
|
+
|
|
35
|
+
- name: Store distribution packages
|
|
36
|
+
uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: python-package-distributions
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
publish-to-pypi:
|
|
42
|
+
name: Publish to PyPI
|
|
43
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
44
|
+
needs: build
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
environment:
|
|
47
|
+
name: pypi
|
|
48
|
+
url: https://pypi.org/p/toon_format
|
|
49
|
+
permissions:
|
|
50
|
+
id-token: write
|
|
51
|
+
|
|
52
|
+
steps:
|
|
53
|
+
- name: Download distributions
|
|
54
|
+
uses: actions/download-artifact@v4
|
|
55
|
+
with:
|
|
56
|
+
name: python-package-distributions
|
|
57
|
+
path: dist/
|
|
58
|
+
|
|
59
|
+
- name: Publish to PyPI
|
|
60
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
61
|
+
|
|
62
|
+
publish-to-testpypi:
|
|
63
|
+
name: Publish to TestPyPI
|
|
64
|
+
if: github.event_name == 'workflow_dispatch'
|
|
65
|
+
needs: build
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
environment:
|
|
68
|
+
name: testpypi
|
|
69
|
+
url: https://test.pypi.org/p/toon_format
|
|
70
|
+
permissions:
|
|
71
|
+
id-token: write
|
|
72
|
+
|
|
73
|
+
steps:
|
|
74
|
+
- name: Download distributions
|
|
75
|
+
uses: actions/download-artifact@v4
|
|
76
|
+
with:
|
|
77
|
+
name: python-package-distributions
|
|
78
|
+
path: dist/
|
|
79
|
+
|
|
80
|
+
- name: Publish to TestPyPI
|
|
81
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
82
|
+
with:
|
|
83
|
+
repository-url: https://test.pypi.org/legacy/
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
name: Test Python ${{ matrix.python-version }}
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v5
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v7
|
|
22
|
+
with:
|
|
23
|
+
enable-cache: true
|
|
24
|
+
|
|
25
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
26
|
+
uses: actions/setup-python@v6
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ matrix.python-version }}
|
|
29
|
+
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: uv sync
|
|
32
|
+
|
|
33
|
+
- name: Run tests with coverage
|
|
34
|
+
run: uv run pytest --cov=toon_format --cov-report=xml --cov-report=term --cov-report=html --cov-fail-under=85
|
|
35
|
+
|
|
36
|
+
- name: Upload coverage reports as artifact
|
|
37
|
+
uses: actions/upload-artifact@v4
|
|
38
|
+
if: matrix.python-version == '3.12'
|
|
39
|
+
with:
|
|
40
|
+
name: coverage-reports
|
|
41
|
+
path: |
|
|
42
|
+
coverage.xml
|
|
43
|
+
htmlcov/
|
|
44
|
+
retention-days: 30
|
|
45
|
+
|
|
46
|
+
- name: Coverage comment on PR
|
|
47
|
+
uses: py-cov-action/python-coverage-comment-action@v3
|
|
48
|
+
if: matrix.python-version == '3.12' && github.event_name == 'pull_request'
|
|
49
|
+
with:
|
|
50
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
51
|
+
MINIMUM_GREEN: 90
|
|
52
|
+
MINIMUM_ORANGE: 85
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# Package-specific
|
|
31
|
+
toon_format.egg-info/
|
|
32
|
+
|
|
33
|
+
# Ruff cache
|
|
34
|
+
.ruff_cache/
|
|
35
|
+
|
|
36
|
+
# Mypy cache
|
|
37
|
+
.mypy_cache/
|
|
38
|
+
.dmypy.json
|
|
39
|
+
dmypy.json
|
|
40
|
+
|
|
41
|
+
# PyInstaller
|
|
42
|
+
*.manifest
|
|
43
|
+
*.spec
|
|
44
|
+
|
|
45
|
+
# Unit test / coverage reports
|
|
46
|
+
htmlcov/
|
|
47
|
+
.tox/
|
|
48
|
+
.nox/
|
|
49
|
+
.coverage
|
|
50
|
+
.coverage.*
|
|
51
|
+
.cache
|
|
52
|
+
nosetests.xml
|
|
53
|
+
coverage.xml
|
|
54
|
+
*.cover
|
|
55
|
+
*.py,cover
|
|
56
|
+
.hypothesis/
|
|
57
|
+
.pytest_cache/
|
|
58
|
+
|
|
59
|
+
# Environments
|
|
60
|
+
.env
|
|
61
|
+
.venv
|
|
62
|
+
env/
|
|
63
|
+
venv/
|
|
64
|
+
ENV/
|
|
65
|
+
env.bak/
|
|
66
|
+
venv.bak/
|
|
67
|
+
.python-version
|
|
68
|
+
|
|
69
|
+
# IDEs
|
|
70
|
+
.vscode/
|
|
71
|
+
.idea/
|
|
72
|
+
*.swp
|
|
73
|
+
*.swo
|
|
74
|
+
*~
|
|
75
|
+
.claude/
|
|
76
|
+
CLAUDE.md
|
|
77
|
+
|
|
78
|
+
# DevContainer local overrides
|
|
79
|
+
.devcontainer/devcontainer.local.json
|
|
80
|
+
.devcontainer/.env
|
|
81
|
+
|
|
82
|
+
# macOS
|
|
83
|
+
.DS_Store
|
|
84
|
+
.AppleDouble
|
|
85
|
+
.LSOverride
|
|
86
|
+
._*
|
|
87
|
+
|
|
88
|
+
# Files that might appear in the root of a volume
|
|
89
|
+
.DocumentRevisions-V100
|
|
90
|
+
.fseventsd
|
|
91
|
+
.Spotlight-V100
|
|
92
|
+
.TemporaryItems
|
|
93
|
+
.Trashes
|
|
94
|
+
.VolumeIcon.icns
|
|
95
|
+
.com.apple.timemachine.donotpresent
|
|
96
|
+
|
|
97
|
+
# Directories potentially created on remote AFP share
|
|
98
|
+
.AppleDB
|
|
99
|
+
.AppleDesktop
|
|
100
|
+
Network Trash Folder
|
|
101
|
+
Temporary Items
|
|
102
|
+
.apdisk
|
|
103
|
+
|
|
104
|
+
# uv
|
|
105
|
+
.uv/
|
|
106
|
+
uv.lock
|
|
107
|
+
|
|
108
|
+
PR_DESCRIPTION.md
|
|
109
|
+
AGENTS.md
|
|
110
|
+
.augment/
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Contributing to toon-python
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to the official Python implementation of TOON!
|
|
4
|
+
|
|
5
|
+
## Project Setup
|
|
6
|
+
|
|
7
|
+
This project uses [`uv`](https://github.com/astral-sh/uv) for dependency management.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Clone the repository
|
|
11
|
+
git clone https://github.com/toon-format/toon-python.git
|
|
12
|
+
cd toon-python
|
|
13
|
+
|
|
14
|
+
# Install dependencies (uv will create a virtual environment automatically)
|
|
15
|
+
uv sync
|
|
16
|
+
|
|
17
|
+
# Run tests
|
|
18
|
+
uv run pytest
|
|
19
|
+
|
|
20
|
+
# Run tests with coverage
|
|
21
|
+
uv run pytest --cov=src/toon_format --cov-report=term-missing
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Development Workflow
|
|
25
|
+
|
|
26
|
+
1. **Fork the repository** and create a feature branch
|
|
27
|
+
2. **Make your changes** following the coding standards below
|
|
28
|
+
3. **Add tests** for any new functionality
|
|
29
|
+
4. **Ensure all tests pass** and coverage remains high
|
|
30
|
+
5. **Submit a pull request** with a clear description
|
|
31
|
+
|
|
32
|
+
## Coding Standards
|
|
33
|
+
|
|
34
|
+
### Python Version Support
|
|
35
|
+
|
|
36
|
+
We support Python 3.8 and above (including Python 3.13 and 3.14).
|
|
37
|
+
|
|
38
|
+
### Type Safety
|
|
39
|
+
|
|
40
|
+
- All code must include type hints
|
|
41
|
+
- Run `mypy` before committing:
|
|
42
|
+
```bash
|
|
43
|
+
uv run mypy src/
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Code Style
|
|
47
|
+
|
|
48
|
+
- We use `ruff` for linting and formatting
|
|
49
|
+
- Run before committing:
|
|
50
|
+
```bash
|
|
51
|
+
uv run ruff check src/ tests/
|
|
52
|
+
uv run ruff format src/ tests/
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Testing
|
|
56
|
+
|
|
57
|
+
- All new features must include tests
|
|
58
|
+
- Maintain test coverage at **85%+ line coverage**
|
|
59
|
+
- Tests should cover edge cases and spec compliance
|
|
60
|
+
- Run the full test suite:
|
|
61
|
+
```bash
|
|
62
|
+
uv run pytest tests/
|
|
63
|
+
|
|
64
|
+
# Run with coverage report
|
|
65
|
+
uv run pytest --cov=toon_format --cov-report=term --cov-fail-under=85
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## SPEC Compliance
|
|
69
|
+
|
|
70
|
+
All implementations must comply with the [TOON specification](https://github.com/toon-format/spec/blob/main/SPEC.md).
|
|
71
|
+
|
|
72
|
+
Before submitting changes that affect encoding/decoding behavior:
|
|
73
|
+
1. Verify against the official SPEC.md
|
|
74
|
+
2. Add tests for the specific spec sections you're implementing
|
|
75
|
+
3. Document any spec version requirements
|
|
76
|
+
|
|
77
|
+
## Pull Request Guidelines
|
|
78
|
+
|
|
79
|
+
- **Title**: Use a clear, descriptive title
|
|
80
|
+
- **Description**: Explain what changes you made and why
|
|
81
|
+
- **Tests**: Include tests for your changes
|
|
82
|
+
- **Documentation**: Update README or documentation if needed
|
|
83
|
+
- **Commits**: Use clear commit messages ([Conventional Commits](https://www.conventionalcommits.org/) preferred)
|
|
84
|
+
|
|
85
|
+
Your pull request will use our standard template which guides you through the required information.
|
|
86
|
+
|
|
87
|
+
## Communication
|
|
88
|
+
|
|
89
|
+
- **GitHub Issues**: For bug reports and feature requests
|
|
90
|
+
- **GitHub Discussions**: For questions and general discussion
|
|
91
|
+
- **Pull Requests**: For code reviews and implementation discussion
|
|
92
|
+
|
|
93
|
+
## Maintainers
|
|
94
|
+
|
|
95
|
+
This is a collaborative project. Current maintainers:
|
|
96
|
+
|
|
97
|
+
- [@xaviviro](https://github.com/xaviviro)
|
|
98
|
+
- [@davidpirogov](https://github.com/davidpirogov)
|
|
99
|
+
- [@bpradana](https://github.com/bpradana)
|
|
100
|
+
- [@Justar96](https://github.com/Justar96)
|
|
101
|
+
|
|
102
|
+
All maintainers have equal and consensual decision-making power. For major architectural decisions, please open a discussion issue first.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-PRESENT Xavi Vinaixa
|
|
4
|
+
Copyright (c) 2025-PRESENT David Pirogov
|
|
5
|
+
Copyright (c) 2025-PRESENT Justar
|
|
6
|
+
Copyright (c) 2025-PRESENT Johann Schopplich
|
|
7
|
+
|
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
+
in the Software without restriction, including without limitation the rights
|
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
furnished to do so, subject to the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
SOFTWARE.
|