structtype 0.13.0__tar.gz → 0.14.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.
Files changed (63) hide show
  1. structtype-0.14.0/.opencode/opencode.json +4 -0
  2. {structtype-0.13.0 → structtype-0.14.0}/AGENTS.md +11 -14
  3. {structtype-0.13.0 → structtype-0.14.0}/Makefile +5 -0
  4. {structtype-0.13.0 → structtype-0.14.0}/PKG-INFO +1 -1
  5. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/_core.c +1305 -601
  6. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/_inspect.py +68 -0
  7. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/_json_schema.py +47 -5
  8. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/_version.py +2 -2
  9. {structtype-0.13.0 → structtype-0.14.0}/src/structtype.egg-info/PKG-INFO +1 -1
  10. {structtype-0.13.0 → structtype-0.14.0}/src/structtype.egg-info/SOURCES.txt +2 -1
  11. {structtype-0.13.0 → structtype-0.14.0}/tests/test_adapter.py +14 -0
  12. {structtype-0.13.0 → structtype-0.14.0}/tests/test_annotations.py +23 -2
  13. {structtype-0.13.0 → structtype-0.14.0}/tests/test_check.py +12 -4
  14. {structtype-0.13.0 → structtype-0.14.0}/tests/test_csv.py +22 -0
  15. {structtype-0.13.0 → structtype-0.14.0}/tests/test_inspect.py +14 -0
  16. structtype-0.14.0/tests/test_ipnetwork.py +196 -0
  17. {structtype-0.13.0 → structtype-0.14.0}/tests/test_json.py +191 -0
  18. structtype-0.14.0/tests/test_purepath.py +155 -0
  19. {structtype-0.13.0 → structtype-0.14.0}/tests/test_roundtrip.py +16 -0
  20. {structtype-0.13.0 → structtype-0.14.0}/tests/test_schema.py +63 -0
  21. structtype-0.13.0/.opencode/opencode.json +0 -6
  22. structtype-0.13.0/.opencode/plugins/graphify.js +0 -30
  23. {structtype-0.13.0 → structtype-0.14.0}/LICENSE +0 -0
  24. {structtype-0.13.0 → structtype-0.14.0}/MANIFEST.in +0 -0
  25. {structtype-0.13.0 → structtype-0.14.0}/README.md +0 -0
  26. {structtype-0.13.0 → structtype-0.14.0}/pyproject.toml +0 -0
  27. {structtype-0.13.0 → structtype-0.14.0}/setup.cfg +0 -0
  28. {structtype-0.13.0 → structtype-0.14.0}/setup.py +0 -0
  29. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/__init__.py +0 -0
  30. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/__init__.pyi +0 -0
  31. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/_adapter.py +0 -0
  32. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/_config.py +0 -0
  33. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/_utils.py +0 -0
  34. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/atof.h +0 -0
  35. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/atof_consts.h +0 -0
  36. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/common.h +0 -0
  37. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/itoa.h +0 -0
  38. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/py.typed +0 -0
  39. {structtype-0.13.0 → structtype-0.14.0}/src/structtype/ryu.h +0 -0
  40. {structtype-0.13.0 → structtype-0.14.0}/src/structtype.egg-info/dependency_links.txt +0 -0
  41. {structtype-0.13.0 → structtype-0.14.0}/src/structtype.egg-info/top_level.txt +0 -0
  42. {structtype-0.13.0 → structtype-0.14.0}/tests/__init__.py +0 -0
  43. {structtype-0.13.0 → structtype-0.14.0}/tests/conftest.py +0 -0
  44. {structtype-0.13.0 → structtype-0.14.0}/tests/test_JSONTestSuite.py +0 -0
  45. {structtype-0.13.0 → structtype-0.14.0}/tests/test_attrs.py +0 -0
  46. {structtype-0.13.0 → structtype-0.14.0}/tests/test_constraints.py +0 -0
  47. {structtype-0.13.0 → structtype-0.14.0}/tests/test_cpylint.py +0 -0
  48. {structtype-0.13.0 → structtype-0.14.0}/tests/test_free_threading.py +0 -0
  49. {structtype-0.13.0 → structtype-0.14.0}/tests/test_frozendict.py +0 -0
  50. {structtype-0.13.0 → structtype-0.14.0}/tests/test_memory.py +0 -0
  51. {structtype-0.13.0 → structtype-0.14.0}/tests/test_msgspec.py +0 -0
  52. {structtype-0.13.0 → structtype-0.14.0}/tests/test_pydantic.py +0 -0
  53. {structtype-0.13.0 → structtype-0.14.0}/tests/test_struct.py +0 -0
  54. {structtype-0.13.0 → structtype-0.14.0}/tests/test_struct_meta.py +0 -0
  55. {structtype-0.13.0 → structtype-0.14.0}/tests/test_threading.py +0 -0
  56. {structtype-0.13.0 → structtype-0.14.0}/tests/test_typecheck.py +0 -0
  57. {structtype-0.13.0 → structtype-0.14.0}/tests/test_utils.py +0 -0
  58. {structtype-0.13.0 → structtype-0.14.0}/tests/typecheck/api.py +0 -0
  59. {structtype-0.13.0 → structtype-0.14.0}/tests/typecheck/basic.py +0 -0
  60. {structtype-0.13.0 → structtype-0.14.0}/tests/typecheck/fields.py +0 -0
  61. {structtype-0.13.0 → structtype-0.14.0}/tests/typecheck/types.py +0 -0
  62. {structtype-0.13.0 → structtype-0.14.0}/tests/utils.py +0 -0
  63. {structtype-0.13.0 → structtype-0.14.0}/uv.lock +0 -0
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "plugin": []
4
+ }
@@ -3,7 +3,7 @@
3
3
  ## Project
