typedframes 0.14.0__tar.gz → 0.14.2__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 (72) hide show
  1. {typedframes-0.14.0 → typedframes-0.14.2}/PKG-INFO +20 -13
  2. {typedframes-0.14.0 → typedframes-0.14.2}/README.md +19 -12
  3. {typedframes-0.14.0 → typedframes-0.14.2}/pyproject.toml +6 -4
  4. {typedframes-0.14.0 → typedframes-0.14.2}/rust/Cargo.lock +79 -2
  5. {typedframes-0.14.0 → typedframes-0.14.2}/rust/Cargo.toml +13 -5
  6. typedframes-0.14.2/rust/python/Cargo.toml +23 -0
  7. typedframes-0.14.2/rust/python/build.rs +4 -0
  8. typedframes-0.14.2/rust/python/src/lib.rs +27 -0
  9. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/args.rs +10 -3
  10. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/check.rs +25 -10
  11. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/config.rs +128 -33
  12. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/coverage.rs +4 -5
  13. typedframes-0.14.2/rust/src/cli/mod.rs +178 -0
  14. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/report.rs +38 -7
  15. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/sql.rs +96 -20
  16. {typedframes-0.14.0 → typedframes-0.14.2}/rust/tests/cli.rs +20 -0
  17. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/__init__.py +1 -1
  18. typedframes-0.14.2/src/typedframes/_binary.py +115 -0
  19. typedframes-0.14.2/src/typedframes/_rust.pyi +2 -0
  20. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/mypy.py +1 -1
  21. typedframes-0.14.0/rust/src/cli/mod.rs +0 -62
  22. typedframes-0.14.0/src/typedframes/_binary.py +0 -57
  23. {typedframes-0.14.0 → typedframes-0.14.2}/.cargo/config.toml +0 -0
  24. {typedframes-0.14.0 → typedframes-0.14.2}/LICENSE +0 -0
  25. {typedframes-0.14.0 → typedframes-0.14.2}/rust/README.md +0 -0
  26. {typedframes-0.14.0 → typedframes-0.14.2}/rust/benches/parser_bench.rs +0 -0
  27. {typedframes-0.14.0 → typedframes-0.14.2}/rust/build.rs +0 -0
  28. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/apply.rs +0 -0
  29. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/ast_extract.rs +0 -0
  30. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/call_usage.rs +0 -0
  31. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/cache.rs +0 -0
  32. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/collect.rs +0 -0
  33. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/pathutil.rs +0 -0
  34. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/pyfmt.rs +0 -0
  35. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/style.rs +0 -0
  36. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/cli/suggest.rs +0 -0
  37. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/column_consuming_methods.rs +0 -0
  38. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/column_usage.rs +0 -0
  39. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/config.rs +0 -0
  40. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/constants.rs +0 -0
  41. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/contract.rs +0 -0
  42. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/engine.rs +0 -0
  43. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/errors.rs +0 -0
  44. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/fast_hash.rs +0 -0
  45. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/frame_ops.rs +0 -0
  46. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/helpers.rs +0 -0
  47. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/index.rs +0 -0
  48. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/lib.rs +0 -0
  49. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/library_names.txt +0 -0
  50. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/linter.rs +0 -0
  51. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/main.rs +0 -0
  52. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/notebook.rs +0 -0
  53. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/parallel.rs +0 -0
  54. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/phrase.rs +0 -0
  55. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/report.rs +0 -0
  56. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/report_minimize.rs +0 -0
  57. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/report_names.rs +0 -0
  58. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/static_eval.rs +0 -0
  59. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/suggest.rs +0 -0
  60. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/typo.rs +0 -0
  61. {typedframes-0.14.0 → typedframes-0.14.2}/rust/src/words.txt +0 -0
  62. {typedframes-0.14.0 → typedframes-0.14.2}/rust/tests/integration_test.rs +0 -0
  63. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/__main__.py +0 -0
  64. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/base_schema.py +0 -0
  65. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/column.py +0 -0
  66. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/column_group.py +0 -0
  67. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/column_group_error.py +0 -0
  68. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/column_set.py +0 -0
  69. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/missing_dependency_error.py +0 -0
  70. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/pandera.py +0 -0
  71. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/py.typed +0 -0
  72. {typedframes-0.14.0 → typedframes-0.14.2}/src/typedframes/schema_algebra.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: typedframes
