eztfas 0.1.0a1__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 (30) hide show
  1. eztfas-0.1.0a1/Cargo.lock +205 -0
  2. eztfas-0.1.0a1/Cargo.toml +10 -0
  3. eztfas-0.1.0a1/LICENSE +21 -0
  4. eztfas-0.1.0a1/PKG-INFO +152 -0
  5. eztfas-0.1.0a1/README.md +139 -0
  6. eztfas-0.1.0a1/THIRD_PARTY_NOTICES.txt +1016 -0
  7. eztfas-0.1.0a1/crates/eztfas-core/Cargo.toml +19 -0
  8. eztfas-0.1.0a1/crates/eztfas-core/LICENSE +21 -0
  9. eztfas-0.1.0a1/crates/eztfas-core/README.md +139 -0
  10. eztfas-0.1.0a1/crates/eztfas-core/THIRD_PARTY_NOTICES.txt +1016 -0
  11. eztfas-0.1.0a1/crates/eztfas-core/src/document.rs +316 -0
  12. eztfas-0.1.0a1/crates/eztfas-core/src/equipment.rs +258 -0
  13. eztfas-0.1.0a1/crates/eztfas-core/src/lib.rs +239 -0
  14. eztfas-0.1.0a1/crates/eztfas-core/src/parser.rs +308 -0
  15. eztfas-0.1.0a1/crates/eztfas-core/tests/document.rs +30 -0
  16. eztfas-0.1.0a1/crates/eztfas-core/tests/fixtures/direct-2d.tfs +0 -0
  17. eztfas-0.1.0a1/crates/eztfas-core/tests/fixtures/structural.tfs +0 -0
  18. eztfas-0.1.0a1/crates/eztfas-core/tests/scan.rs +198 -0
  19. eztfas-0.1.0a1/crates/eztfas-core/tests/wide_directory.rs +58 -0
  20. eztfas-0.1.0a1/crates/eztfas-python/Cargo.toml +20 -0
  21. eztfas-0.1.0a1/crates/eztfas-python/src/document.rs +202 -0
  22. eztfas-0.1.0a1/crates/eztfas-python/src/lib.rs +252 -0
  23. eztfas-0.1.0a1/pyproject.toml +30 -0
  24. eztfas-0.1.0a1/src/eztfas/__init__.py +69 -0
  25. eztfas-0.1.0a1/src/eztfas/_core.pyi +176 -0
  26. eztfas-0.1.0a1/src/eztfas/py.typed +0 -0
  27. eztfas-0.1.0a1/tests/python/test_document.py +160 -0
  28. eztfas-0.1.0a1/tests/python/test_equipment.py +156 -0
  29. eztfas-0.1.0a1/tests/python/test_formats.py +123 -0
  30. eztfas-0.1.0a1/tests/python/test_scan.py +84 -0