4
4
 
5
5
  Fast struct validation + JSON serialization for Python.
6
- Core is a monolithic C extension (`src/structtype/_core.c`, ~21K lines).
6
+ Core is a monolithic C extension (`src/structtype/_core.c`, ~22K lines).
7
7
  No runtime deps.
8
8
 
9
9
  ## Setup
@@ -25,16 +25,23 @@ Use `make` targets where available. Targeted tests can be run directly with
25
25
  | Coverage (Python + C) | `make test-cov-c` |
26
26
  | Coverage (Python + C, all Pythons, merged) | `make test-cov-c-all` |
27
27
  | Tests in all supported Pythons | `make test-all` |
28
+ | Doctests | `make test-doc` |
29
+ | Build sdist + wheel | `make build` |
28
30
  | Build docs | `make docs` |
29
31
  | Format | `make format` |
30
32
  | Lint | `make ruff-check` |
31
33
  | Type check | `make type-check` |
32
34
  | Static checks | `make check` |
33
35
 
36
+ Benchmark targets: `make bench`, `make bench-validators`, `make bench-codecs`,
37
+ `make bench-csv-1m`, `make bench-strings` (run sequentially; CPU-bound).
38
+
34
39
  ## Conventions
35
40
 
36
41
  - **88-char lines**, formatted with `ruff format`
37
- - `ruff check` with rules `E`, `F`, `I`, `W`
42
+ - `ruff check` with Ruff's default rule set (the project config sets only
43
+ `target-version` and isort `combine-as-imports`; line length is enforced by
44
+ `ruff format`, not `E501`)
38
45
  - Private modules/functions prefixed with `_`
39
46
  - C code uses `ms_`/`MS_` prefix
40
47
  - Type stubs (`.pyi`) alongside public modules
@@ -59,6 +66,8 @@ Use `make` targets where available. Targeted tests can be run directly with
59
66
  - `obj.struct_check_types()` — validate field values against types + constraints (pure type-check, no conversion)
60
67
  - `cls.struct_validate_json(buf, *, strict=True)` — deserialize from JSON
61
68
  - `cls.struct_validate(obj, *, strict=True, from_attributes=False)` — convert built-in types to struct
69
+ - `obj.struct_dump_csv()` — encode one row as `list[str]` for `csv.writer.writerow()`; flat scalar fields only, positional
70
+ - `cls.struct_validate_csv(row, *, null_values=("",))` — decode one CSV row (sequence of cell strings); always lax
62
71
 
63
72
  ### Dict & Iteration Protocol
64
73
 
@@ -75,15 +84,3 @@ Struct instances support the mapping protocol:
75
84
  - Validation matches keys by the **alias** name only, except `struct_validate(obj, from_attributes=True)` on a **non-dict object**, which matches by both the python field name and the alias. Dict/JSON input (even with `from_attributes=True`) and all dump/serialization use only the alias name.
76
85
  - For `Annotated[MyType, Serializer(load=...)]`, an existing `MyType` instance bypasses `load`; other Python values and JSON representations are passed to `load`. Serializers remain rejected on `Any`, `bool`, `int`, `float`, `str`, `list`, `dict`, `tuple`, `TypedDict`, `NamedTuple`, `frozendict`, and `Literal`. `Serializer` and `Constraint` must attach to a concrete type inside `Annotated` — `Annotated[Union[A, B], ...]` and `Annotated[Optional[T], ...]` are rejected; use `Annotated[T, ...] | None` for optional fields.
77
86
 
78
- ## graphify
79
-
80
- This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships.
81
-
82
- When the user types `/graphify`, use the installed graphify skill or instructions before doing anything else.
83
-
84
- Rules:
85
- - For codebase questions, first run `graphify query "<question>"` when graphify-out/graph.json exists. Use `graphify path "<A>" "<B>"` for relationships and `graphify explain "<concept>"` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output.
86
- - Dirty graphify-out/ files are expected after hooks or incremental updates; dirty graph files are not a reason to skip graphify. Only skip graphify if the task is about stale or incorrect graph output, or the user explicitly says not to use it.
87
- - If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing.
88
- - Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context.
89
- - After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost).
@@ -147,6 +147,10 @@ bench-codecs: ## run Constraint + Serializer heavy benchmarks
147
147
  bench-csv-1m: ## run 1M-row on-disk CSV benchmark
148
148
  uv run -p 3.15 benchmarks/bench_csv_1m.py
149
149
 
150
+ .PHONY: bench-strings
151
+ bench-strings: ## run long-string JSON codec benchmark
152
+ uv run -p 3.15 benchmarks/bench_strings.py
153
+
150
154
  ##@ Utility
151
155
  .PHONY: clean
152
156
  clean: ## Delete all temporary files
@@ -161,6 +165,7 @@ clean: ## Delete all temporary files
161
165
  rm -rf htmlcov-c
162
166
  rm -f .coverage
163
167
  rm -f coverage-c.info coverage-c.info.*
168
+ rm -rf .venv*
164
169
 
165
170
  .PHONY: install
166
171
  install: install-uv ## Install virtual environment
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: structtype
3
- Version: 0.13.0
3
+ Version: 0.14.0
4
4
  Summary: Fast Struct type with validation and JSON serialization for Python.
5
5
  Maintainer-email: Wolfgang Langner <tds333@mailbox.org>
6
6
  License-Expression: BSD-3-Clause