3
- Version: 0.14.0
3
+ Version: 0.14.2
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -44,7 +44,7 @@ Project-URL: Repository, https://github.com/w-martin/typedframes
44
44
 
45
45
  > ⚠️ **Project Status: Proof of Concept**
46
46
  >
47
- > `typedframes` (v0.14.0) is currently an experimental proof-of-concept. The core static analysis and mypy/Rust
47
+ > `typedframes` (v0.14.2) is currently an experimental proof-of-concept. The core static analysis and mypy/Rust
48
48
  > integrations work, but expect rough edges. The codebase prioritizes demonstrating the viability of static DataFrame
49
49
  > column checking over production-grade stability.
50
50
  >
@@ -140,6 +140,13 @@ pip install typedframes[pandas] # includes pandas
140
140
  pip install typedframes[polars] # includes polars
141
141
  ```
142
142
 
143
+ Where the Python interpreter may run code but no other executable may be started, set `TYPEDFRAMES_INPROC=1`. Then
144
+ `python -m typedframes` and the mypy plugin run the same checker inside the interpreter, through an extension module in
145
+ the wheel, instead of starting the `typedframes` executable. Results and exit status are the same; when the checker is
146
+ asked to capture its output (as the mypy plugin does), a usage error or a missing path comes back with it, and any
147
+ warning a command prints still goes to the terminal. Without the extension installed (for example from a source
148
+ distribution) `TYPEDFRAMES_INPROC=1` is an error.
149
+
143
150
  ---
144
151
 
145
152
  ## Quick Start
@@ -507,7 +514,7 @@ repos:
507
514
  name: typedframes check
508
515
  entry: typedframes check . --strict
509
516
  language: python
510
- additional_dependencies: ["typedframes==0.14.0"]
517
+ additional_dependencies: ["typedframes==0.14.2"]
511
518
  types_or: [python, jupyter]
512
519
  pass_filenames: false
513
520
  ```
@@ -556,7 +563,7 @@ The action installs the PyPI wheel into a throwaway virtualenv and runs the chec
556
563
  | Input | Default | |
557
564
  |-------|---------|-|
558
565
  | `path` | `.` | File or directory to check |
559
- | `version` | `latest` | PyPI version to install, e.g. `"0.14.0"` |
566
+ | `version` | `latest` | PyPI version to install, e.g. `"0.14.2"` |
560
567
  | `strict` | `true` | Fail the step on errors — `typedframes check` exits 0 without it |
561
568
  | `coverage-fail-under` | *(unset)* | Minimum DataFrame schema coverage, e.g. `"90"` |
562
569
  | `coverage-detail` | `summary` | Or `term-missing` for the per-file breakdown, `explain` to diagnose a lower-than-expected total |
@@ -584,7 +591,7 @@ and the files are written together or not at all. See the
584
591
 
585
592
  If `check` or `suggest` gets a site wrong and the code can't be shared, `typedframes report quiet-amber src/` prints a
586
593
  bug-report body with a redacted copy of the code around that site, checked against the checker so it reproduces the same
587
- result. `typedframes report --all src/` does this for every untyped site, grouped by why the checker decided as it did.
594
+ result. `typedframes report --all src/` does this for every untyped site, grouped by why the checker decided as it did; add `--format compact` for a few lines per group that fit in one screenshot.
588
595
  Redacted is not anonymous: read it before posting, and don't use it on code you aren't allowed to share. See