@@ -0,0 +1,205 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "adler2"
7
+ version = "2.0.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
10
+
11
+ [[package]]
12
+ name = "cfg-if"
13
+ version = "1.0.5"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
16
+
17
+ [[package]]
18
+ name = "crc32fast"
19
+ version = "1.5.5"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "2b929dd2a135771f40afabd1073f85eed59c800b7c61901e5c254270497dad64"
22
+ dependencies = [
23
+ "cfg-if",
24
+ ]
25
+
26
+ [[package]]
27
+ name = "encoding_rs"
28
+ version = "0.8.35"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
31
+ dependencies = [
32
+ "cfg-if",
33
+ ]
34
+
35
+ [[package]]
36
+ name = "eztfas-core"
37
+ version = "0.1.0-alpha.1"
38
+ dependencies = [
39
+ "crc32fast",
40
+ "encoding_rs",
41
+ "flate2",
42
+ ]
43
+
44
+ [[package]]
45
+ name = "eztfas-python"
46
+ version = "0.1.0-alpha.1"
47
+ dependencies = [
48
+ "eztfas-core",
49
+ "pyo3",
50
+ ]
51
+
52
+ [[package]]
53
+ name = "flate2"
54
+ version = "1.1.11"
55
+ source = "registry+https://github.com/rust-lang/crates.io-index"
56
+ checksum = "626d4928326b646e70f65ed36fc7cf9f206bdb68a0019ee7c6b4709da4e084c4"
57
+ dependencies = [
58
+ "crc32fast",
59
+ "miniz_oxide",
60
+ "zlib-rs",
61
+ ]
62
+
63
+ [[package]]
64
+ name = "heck"
65
+ version = "0.5.0"
66
+ source = "registry+https://github.com/rust-lang/crates.io-index"
67
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
68
+
69
+ [[package]]
70
+ name = "libc"
71
+ version = "0.2.191"
72
+ source = "registry+https://github.com/rust-lang/crates.io-index"
73
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
74
+
75
+ [[package]]
76
+ name = "miniz_oxide"
77
+ version = "0.9.1"
78
+ source = "registry+https://github.com/rust-lang/crates.io-index"
79
+ checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
80
+ dependencies = [
81
+ "adler2",
82
+ "simd-adler32",
83
+ ]
84
+
85
+ [[package]]
86
+ name = "once_cell"
87
+ version = "1.21.4"
88
+ source = "registry+https://github.com/rust-lang/crates.io-index"
89
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
90
+
91
+ [[package]]
92
+ name = "portable-atomic"
93
+ version = "1.15.0"
94
+ source = "registry+https://github.com/rust-lang/crates.io-index"
95
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
96
+
97
+ [[package]]
98
+ name = "proc-macro2"
99
+ version = "1.0.107"
100
+ source = "registry+https://github.com/rust-lang/crates.io-index"
101
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
102
+ dependencies = [
103
+ "unicode-ident",
104
+ ]
105
+
106
+ [[package]]
107
+ name = "pyo3"
108
+ version = "0.29.3"
109
+ source = "registry+https://github.com/rust-lang/crates.io-index"
110
+ checksum = "700d18fa267b73b9b521fd7e13580e2f446916f176cacee1ab63fcc8191f1655"
111
+ dependencies = [
112
+ "libc",
113
+ "once_cell",
114
+ "portable-atomic",
115
+ "pyo3-build-config",
116
+ "pyo3-ffi",
117
+ "pyo3-macros",
118
+ ]
119
+
120
+ [[package]]
121
+ name = "pyo3-build-config"
122
+ version = "0.29.3"
123
+ source = "registry+https://github.com/rust-lang/crates.io-index"
124
+ checksum = "7b3fc0c4d08f6bb10e71fe39dfb9e2f59c6eb6854e22ec8092f50c69a4499adb"
125
+ dependencies = [
126
+ "target-lexicon",
127
+ ]
128
+
129
+ [[package]]
130
+ name = "pyo3-ffi"
131
+ version = "0.29.3"
132
+ source = "registry+https://github.com/rust-lang/crates.io-index"
133
+ checksum = "dfc0b8e19df29aad7086cf977bb0c2a2f143e30567eb113e9cf72b62ca698330"
134
+ dependencies = [
135
+ "libc",
136
+ "pyo3-build-config",
137
+ ]
138
+
139
+ [[package]]
140
+ name = "pyo3-macros"
141
+ version = "0.29.3"
142
+ source = "registry+https://github.com/rust-lang/crates.io-index"
143
+ checksum = "6100e8a4b5eba53afaa5ed078364851a0b2499c553a44c31026b929049b49dc6"
144
+ dependencies = [
145
+ "proc-macro2",
146
+ "pyo3-macros-backend",
147
+ "quote",
148
+ "syn",
149
+ ]
150
+
151
+ [[package]]
152
+ name = "pyo3-macros-backend"
153
+ version = "0.29.3"
154
+ source = "registry+https://github.com/rust-lang/crates.io-index"
155
+ checksum = "6143877a16e82b5a727b7127ff4cd86858a24a28d745d72f43e6f227c7b1bdb3"
156
+ dependencies = [
157
+ "heck",
158
+ "proc-macro2",
159
+ "quote",
160
+ "syn",
161
+ ]
162
+
163
+ [[package]]
164
+ name = "quote"
165
+ version = "1.0.47"
166
+ source = "registry+https://github.com/rust-lang/crates.io-index"
167
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
168
+ dependencies = [
169
+ "proc-macro2",
170
+ ]
171
+
172
+ [[package]]
173
+ name = "simd-adler32"
174
+ version = "0.3.10"
175
+ source = "registry+https://github.com/rust-lang/crates.io-index"
176
+ checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
177
+
178
+ [[package]]
179
+ name = "syn"
180
+ version = "2.0.119"
181
+ source = "registry+https://github.com/rust-lang/crates.io-index"
182
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
183
+ dependencies = [
184
+ "proc-macro2",
185
+ "quote",
186
+ "unicode-ident",
187
+ ]
188
+
189
+ [[package]]
190
+ name = "target-lexicon"
191
+ version = "0.13.6"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
194
+
195
+ [[package]]
196
+ name = "unicode-ident"
197
+ version = "1.0.27"
198
+ source = "registry+https://github.com/rust-lang/crates.io-index"
199
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
200
+
201
+ [[package]]
202
+ name = "zlib-rs"
203
+ version = "0.6.8"
204
+ source = "registry+https://github.com/rust-lang/crates.io-index"
205
+ checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
@@ -0,0 +1,10 @@
1
+ [workspace]
2
+ members = ["crates/eztfas-core", "crates/eztfas-python"]
3
+ resolver = "2"
4
+
5
+ [workspace.package]
6
+ version = "0.1.0-alpha.1"
7
+ edition = "2021"
8
+ rust-version = "1.83"
9
+ repository = "https://github.com/monozukuri-ai/eztfas"
10
+ license = "MIT"
eztfas-0.1.0a1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 neka-nat
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: eztfas
3
+ Version: 0.1.0a1
4
+ License-File: LICENSE
5
+ License-File: THIRD_PARTY_NOTICES.txt
6
+ Summary: Read sheets, 2D entities, pipe and duct ports, and raw records from CADWe'll Tfas drawings
7
+ License-Expression: MIT
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
10
+ Project-URL: Issues, https://github.com/monozukuri-ai/eztfas/issues
11
+ Project-URL: Repository, https://github.com/monozukuri-ai/eztfas
12
+
13
+ # eztfas
14
+
15
+ eztfas is a read-only parser for CADWe'll Tfas drawings and templates. The Rust
16
+ crate `eztfas-core` and the Python package `eztfas` read the same file formats.
17
+ Both run without a Tfas installation.
18
+
19
+ | Format | What you can read |
20
+ | --- | --- |
21
+ | TFS drawing | Sheets, direct 2D lines, single-line text, and supported pipe and duct parts in the compact 32-bit directory layout. |
22
+ | TFT template | Sheet names, explicit sheet scales and saved discipline in supported Tfas 15 templates. |
23
+ | TFX drawing (experimental) | The wide 64-bit directory layout. A derived drawing was checked in Tfas 15 Viewer. Coverage of files saved directly by Tfas is unverified. |
24
+
25
+ ## Python
26
+
27
+ Build from a source checkout with Python 3.10 or later and a Rust toolchain.
28
+
29
+ ```sh
30
+ python -m pip install .
31
+ ```
32
+
33
+ ```python
34
+ import eztfas
35
+
36
+ doc = eztfas.readfile("drawing.tfs")
37
+ for sheet in doc.sheets:
38
+ print(sheet.name, sheet.scale_denominator)
39
+ for entity in sheet.query("LINE TEXT"):
40
+ if isinstance(entity, eztfas.Line):
41
+ print(entity.start, entity.end)
42
+ else:
43
+ print(entity.text, entity.insert, entity.rotation_degrees)
44
+ ```
45
+
46
+ To try the example from a checkout, use
47
+ `crates/eztfas-core/tests/fixtures/direct-2d.tfs`. Its first sheet has one line
48
+ and the Japanese text `検査点`. Use `eztfas.read(data)` to read file contents
49
+ supplied as `bytes`.
50
+
51
+ Entities follow file order within each sheet. Line endpoints and text alignment
52
+ points use drawing-space XY coordinates, in millimetres in the supported drawings.
53
+ Text rotation is in degrees. A sheet with an explicit 1:30 scale returns
54
+ `scale_denominator == 30`. Drawing-scale sheets and unknown scale settings return
55
+ `None`. The document's `saved_discipline` is available when recorded.
56
+
57
+ ### Pipe and duct connections
58
+
59
+ ```python
60
+ for sheet in doc.sheets:
61
+ for part in sheet.equipment:
62
+ print(sheet.name, part.id, part.kind, part.catalog_code, part.system_name)
63
+ for port in part.ports:
64
+ print(port.number, port.xyz, port.connection, port.peer)
65
+ ```
66
+
67
+ Port centres use XYZ in millimetres. Pipes expose `nominal_diameter` (50 for
68
+ 50A), round ducts expose `diameter`, and rectangular ducts expose `width` and
69
+ `height` in millimetres. For a `connected` port, `peer` identifies a figure
70
+ number and a one-based port number on the same sheet. An `open` port has no
71
+ stored connection. An `unresolved` port has a reference the reader could not
72
+ resolve. Both return `None` for `peer`.
73
+
74
+ ### Inspecting incomplete drawings and raw records
75
+
76
+ The typed API covers direct entities and known equipment layouts. Referenced
77
+ views and nested geometry are available as raw records. `sheet.skipped_objects`
78
+ counts direct objects that produced no line or text, including equipment.
79
+ `doc.unread_sheet_blocks` lists unrecognized sheet streams by outer record index.
80
+
81
+ ```python
82
+ raw = doc.raw
83
+ print(raw.storage_layout, raw.header_build, raw.outer_count, raw.inner_count)
84
+ for diagnostic in raw.diagnostics:
85
+ print(diagnostic.group, diagnostic.subtype, diagnostic.count)
86
+ ```
87
+
88
+ Use `eztfas.scan(path_or_bytes)` for a structural scan. Section numbers start at
89
+ one. Record indices start at zero. `raw.record(*entity.source)` returns the type
90
+ and byte ranges of an entity's geometry record. `raw.record_bytes(...)` returns
91
+ its header and payload. `raw.preview_png()` returns the first embedded PNG as
92
+ bytes, or `None` when the drawing has no preview.
93
+
94
+ The default budgets are 64 MiB of input, 32 MiB per expanded block, 128 MiB of
95
+ total expanded data and 1,000,000 records. Pass a `ParseLimits` instance as the
96
+ `limits` keyword to `read`, `readfile` or `scan` to override individual budgets.
97
+ The parser reports malformed data with `InvalidTfasError`, unsupported formats
98
+ with `UnsupportedTfasError`, and exceeded budgets with `TfasLimitError`.
99
+
100
+ ## Rust
101
+
102
+ Use `eztfas-core` from `crates/eztfas-core` as a Cargo path dependency in a
103
+ checkout. `read` returns a document with its raw scan. `scan` indexes the
104
+ records without decoding sheet entities.
105
+
106
+ ```rust
107
+ use eztfas_core::{read, ParseLimits};
108
+
109
+ fn main() -> Result<(), Box<dyn std::error::Error>> {
110
+ let data = std::fs::read("drawing.tfs")?;
111
+ let doc = read(&data, &ParseLimits::default())?;
112
+ for sheet in &doc.sheets {
113
+ println!("{}: {} direct 2D entities", sheet.name, sheet.entities.len());
114
+ }
115
+ Ok(())
116
+ }
117
+ ```
118
+
119
+ ## Running the tests
120
+
121
+ From a checkout, install the Python package and pytest, then run the Rust and
122
+ Python suites. Both use synthetic fixtures included in the repository.
123
+
124
+ ```sh
125
+ python -m pip install . pytest
126
+ cargo test -p eztfas-core --locked
127
+ python -m pytest
128
+ ```
129
+
130
+ ## Releasing
131
+
132
+ Run the **Release** workflow manually to build and test the release bundle.
133
+ It includes CPython 3.10+ ABI3 wheels for Linux (manylinux 2.28), macOS and
134
+ Windows on x86-64 and ARM64, the Python source distribution, the Rust core
135
+ crate and SHA-256 checksums.
136
+
137
+ To publish, push a tag matching the Cargo workspace version exactly, such as
138
+ `v0.1.0-alpha.1`. After the builds and tests pass, the workflow publishes
139
+ `eztfas` to PyPI and `eztfas-core` to crates.io, then attaches the verified
140
+ files to a GitHub Release. A prerelease version creates a GitHub prerelease.
141
+
142
+ For the first release, register a PyPI trusted publisher for project
143
+ `eztfas`, repository `monozukuri-ai/eztfas`, workflow `release.yml` and
144
+ environment `pypi`. Set a crates.io token with permission to publish
145
+ `eztfas-core` as the `CARGO_REGISTRY_TOKEN` secret in the GitHub environment
146
+ `crates-io`. [PyPI first-time setup](https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/)
147
+
148
+ ## License
149
+
150
+ eztfas is released under the MIT License. Dependencies retain their respective
151
+ licenses. [MIT License](LICENSE) · [Third-party notices](THIRD_PARTY_NOTICES.txt)
152
+
@@ -0,0 +1,139 @@
1
+ # eztfas
2
+
3
+ eztfas is a read-only parser for CADWe'll Tfas drawings and templates. The Rust
4
+ crate `eztfas-core` and the Python package `eztfas` read the same file formats.
5
+ Both run without a Tfas installation.
6
+
7
+ | Format | What you can read |
8
+ | --- | --- |
9
+ | TFS drawing | Sheets, direct 2D lines, single-line text, and supported pipe and duct parts in the compact 32-bit directory layout. |
10
+ | TFT template | Sheet names, explicit sheet scales and saved discipline in supported Tfas 15 templates. |
11
+ | TFX drawing (experimental) | The wide 64-bit directory layout. A derived drawing was checked in Tfas 15 Viewer. Coverage of files saved directly by Tfas is unverified. |
12
+
13
+ ## Python
14
+
15
+ Build from a source checkout with Python 3.10 or later and a Rust toolchain.
16
+
17
+ ```sh
18
+ python -m pip install .
19
+ ```
20
+
21
+ ```python
22
+ import eztfas
23
+
24
+ doc = eztfas.readfile("drawing.tfs")
25
+ for sheet in doc.sheets:
26
+ print(sheet.name, sheet.scale_denominator)
27
+ for entity in sheet.query("LINE TEXT"):
28
+ if isinstance(entity, eztfas.Line):
29
+ print(entity.start, entity.end)
30
+ else:
31
+ print(entity.text, entity.insert, entity.rotation_degrees)
32
+ ```
33
+
34
+ To try the example from a checkout, use
35
+ `crates/eztfas-core/tests/fixtures/direct-2d.tfs`. Its first sheet has one line
36
+ and the Japanese text `検査点`. Use `eztfas.read(data)` to read file contents
37
+ supplied as `bytes`.
38
+
39
+ Entities follow file order within each sheet. Line endpoints and text alignment
40
+ points use drawing-space XY coordinates, in millimetres in the supported drawings.
41
+ Text rotation is in degrees. A sheet with an explicit 1:30 scale returns
42
+ `scale_denominator == 30`. Drawing-scale sheets and unknown scale settings return
43
+ `None`. The document's `saved_discipline` is available when recorded.
44
+
45
+ ### Pipe and duct connections
46
+
47
+ ```python
48
+ for sheet in doc.sheets:
49
+ for part in sheet.equipment:
50
+ print(sheet.name, part.id, part.kind, part.catalog_code, part.system_name)
51
+ for port in part.ports:
52
+ print(port.number, port.xyz, port.connection, port.peer)
53
+ ```
54
+
55
+ Port centres use XYZ in millimetres. Pipes expose `nominal_diameter` (50 for
56
+ 50A), round ducts expose `diameter`, and rectangular ducts expose `width` and
57
+ `height` in millimetres. For a `connected` port, `peer` identifies a figure
58
+ number and a one-based port number on the same sheet. An `open` port has no
59
+ stored connection. An `unresolved` port has a reference the reader could not
60
+ resolve. Both return `None` for `peer`.
61
+
62
+ ### Inspecting incomplete drawings and raw records
63
+
64
+ The typed API covers direct entities and known equipment layouts. Referenced
65
+ views and nested geometry are available as raw records. `sheet.skipped_objects`
66
+ counts direct objects that produced no line or text, including equipment.
67
+ `doc.unread_sheet_blocks` lists unrecognized sheet streams by outer record index.
68
+
69
+ ```python
70
+ raw = doc.raw
71
+ print(raw.storage_layout, raw.header_build, raw.outer_count, raw.inner_count)
72
+ for diagnostic in raw.diagnostics:
73
+ print(diagnostic.group, diagnostic.subtype, diagnostic.count)
74
+ ```
75
+
76
+ Use `eztfas.scan(path_or_bytes)` for a structural scan. Section numbers start at
77
+ one. Record indices start at zero. `raw.record(*entity.source)` returns the type
78
+ and byte ranges of an entity's geometry record. `raw.record_bytes(...)` returns
79
+ its header and payload. `raw.preview_png()` returns the first embedded PNG as
80
+ bytes, or `None` when the drawing has no preview.
81
+
82
+ The default budgets are 64 MiB of input, 32 MiB per expanded block, 128 MiB of
83
+ total expanded data and 1,000,000 records. Pass a `ParseLimits` instance as the
84
+ `limits` keyword to `read`, `readfile` or `scan` to override individual budgets.
85
+ The parser reports malformed data with `InvalidTfasError`, unsupported formats
86
+ with `UnsupportedTfasError`, and exceeded budgets with `TfasLimitError`.
87
+
88
+ ## Rust
89
+
90
+ Use `eztfas-core` from `crates/eztfas-core` as a Cargo path dependency in a
91
+ checkout. `read` returns a document with its raw scan. `scan` indexes the
92
+ records without decoding sheet entities.
93
+
94
+ ```rust
95
+ use eztfas_core::{read, ParseLimits};
96
+
97
+ fn main() -> Result<(), Box<dyn std::error::Error>> {
98
+ let data = std::fs::read("drawing.tfs")?;
99
+ let doc = read(&data, &ParseLimits::default())?;
100
+ for sheet in &doc.sheets {
101
+ println!("{}: {} direct 2D entities", sheet.name, sheet.entities.len());
102
+ }
103
+ Ok(())
104
+ }
105
+ ```
106
+
107
+ ## Running the tests
108
+
109
+ From a checkout, install the Python package and pytest, then run the Rust and
110
+ Python suites. Both use synthetic fixtures included in the repository.
111
+
112
+ ```sh
113
+ python -m pip install . pytest
114
+ cargo test -p eztfas-core --locked
115
+ python -m pytest
116
+ ```
117
+
118
+ ## Releasing
119
+
120
+ Run the **Release** workflow manually to build and test the release bundle.
121
+ It includes CPython 3.10+ ABI3 wheels for Linux (manylinux 2.28), macOS and
122
+ Windows on x86-64 and ARM64, the Python source distribution, the Rust core
123
+ crate and SHA-256 checksums.
124
+
125
+ To publish, push a tag matching the Cargo workspace version exactly, such as
126
+ `v0.1.0-alpha.1`. After the builds and tests pass, the workflow publishes
127
+ `eztfas` to PyPI and `eztfas-core` to crates.io, then attaches the verified
128
+ files to a GitHub Release. A prerelease version creates a GitHub prerelease.
129
+
130
+ For the first release, register a PyPI trusted publisher for project
131
+ `eztfas`, repository `monozukuri-ai/eztfas`, workflow `release.yml` and
132
+ environment `pypi`. Set a crates.io token with permission to publish
133
+ `eztfas-core` as the `CARGO_REGISTRY_TOKEN` secret in the GitHub environment
134
+ `crates-io`. [PyPI first-time setup](https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/)
135
+
136
+ ## License
137
+
138
+ eztfas is released under the MIT License. Dependencies retain their respective
139
+ licenses. [MIT License](LICENSE) · [Third-party notices](THIRD_PARTY_NOTICES.txt)