589
596
  [Reporting a problem](docs/usage.md#reporting-a-problem-report), and
590
597
  [Security and data handling](docs/security.md) for what the tool reads, writes and connects to.
@@ -696,17 +703,17 @@ plus the requested features, so both halves get checked normally. See
696
703
  Fast feedback reduces development time. The typedframes Rust binary provides near-instant column checking.
697
704
 
698
705
  **Benchmark results** (median of 5 runs ± one standard deviation, 3 warmup, caches cleared between runs):
699
- *2026-10-13 · Darwin 27.0.0 · arm · CPython 3.15.0 · 64GiB RAM · Great Expectations pinned @ 1.23.2*
706
+ *2026-10-18 · Darwin 27.0.0 · arm · CPython 3.15.0 · 64GiB RAM · Great Expectations pinned @ 1.23.2*
700
707
 
701
708
  | Tool | Version | What it does | typedframes (12 files) | great_expectations (494 files) |
702
709
  |------|---------|--------------|------------------------|--------------------------------|
703
- | typedframes | 0.14.0 | DataFrame column checker | 18.1 ± 0.2 ms | 48.6 ± 0.1 ms |
704
- | ruff | 0.17.0 | Linter (no type checking) | 25.1 ± 1.7 ms | 214.6 ± 2.0 ms |
705
- | ty | 0.0.84 | Type checker | 51.1 ± 10.3 ms | 754.2 ± 9.0 ms |
706
- | pyrefly | 1.3.2 | Type checker | 99.3 ± 11.0 ms | 299.0 ± 6.4 ms |
707
- | mypy | 2.4.0 | Type checker (no plugin) | 1.79 ± 0.01 s | 2.99 ± 0.03 s |
708
- | mypy + typedframes | 2.4.0 | Type checker + column checker | 1.81 ± 0.01 s | 3.16 ± 0.01 s |
709
- | pyright | 1.1.414 | Type checker | 656.8 ± 5.8 ms | 3.86 ± 0.07 s |
710
+ | typedframes | 0.14.2 | DataFrame column checker | 21.2 ± 0.8 ms | 50.8 ± 0.6 ms |
711
+ | ruff | 0.17.1 | Linter (no type checking) | 25.9 ± 0.4 ms | 224.4 ± 3.4 ms |
712
+ | ty | 0.0.89 | Type checker | 52.5 ± 0.6 ms | 818.7 ± 24.5 ms |
713
+ | pyrefly | 1.4.0 | Type checker | 116.8 ± 5.8 ms | 323.6 ± 10.1 ms |
714
+ | mypy | 2.4.0 | Type checker (no plugin) | 2.01 ± 0.14 s | 3.37 ± 0.03 s |
715
+ | mypy + typedframes | 2.4.0 | Type checker + column checker | 2.04 ± 0.02 s | 3.68 ± 0.10 s |
716
+ | pyright | 1.1.414 | Type checker | 714.9 ± 20.2 ms | 4.59 ± 0.33 s |
710
717
 
711
718
  *Run `uv run python benchmarks/benchmark_checkers.py` to reproduce.*
712
719
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > ⚠️ **Project Status: Proof of Concept**
10
10
  >
11
- > `typedframes` (v0.14.0) is currently an experimental proof-of-concept. The core static analysis and mypy/Rust
11
+ > `typedframes` (v0.14.2) is currently an experimental proof-of-concept. The core static analysis and mypy/Rust
12
12
  > integrations work, but expect rough edges. The codebase prioritizes demonstrating the viability of static DataFrame
13
13
  > column checking over production-grade stability.
14
14
  >
@@ -104,6 +104,13 @@ pip install typedframes[pandas] # includes pandas
104
104
  pip install typedframes[polars] # includes polars
105
105
  ```
106
106
 
107
+ Where the Python interpreter may run code but no other executable may be started, set `TYPEDFRAMES_INPROC=1`. Then
108
+ `python -m typedframes` and the mypy plugin run the same checker inside the interpreter, through an extension module in
109
+ the wheel, instead of starting the `typedframes` executable. Results and exit status are the same; when the checker is
110
+ asked to capture its output (as the mypy plugin does), a usage error or a missing path comes back with it, and any
111
+ warning a command prints still goes to the terminal. Without the extension installed (for example from a source
112
+ distribution) `TYPEDFRAMES_INPROC=1` is an error.
113
+
107
114
  ---
108
115
 
109
116
  ## Quick Start
@@ -471,7 +478,7 @@ repos:
471
478
  name: typedframes check
472
479
  entry: typedframes check . --strict
473
480
  language: python
474
- additional_dependencies: ["typedframes==0.14.0"]
481
+ additional_dependencies: ["typedframes==0.14.2"]
475
482
  types_or: [python, jupyter]
476
483
  pass_filenames: false
477
484
  ```
@@ -520,7 +527,7 @@ The action installs the PyPI wheel into a throwaway virtualenv and runs the chec
520
527
  | Input | Default | |
521
528
  |-------|---------|-|
522
529
  | `path` | `.` | File or directory to check |
523
- | `version` | `latest` | PyPI version to install, e.g. `"0.14.0"` |
530
+ | `version` | `latest` | PyPI version to install, e.g. `"0.14.2"` |
524
531
  | `strict` | `true` | Fail the step on errors — `typedframes check` exits 0 without it |
525
532
  | `coverage-fail-under` | *(unset)* | Minimum DataFrame schema coverage, e.g. `"90"` |
526
533
  | `coverage-detail` | `summary` | Or `term-missing` for the per-file breakdown, `explain` to diagnose a lower-than-expected total |
@@ -548,7 +555,7 @@ and the files are written together or not at all. See the
548
555
 
549
556
  If `check` or `suggest` gets a site wrong and the code can't be shared, `typedframes report quiet-amber src/` prints a
550
557
  bug-report body with a redacted copy of the code around that site, checked against the checker so it reproduces the same
551
- result. `typedframes report --all src/` does this for every untyped site, grouped by why the checker decided as it did.
558
+ result. `typedframes report --all src/` does this for every untyped site, grouped by why the checker decided as it did; add `--format compact` for a few lines per group that fit in one screenshot.
552
559
  Redacted is not anonymous: read it before posting, and don't use it on code you aren't allowed to share. See
553
560
  [Reporting a problem](docs/usage.md#reporting-a-problem-report), and
554
561
  [Security and data handling](docs/security.md) for what the tool reads, writes and connects to.
@@ -660,17 +667,17 @@ plus the requested features, so both halves get checked normally. See
660
667
  Fast feedback reduces development time. The typedframes Rust binary provides near-instant column checking.
661
668
 
662
669
  **Benchmark results** (median of 5 runs ± one standard deviation, 3 warmup, caches cleared between runs):
663
- *2026-10-13 · Darwin 27.0.0 · arm · CPython 3.15.0 · 64GiB RAM · Great Expectations pinned @ 1.23.2*
670
+ *2026-10-18 · Darwin 27.0.0 · arm · CPython 3.15.0 · 64GiB RAM · Great Expectations pinned @ 1.23.2*
664
671
 
665
672
  | Tool | Version | What it does | typedframes (12 files) | great_expectations (494 files) |
666
673
  |------|---------|--------------|------------------------|--------------------------------|
667
- | typedframes | 0.14.0 | DataFrame column checker | 18.1 ± 0.2 ms | 48.6 ± 0.1 ms |
668
- | ruff | 0.17.0 | Linter (no type checking) | 25.1 ± 1.7 ms | 214.6 ± 2.0 ms |
669
- | ty | 0.0.84 | Type checker | 51.1 ± 10.3 ms | 754.2 ± 9.0 ms |
670
- | pyrefly | 1.3.2 | Type checker | 99.3 ± 11.0 ms | 299.0 ± 6.4 ms |
671
- | mypy | 2.4.0 | Type checker (no plugin) | 1.79 ± 0.01 s | 2.99 ± 0.03 s |
672
- | mypy + typedframes | 2.4.0 | Type checker + column checker | 1.81 ± 0.01 s | 3.16 ± 0.01 s |
673
- | pyright | 1.1.414 | Type checker | 656.8 ± 5.8 ms | 3.86 ± 0.07 s |
674
+ | typedframes | 0.14.2 | DataFrame column checker | 21.2 ± 0.8 ms | 50.8 ± 0.6 ms |
675
+ | ruff | 0.17.1 | Linter (no type checking) | 25.9 ± 0.4 ms | 224.4 ± 3.4 ms |
676
+ | ty | 0.0.89 | Type checker | 52.5 ± 0.6 ms | 818.7 ± 24.5 ms |
677
+ | pyrefly | 1.4.0 | Type checker | 116.8 ± 5.8 ms | 323.6 ± 10.1 ms |
678
+ | mypy | 2.4.0 | Type checker (no plugin) | 2.01 ± 0.14 s | 3.37 ± 0.03 s |
679
+ | mypy + typedframes | 2.4.0 | Type checker + column checker | 2.04 ± 0.02 s | 3.68 ± 0.10 s |
680
+ | pyright | 1.1.414 | Type checker | 714.9 ± 20.2 ms | 4.59 ± 0.33 s |
674
681
 
675
682
  *Run `uv run python benchmarks/benchmark_checkers.py` to reproduce.*
676
683
 
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "typedframes"
7
- version = "0.14.0"
7
+ version = "0.14.2"
8
8
  description = "Static analysis for pandas and polars DataFrames. Catch column errors at lint-time, not runtime."
9
9
  keywords = ["pandas", "polars", "type-checking", "static-analysis", "dataframe", "linter", "mypy-plugin"]
10
10
  readme = "README.md"
@@ -49,6 +49,8 @@ bindings = "bin"
49
49
  module-name = "typedframes"
50
50
  # The cargo config carries the allocator tuning, so a build from the sdist is tuned too.
51
51
  include = [
52
+ { path = "src/typedframes/_rust.*", format = "wheel" },
53
+ { path = "rust/python/**/*", format = "sdist" },
52
54
  { path = "LICENSE", format = "sdist" },
53
55
  { path = ".cargo/config.toml", format = "sdist" },
54
56
  ]
@@ -138,13 +140,13 @@ dev = [
138
140
  "invoke>=3.0.3",
139
141
  "maturin>=1.15.0",
140
142
  "pre-commit>=4.7.0",
141
- "pyrefly>=1.3.2",
143
+ "pyrefly>=1.4.0",
142
144
  "pyright>=1.1.414",
143
145
  "pytest>=9.1.1",
144
146
  "pytest-cov>=7.1.0",
145
147
  "pytest-xdist>=3.8.0",
146
- "ruff>=0.17.0",
147
- "ty>=0.0.87",
148
+ "ruff>=0.17.1",
149
+ "ty>=0.0.89",
148
150
  "openpyxl>=3.1.5",
149
151
  "pyarrow>=26.0.0",
150
152
  "xlsxwriter>=3.2.9",
@@ -792,6 +792,12 @@ dependencies = [
792
792
  "plotters-backend",
793
793
  ]
794
794
 
795
+ [[package]]
796
+ name = "portable-atomic"
797
+ version = "1.15.0"
798
+ source = "registry+https://github.com/rust-lang/crates.io-index"
799
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
800
+
795
801
  [[package]]
796
802
  name = "ppv-lite86"
797
803
  version = "0.2.21"
@@ -831,6 +837,63 @@ dependencies = [
831
837
  "cc",
832
838
  ]
833
839
 
840
+ [[package]]
841
+ name = "pyo3"
842
+ version = "0.30.1"
843
+ source = "registry+https://github.com/rust-lang/crates.io-index"
844
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
845
+ dependencies = [
846
+ "libc",
847
+ "once_cell",
848
+ "portable-atomic",
849
+ "pyo3-build-config",
850
+ "pyo3-ffi",
851
+ "pyo3-macros",
852
+ ]
853
+
854
+ [[package]]
855
+ name = "pyo3-build-config"
856
+ version = "0.30.1"
857
+ source = "registry+https://github.com/rust-lang/crates.io-index"
858
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
859
+ dependencies = [
860
+ "target-lexicon",
861
+ ]
862
+
863
+ [[package]]
864
+ name = "pyo3-ffi"
865
+ version = "0.30.1"
866
+ source = "registry+https://github.com/rust-lang/crates.io-index"
867
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
868
+ dependencies = [
869
+ "libc",
870
+ "pyo3-build-config",
871
+ ]
872
+
873
+ [[package]]
874
+ name = "pyo3-macros"
875
+ version = "0.30.1"
876
+ source = "registry+https://github.com/rust-lang/crates.io-index"
877
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
878
+ dependencies = [
879
+ "proc-macro2",
880
+ "pyo3-macros-backend",
881
+ "quote",
882
+ "syn 3.0.3",
883
+ ]
884
+
885
+ [[package]]
886
+ name = "pyo3-macros-backend"
887
+ version = "0.30.1"
888
+ source = "registry+https://github.com/rust-lang/crates.io-index"
889
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
890
+ dependencies = [
891
+ "heck",
892
+ "proc-macro2",
893
+ "quote",
894
+ "syn 3.0.3",
895
+ ]
896
+
834
897
  [[package]]
835
898
  name = "quote"
836
899
  version = "1.0.47"
@@ -1275,6 +1338,12 @@ dependencies = [
1275
1338
  "unicode-ident",
1276
1339
  ]
1277
1340
 
1341
+ [[package]]
1342
+ name = "target-lexicon"
1343
+ version = "0.13.5"
1344
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1345
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
1346
+
1278
1347
  [[package]]
1279
1348
  name = "tempfile"
1280
1349
  version = "3.27.0"
@@ -1400,13 +1469,12 @@ checksum = "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2"
1400
1469
 
1401
1470
  [[package]]
1402
1471
  name = "typedframes_checker"
1403
- version = "0.14.0"
1472
+ version = "0.14.2"
1404
1473
  dependencies = [
1405
1474
  "anyhow",
1406
1475
  "clap",
1407
1476
  "criterion",
1408
1477
  "mimalloc",
1409
- "regex",
1410
1478
  "rmp-serde",
1411
1479
  "ruff_notebook",
1412
1480
  "ruff_python_ast",
@@ -1421,6 +1489,15 @@ dependencies = [
1421
1489
  "toml",
1422
1490
  ]
1423
1491
 
1492
+ [[package]]
1493
+ name = "typedframes_python"
1494
+ version = "0.14.2"
1495
+ dependencies = [
1496
+ "pyo3",
1497
+ "pyo3-build-config",
1498
+ "typedframes_checker",
1499
+ ]
1500
+
1424
1501
  [[package]]
1425
1502
  name = "unicode-ident"
1426
1503
  version = "1.0.24"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "typedframes_checker"
3
- version = "0.14.0"
3
+ version = "0.14.2"
4
4
  edition = "2021"
5
5
  description = "A high-performance Rust-based checker for typedframes DataFrame column schemas"
6
6
  license = "MIT"
@@ -16,9 +16,17 @@ path = "src/main.rs"
16
16
  [profile.release]
17
17
  lto = true
18
18
  codegen-units = 1
19
- panic = "abort"
19
+ # Panics unwind (the default): this profile also builds the extension module, where a panic must become
20
+ # a Python exception and not end the interpreter that loaded it.
20
21
  strip = "symbols"
21
22
 
23
+ # The executable wheel is built with this profile: it never loads into another process, so a panic
24
+ # may end it, and it favours size over the last ~10% of speed. The extension module keeps `release`.
25
+ [profile.cli]
26
+ inherits = "release"
27
+ panic = "abort"
28
+ opt-level = "s"
29
+
22
30
  [lints.rust]
23
31
  unsafe_code = "forbid"
24
32
 
@@ -37,14 +45,14 @@ serde_json = { version = "1.0", features = ["preserve_order"] }
37
45
  rmp-serde = "1"
38
46
  anyhow = "1.0"
39
47
  toml = { version = "1.1", features = ["preserve_order"] }
40
- sqlparser = "0.62"
48
+ sqlparser = { version = "0.62", default-features = false, features = ["std", "recursive-protection"] }
41
49
  clap = { version = "4.6.7", features = ["derive"] }
42
- regex = "1.13.1"
43
50
  # The allocator split ruff and ty use: jemalloc where it builds, mimalloc on Windows (jemalloc
44
51
  # has no MSVC support), the platform allocator elsewhere. Keep the `cfg`s in `src/lib.rs` in
45
52
  # step with these. jemalloc is tuned for a short run on many threads in `../.cargo/config.toml`.
46
53
  [target.'cfg(all(not(target_os = "windows"), not(target_os = "openbsd"), not(target_os = "aix"), not(target_os = "android"), any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64", target_arch = "riscv64")))'.dependencies]
47
- tikv-jemallocator = "0.7"
54
+ # No initial-exec TLS: that model fails to `dlopen` into a process that did not link jemalloc at start (the extension module).
55
+ tikv-jemallocator = { version = "0.7", features = ["disable_initial_exec_tls"] }
48
56
 
49
57
  [target.'cfg(target_os = "windows")'.dependencies]
50
58
  mimalloc = { version = "0.1.52", default-features = false }
@@ -0,0 +1,23 @@
1
+ [package]
2
+ name = "typedframes_python"
3
+ version = "0.14.2"
4
+ edition = "2021"
5
+ description = "The typedframes checker as a Python extension module, for interpreters that may not start new executables"
6
+ license = "MIT"
7
+ repository = "https://github.com/w-martin/typedframes"
8
+
9
+ [lib]
10
+ name = "_rust"
11
+ crate-type = ["cdylib"]
12
+
13
+ [lints.clippy]
14
+ all = { level = "deny", priority = -1 }
15
+ unwrap_used = "warn"
16
+
17
+ [dependencies]
18
+ typedframes_checker = { path = ".." }
19
+ # abi3: one build serves every supported Python, so the wheel stays one per platform.
20
+ pyo3 = { version = "0.30.1", features = ["abi3-py311", "extension-module"] }
21
+
22
+ [build-dependencies]
23
+ pyo3-build-config = "0.30.1"
@@ -0,0 +1,4 @@
1
+ fn main() {
2
+ // Leaves the interpreter's symbols undefined at link time on macOS and Windows, as an extension module must.
3
+ pyo3_build_config::add_extension_module_link_args();
4
+ }
@@ -0,0 +1,27 @@
1
+ //! `typedframes._rust`: the command line, run inside the Python interpreter.
2
+
3
+ use pyo3::prelude::*;
4
+
5
+ /// Run the `typedframes` command line with `argv` (the program name first); returns the exit status.
6
+ #[pyfunction]
7
+ fn main(py: Python<'_>, argv: Vec<String>) -> u8 {
8
+ // The checker uses its own threads and no Python objects, so the interpreter can run meanwhile.
9
+ py.detach(|| typedframes_checker::cli::run(argv))
10
+ }
11
+
12
+ /// Like `main`, but returns the exit status, standard output and the failure message instead of writing them.
13
+ #[pyfunction]
14
+ fn run_captured(py: Python<'_>, argv: Vec<String>) -> (u8, String, String) {
15
+ let (status, out, err) = py.detach(|| typedframes_checker::cli::run_captured(argv));
16
+ (
17
+ status,
18
+ String::from_utf8_lossy(&out).into_owned(),
19
+ String::from_utf8_lossy(&err).into_owned(),
20
+ )
21
+ }
22
+
23
+ #[pymodule]
24
+ fn _rust(module: &Bound<'_, PyModule>) -> PyResult<()> {
25
+ module.add_function(wrap_pyfunction!(main, module)?)?;
26
+ module.add_function(wrap_pyfunction!(run_captured, module)?)
27
+ }
@@ -3,6 +3,7 @@
3
3
  use super::cache::CacheAction;
4
4
  use super::config::CoverageDetail;
5
5
  use clap::{Args, Parser, Subcommand, ValueEnum};
6
+ use std::ffi::OsString;
6
7
  use std::path::PathBuf;
7
8
 
8
9
  const CACHE_HELP: &str = "\
@@ -174,6 +175,7 @@ pub(crate) enum Outcome {
174
175
  pub(crate) enum ReportFormat {
175
176
  Markdown,
176
177
  Json,
178
+ Compact,
177
179
  }
178
180
 
179
181
  #[derive(Args, Debug)]
@@ -215,9 +217,14 @@ pub(crate) struct CacheArgs {
215
217
  pub(crate) cache_dir: Option<PathBuf>,
216
218
  }
217
219
 
218
- /// Parses the process arguments, exiting with clap's usage error (status 2) on a bad command line.
219
- pub(crate) fn parse() -> Cli {
220
- Cli::parse()
220
+ /// Parses `args` (program name first). A bad command line, `--help` and `--version` come back as
221
+ /// the clap error for the caller to print, so nothing here ends the process.
222
+ pub(crate) fn parse_from<I, T>(args: I) -> Result<Cli, clap::Error>
223
+ where
224
+ I: IntoIterator<Item = T>,
225
+ T: Into<OsString> + Clone,
226
+ {
227
+ Cli::try_parse_from(args)
221
228
  }
222
229
 
223
230
  #[cfg(test)]
@@ -451,22 +451,29 @@ pub(crate) fn build_index(
451
451
  }
452
452
  }
453
453
 
454
- /// Resolves a command's path argument; a path that doesn't exist is reported and exit status 2.
455
- pub(crate) fn resolve_existing_path(original: &Path) -> Result<PathBuf, i32> {
454
+ /// Resolves a command's path argument; `Err` is the message for a path that doesn't exist.
455
+ fn resolve_or_explain(original: &Path) -> Result<PathBuf, String> {
456
456
  let path = resolve(original);
457
457
  if path.exists() {
458
458
  return Ok(path);
459
459
  }
460
460
  if original.is_absolute() {
461
- eprintln!("Error: path does not exist: {}", path.display());
461
+ Err(format!("Error: path does not exist: {}", path.display()))
462
462
  } else {
463
- eprintln!(
463
+ Err(format!(
464
464
  "Error: path does not exist: {} (resolved to {})",
465
465
  repr(original),
466
466
  path.display()
467
- );
467
+ ))
468
468
  }
469
- Err(2)
469
+ }
470
+
471
+ /// Resolves a command's path argument; a path that doesn't exist is reported and exit status 2.
472
+ pub(crate) fn resolve_existing_path(original: &Path) -> Result<PathBuf, i32> {
473
+ resolve_or_explain(original).map_err(|message| {
474
+ eprintln!("{message}");
475
+ 2
476
+ })
470
477
  }
471
478
 
472
479
  fn print_coverage_failures(
@@ -495,12 +502,20 @@ fn print_coverage_failures(
495
502
  Ok(())
496
503
  }
497
504
 
498
- /// Runs `check`, writing its report to `out`; returns the exit status.
499
- pub(crate) fn run_check(args: &CheckArgs, out: &mut impl Write) -> io::Result<i32> {
505
+ /// Runs `check`, writing its report to `out` and the reason for a path that doesn't exist to `err`;
506
+ /// returns the exit status.
507
+ pub(crate) fn run_check(
508
+ args: &CheckArgs,
509
+ out: &mut impl Write,
510
+ err: &mut impl Write,
511
+ ) -> io::Result<i32> {
500
512
  let start = Instant::now();
501
- let path = match resolve_existing_path(&args.path) {
513
+ let path = match resolve_or_explain(&args.path) {
502
514
  Ok(path) => path,
503
- Err(code) => return Ok(code),
515
+ Err(message) => {
516
+ writeln!(err, "{message}")?;
517
+ return Ok(2);
518
+ }
504
519
  };
505
520
 
506
521
  // Loaded before the run so an unusable config is reported up front rather than after a long