eqlx-ebelge 0.1.1__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.
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,166 @@
1
+ Metadata-Version: 2.4
2
+ Name: eqlx-ebelge
3
+ Version: 0.1.1
4
+ Summary: Read Turkish e-Fatura (UBL-TR) and e-Defter (XBRL-GL) files: clean data, trial balance, consistency checks, and an MCP server for AI agents.
5
+ Keywords: e-fatura,e-defter,ubl-tr,xbrl-gl,gib,turkey,invoice,trial balance,mcp
6
+ Author: Can Demir
7
+ Author-email: Can Demir <can.demir@eqlx.ai>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Financial and Insurance Industry
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Natural Language :: Turkish
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Office/Business :: Financial :: Accounting
16
+ Requires-Dist: defusedxml>=0.7
17
+ Requires-Dist: mcp>=2.3.0 ; extra == 'mcp'
18
+ Requires-Python: >=3.10
19
+ Project-URL: Homepage, https://eqlx.org
20
+ Project-URL: Source, https://github.com/eqlx-ai/eqlx-ebelge
21
+ Provides-Extra: mcp
22
+ Description-Content-Type: text/markdown
23
+
24
+ # eqlx-ebelge
25
+
26
+ Read Turkish **e-Fatura** (UBL-TR) and **e-Defter** (XBRL GL) files: clean data, a trial balance
27
+ (mizan), and consistency checks that catch wrong totals, invalid tax ids, duplicate invoices and
28
+ unbalanced journal entries. An optional **MCP server** lets AI agents such as Claude use the same
29
+ functions, read-only.
30
+
31
+ Built by [eqlx](https://eqlx.ai). Part of [eqlx.org](https://eqlx.org), open research and tools.
32
+
33
+ > Status: alpha (0.1.1). Tested on synthetic documents and checked against GİB's public sample
34
+ > packages (e-Fatura, e-Arşiv, e-Defter): on those samples it raises no false alarms, and the
35
+ > findings it does raise are real inconsistencies in the samples. Please report any real-world file it
36
+ > reads wrongly (without sending the file itself).
37
+
38
+ ## Why
39
+
40
+ Lenders, factoring companies and finance teams receive invoices and ledgers as GİB XML and still read
41
+ them by hand or through paid tools. This library turns them into data you can check and analyse,
42
+ locally, with no network access.
43
+
44
+ ## Install
45
+
46
+ ```bash
47
+ pip install "eqlx-ebelge[mcp] @ git+https://github.com/eqlx-ai/eqlx-ebelge"
48
+ ```
49
+
50
+ Python 3.10+. The core needs only `defusedxml`; `[mcp]` adds the MCP server.
51
+
52
+ ## Command line
53
+
54
+ ```bash
55
+ ebelge sample demo # write 10 synthetic files to try it on
56
+ ebelge check demo # every check, on files, folders or ZIP archives
57
+ ebelge invoices demo --csv # one row per invoice
58
+ ebelge mizan demo # trial balance from e-Defter journals (add --level sub)
59
+ ```
60
+
61
+ ```text
62
+ $ ebelge check demo
63
+ 10 documents: 9 invoices, 1 ledger files (7 entries). 2 errors, 1 warnings, 0 info.
64
+
65
+ severity code file message
66
+ error payable fatura_08_toplam_hatali.xml TaxInclusiveAmount - withholding + rounding = 4682.88, PayableAmount is 99999.99 (gap 95317.11)
67
+ error tax_id_check_digit fatura_09_vkn_hatali.xml supplier VKN 4477127821 fails its check digit
68
+ warning possible_duplicate fatura_02.xml supplier 4477127820, same customer, 2026-10-07, payable 10140.12: EQX2026000000002 (fatura_02.xml), EQX2026000000007 (fatura_07.xml)
69
+
70
+ $ ebelge mizan demo
71
+ account name debit credit debit_bal credit_bal
72
+ 100 KASA 10000.00 8500.00 1500.00 0
73
+ 102 BANKALAR 560000.00 10000.00 550000.00 0
74
+ 120 ALICILAR 90000.00 60000.00 30000.00 0
75
+ ...
76
+ ```
77
+
78
+ `ebelge check` exits with code 1 when it finds an error, so it can gate a pipeline.
79
+
80
+ ## Python
81
+
82
+ ```python
83
+ from pathlib import Path
84
+ import eqlx_ebelge as eb
85
+
86
+ inv = eb.read_invoice(Path("fatura.xml").read_bytes(), "fatura.xml")
87
+ inv.supplier.tax_id, inv.totals.payable, [line.name for line in inv.lines]
88
+ eb.check_invoice(inv) # list of Finding(code, severity, message, ...)
89
+
90
+ report = eb.scan(["inbox/", "archive.zip"]) # every document, every check, duplicates across all
91
+ report.summary()
92
+
93
+ ledgers = [eb.read_ledger(p.read_bytes(), p.name) for p in sorted(Path("edefter").glob("*.xml"))]
94
+ rows = eb.trial_balance(ledgers) # e.g. twelve monthly journals -> one year's mizan
95
+ ```
96
+
97
+ Amounts are `Decimal`, never floats.
98
+
99
+ ## Checks
100
+
101
+ | Code | Severity | What it catches |
102
+ |---|---|---|
103
+ | `tax_id_check_digit`, `tax_id_length`, `tax_id_missing` | error | VKN or TCKN that fails its check digit, has the wrong length, or is missing |
104
+ | `lines_total` | error | invoice lines do not add up to `LineExtensionAmount` |
105
+ | `tax_total`, `tax_inclusive` | error | tax subtotals or the tax-inclusive total do not add up |
106
+ | `payable` | error above 1 TRY, else warning | payable amount differs from tax-inclusive total minus withholding (tevkifat) |
107
+ | `line_amount`, `tax_rate` | warning | quantity x price - discount, or base x rate, differs from what the line or tax says |
108
+ | `number_format`, `number_year`, `uuid_format` | warning | invoice number is not 3 characters + year + 9 digits, its year differs from the date, malformed ETTN |
109
+ | `duplicate_uuid`, `duplicate_number` | error | the same ETTN, or the same supplier and number, appears more than once |
110
+ | `possible_duplicate` | warning | same supplier, customer, date and amount under different numbers |
111
+ | `entry_unbalanced`, `entry_total`, `ledger_unbalanced` | error | a journal entry, its header totals, or the whole file do not balance |
112
+ | `counter_repeat` / `counter_gap` | error / warning | journal entry counters repeat or skip |
113
+ | `date_outside_period` | warning | an entry dated outside the period the file covers |
114
+ | `placeholder_tckn`, `same_party`, `account_code`, `unsupported` | info | context worth knowing |
115
+ | `unreadable` | error | a file that is malformed or unsafe to parse |
116
+
117
+ Tolerances: one kuruş per comparison, plus half a kuruş per line where per-line rounding adds up.
118
+
119
+ ## MCP server (for Claude and other agents)
120
+
121
+ The server exposes four read-only tools: `list_documents`, `check`, `read_invoices` and
122
+ `trial_balance`. It reads only inside the folder you give it; `..`, absolute paths and symlinks that
123
+ point outside are refused.
124
+
125
+ Claude Code:
126
+
127
+ ```bash
128
+ claude mcp add ebelge -- ebelge mcp --root /path/to/invoices
129
+ ```
130
+
131
+ Claude Desktop (`claude_desktop_config.json`):
132
+
133
+ ```json
134
+ {
135
+ "mcpServers": {
136
+ "ebelge": { "command": "ebelge", "args": ["mcp", "--root", "/path/to/invoices"] }
137
+ }
138
+ }
139
+ ```
140
+
141
+ Then ask, for example: *"Bu klasördeki faturaları kontrol et, sorunlu olanları ve mükerrerleri göster."*
142
+
143
+ ## Safety and privacy
144
+
145
+ - Runs locally. No network access, no telemetry.
146
+ - XML with a DOCTYPE is refused, which blocks entity-expansion and external-entity (XXE) attacks.
147
+ - ZIP archives are read in memory with limits on size, file count and compression ratio.
148
+ - From e-Defter it keeps only what the checks and the trial balance need; entry comments, document
149
+ numbers and people's names are not read.
150
+ - Tests use synthetic documents only. `ebelge sample` writes the same kind of made-up files.
151
+
152
+ See [LIMITS.md](LIMITS.md) for what it does not do.
153
+
154
+ ## Development
155
+
156
+ ```bash
157
+ uv sync --all-extras
158
+ uv run pytest
159
+ uv run ruff check . && uv run ruff format --check . && uv run mypy src
160
+ ```
161
+
162
+ Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md).
163
+
164
+ ## License
165
+
166
+ Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE). GİB schemas are not included.
@@ -0,0 +1,143 @@
1
+ # eqlx-ebelge
2
+
3
+ Read Turkish **e-Fatura** (UBL-TR) and **e-Defter** (XBRL GL) files: clean data, a trial balance
4
+ (mizan), and consistency checks that catch wrong totals, invalid tax ids, duplicate invoices and
5
+ unbalanced journal entries. An optional **MCP server** lets AI agents such as Claude use the same
6
+ functions, read-only.
7
+
8
+ Built by [eqlx](https://eqlx.ai). Part of [eqlx.org](https://eqlx.org), open research and tools.
9
+
10
+ > Status: alpha (0.1.1). Tested on synthetic documents and checked against GİB's public sample
11
+ > packages (e-Fatura, e-Arşiv, e-Defter): on those samples it raises no false alarms, and the
12
+ > findings it does raise are real inconsistencies in the samples. Please report any real-world file it
13
+ > reads wrongly (without sending the file itself).
14
+
15
+ ## Why
16
+
17
+ Lenders, factoring companies and finance teams receive invoices and ledgers as GİB XML and still read
18
+ them by hand or through paid tools. This library turns them into data you can check and analyse,
19
+ locally, with no network access.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ pip install "eqlx-ebelge[mcp] @ git+https://github.com/eqlx-ai/eqlx-ebelge"
25
+ ```
26
+
27
+ Python 3.10+. The core needs only `defusedxml`; `[mcp]` adds the MCP server.
28
+
29
+ ## Command line
30
+
31
+ ```bash
32
+ ebelge sample demo # write 10 synthetic files to try it on
33
+ ebelge check demo # every check, on files, folders or ZIP archives
34
+ ebelge invoices demo --csv # one row per invoice
35
+ ebelge mizan demo # trial balance from e-Defter journals (add --level sub)
36
+ ```
37
+
38
+ ```text
39
+ $ ebelge check demo
40
+ 10 documents: 9 invoices, 1 ledger files (7 entries). 2 errors, 1 warnings, 0 info.
41
+
42
+ severity code file message
43
+ error payable fatura_08_toplam_hatali.xml TaxInclusiveAmount - withholding + rounding = 4682.88, PayableAmount is 99999.99 (gap 95317.11)
44
+ error tax_id_check_digit fatura_09_vkn_hatali.xml supplier VKN 4477127821 fails its check digit
45
+ warning possible_duplicate fatura_02.xml supplier 4477127820, same customer, 2026-10-07, payable 10140.12: EQX2026000000002 (fatura_02.xml), EQX2026000000007 (fatura_07.xml)
46
+
47
+ $ ebelge mizan demo
48
+ account name debit credit debit_bal credit_bal
49
+ 100 KASA 10000.00 8500.00 1500.00 0
50
+ 102 BANKALAR 560000.00 10000.00 550000.00 0
51
+ 120 ALICILAR 90000.00 60000.00 30000.00 0
52
+ ...
53
+ ```
54
+
55
+ `ebelge check` exits with code 1 when it finds an error, so it can gate a pipeline.
56
+
57
+ ## Python
58
+
59
+ ```python
60
+ from pathlib import Path
61
+ import eqlx_ebelge as eb
62
+
63
+ inv = eb.read_invoice(Path("fatura.xml").read_bytes(), "fatura.xml")
64
+ inv.supplier.tax_id, inv.totals.payable, [line.name for line in inv.lines]
65
+ eb.check_invoice(inv) # list of Finding(code, severity, message, ...)
66
+
67
+ report = eb.scan(["inbox/", "archive.zip"]) # every document, every check, duplicates across all
68
+ report.summary()
69
+
70
+ ledgers = [eb.read_ledger(p.read_bytes(), p.name) for p in sorted(Path("edefter").glob("*.xml"))]
71
+ rows = eb.trial_balance(ledgers) # e.g. twelve monthly journals -> one year's mizan
72
+ ```
73
+
74
+ Amounts are `Decimal`, never floats.
75
+
76
+ ## Checks
77
+
78
+ | Code | Severity | What it catches |
79
+ |---|---|---|
80
+ | `tax_id_check_digit`, `tax_id_length`, `tax_id_missing` | error | VKN or TCKN that fails its check digit, has the wrong length, or is missing |
81
+ | `lines_total` | error | invoice lines do not add up to `LineExtensionAmount` |
82
+ | `tax_total`, `tax_inclusive` | error | tax subtotals or the tax-inclusive total do not add up |
83
+ | `payable` | error above 1 TRY, else warning | payable amount differs from tax-inclusive total minus withholding (tevkifat) |
84
+ | `line_amount`, `tax_rate` | warning | quantity x price - discount, or base x rate, differs from what the line or tax says |
85
+ | `number_format`, `number_year`, `uuid_format` | warning | invoice number is not 3 characters + year + 9 digits, its year differs from the date, malformed ETTN |
86
+ | `duplicate_uuid`, `duplicate_number` | error | the same ETTN, or the same supplier and number, appears more than once |
87
+ | `possible_duplicate` | warning | same supplier, customer, date and amount under different numbers |
88
+ | `entry_unbalanced`, `entry_total`, `ledger_unbalanced` | error | a journal entry, its header totals, or the whole file do not balance |
89
+ | `counter_repeat` / `counter_gap` | error / warning | journal entry counters repeat or skip |
90
+ | `date_outside_period` | warning | an entry dated outside the period the file covers |
91
+ | `placeholder_tckn`, `same_party`, `account_code`, `unsupported` | info | context worth knowing |
92
+ | `unreadable` | error | a file that is malformed or unsafe to parse |
93
+
94
+ Tolerances: one kuruş per comparison, plus half a kuruş per line where per-line rounding adds up.
95
+
96
+ ## MCP server (for Claude and other agents)
97
+
98
+ The server exposes four read-only tools: `list_documents`, `check`, `read_invoices` and
99
+ `trial_balance`. It reads only inside the folder you give it; `..`, absolute paths and symlinks that
100
+ point outside are refused.
101
+
102
+ Claude Code:
103
+
104
+ ```bash
105
+ claude mcp add ebelge -- ebelge mcp --root /path/to/invoices
106
+ ```
107
+
108
+ Claude Desktop (`claude_desktop_config.json`):
109
+
110
+ ```json
111
+ {
112
+ "mcpServers": {
113
+ "ebelge": { "command": "ebelge", "args": ["mcp", "--root", "/path/to/invoices"] }
114
+ }
115
+ }
116
+ ```
117
+
118
+ Then ask, for example: *"Bu klasördeki faturaları kontrol et, sorunlu olanları ve mükerrerleri göster."*
119
+
120
+ ## Safety and privacy
121
+
122
+ - Runs locally. No network access, no telemetry.
123
+ - XML with a DOCTYPE is refused, which blocks entity-expansion and external-entity (XXE) attacks.
124
+ - ZIP archives are read in memory with limits on size, file count and compression ratio.
125
+ - From e-Defter it keeps only what the checks and the trial balance need; entry comments, document
126
+ numbers and people's names are not read.
127
+ - Tests use synthetic documents only. `ebelge sample` writes the same kind of made-up files.
128
+
129
+ See [LIMITS.md](LIMITS.md) for what it does not do.
130
+
131
+ ## Development
132
+
133
+ ```bash
134
+ uv sync --all-extras
135
+ uv run pytest
136
+ uv run ruff check . && uv run ruff format --check . && uv run mypy src
137
+ ```
138
+
139
+ Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md).
140
+
141
+ ## License
142
+
143
+ Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE). GİB schemas are not included.
@@ -0,0 +1,86 @@
1
+ [project]
2
+ name = "eqlx-ebelge"
3
+ version = "0.1.1"
4
+ description = "Read Turkish e-Fatura (UBL-TR) and e-Defter (XBRL-GL) files: clean data, trial balance, consistency checks, and an MCP server for AI agents."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "Apache-2.0"
8
+ license-files = ["LICENSE"]
9
+ keywords = [
10
+ "e-fatura",
11
+ "e-defter",
12
+ "ubl-tr",
13
+ "xbrl-gl",
14
+ "gib",
15
+ "turkey",
16
+ "invoice",
17
+ "trial balance",
18
+ "mcp",
19
+ ]
20
+ classifiers = [
21
+ "Development Status :: 3 - Alpha",
22
+ "Intended Audience :: Financial and Insurance Industry",
23
+ "Intended Audience :: Developers",
24
+ "Natural Language :: Turkish",
25
+ "Programming Language :: Python :: 3",
26
+ "Topic :: Office/Business :: Financial :: Accounting",
27
+ ]
28
+ dependencies = ["defusedxml>=0.7"]
29
+
30
+ [[project.authors]]
31
+ name = "Can Demir"
32
+ email = "can.demir@eqlx.ai"
33
+
34
+ [project.optional-dependencies]
35
+ mcp = ["mcp>=2.3.0"]
36
+
37
+ [project.scripts]
38
+ ebelge = "eqlx_ebelge.cli:main"
39
+
40
+ [project.urls]
41
+ Homepage = "https://eqlx.org"
42
+ Source = "https://github.com/eqlx-ai/eqlx-ebelge"
43
+
44
+ [build-system]
45
+ requires = ["uv_build>=0.12.16,<0.13.0"]
46
+ build-backend = "uv_build"
47
+
48
+ [dependency-groups]
49
+ dev = [
50
+ "mypy>=2.4.1",
51
+ "pytest>=9.2.0",
52
+ "ruff>=0.17.4",
53
+ "types-defusedxml>=0.7.0.20260504",
54
+ ]
55
+
56
+ [tool.ruff]
57
+ line-length = 110
58
+ target-version = "py310"
59
+
60
+ [tool.ruff.lint]
61
+ select = [
62
+ "E",
63
+ "F",
64
+ "W",
65
+ "I",
66
+ "B",
67
+ "UP",
68
+ "N",
69
+ "SIM",
70
+ "RUF",
71
+ ]
72
+ ignore = [
73
+ "RUF001",
74
+ "RUF002",
75
+ "RUF003",
76
+ ]
77
+
78
+ [tool.ruff.lint.per-file-ignores]
79
+ "tests/*" = ["E501"]
80
+
81
+ [tool.mypy]
82
+ strict = true
83
+
84
+ [[tool.mypy.overrides]]
85
+ module = ["mcp.*"]
86
+ ignore_missing_imports = true
@@ -0,0 +1,67 @@
1
+ [project]
2
+ name = "eqlx-ebelge"
3
+ version = "0.1.1"
4
+ description = "Read Turkish e-Fatura (UBL-TR) and e-Defter (XBRL-GL) files: clean data, trial balance, consistency checks, and an MCP server for AI agents."
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "Can Demir", email = "can.demir@eqlx.ai" }
8
+ ]
9
+ requires-python = ">=3.10"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE"]
12
+ keywords = ["e-fatura", "e-defter", "ubl-tr", "xbrl-gl", "gib", "turkey", "invoice", "trial balance", "mcp"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Intended Audience :: Financial and Insurance Industry",
16
+ "Intended Audience :: Developers",
17
+ "Natural Language :: Turkish",
18
+ "Programming Language :: Python :: 3",
19
+ "Topic :: Office/Business :: Financial :: Accounting",
20
+ ]
21
+ dependencies = [
22
+ "defusedxml>=0.7",
23
+ ]
24
+
25
+ [project.optional-dependencies]
26
+ mcp = [
27
+ "mcp>=2.3.0",
28
+ ]
29
+
30
+ [build-system]
31
+ requires = ["uv_build>=0.12.16,<0.13.0"]
32
+ build-backend = "uv_build"
33
+
34
+ [dependency-groups]
35
+ dev = [
36
+ "mypy>=2.4.1",
37
+ "pytest>=9.2.0",
38
+ "ruff>=0.17.4",
39
+ "types-defusedxml>=0.7.0.20260504",
40
+ ]
41
+
42
+ [project.scripts]
43
+ ebelge = "eqlx_ebelge.cli:main"
44
+
45
+ [project.urls]
46
+ Homepage = "https://eqlx.org"
47
+ Source = "https://github.com/eqlx-ai/eqlx-ebelge"
48
+
49
+ [tool.ruff]
50
+ line-length = 110
51
+ target-version = "py310"
52
+
53
+ [tool.ruff.lint]
54
+ select = ["E", "F", "W", "I", "B", "UP", "N", "SIM", "RUF"]
55
+ # Turkish letters (ı, İ, ş, ğ) are intended in names, comments and sample data.
56
+ ignore = ["RUF001", "RUF002", "RUF003"]
57
+
58
+ [tool.ruff.lint.per-file-ignores]
59
+ # XML fixtures read best on one line.
60
+ "tests/*" = ["E501"]
61
+
62
+ [tool.mypy]
63
+ strict = true
64
+
65
+ [[tool.mypy.overrides]]
66
+ module = ["mcp.*"]
67
+ ignore_missing_imports = true
@@ -0,0 +1,38 @@
1
+ """eqlx-ebelge: read Turkish e-Fatura (UBL-TR) and e-Defter (XBRL GL) files.
2
+
3
+ Clean data, a trial balance, and consistency checks, all locally. An optional MCP server lets AI agents use
4
+ the same functions read-only.
5
+ """
6
+
7
+ __version__ = "0.1.1"
8
+
9
+ from .errors import EbelgeError, Finding
10
+ from .ids import is_valid_tax_id, is_valid_tckn, is_valid_vkn
11
+ from .invoice import Invoice, check_invoice, find_duplicates, read_invoice, read_invoices
12
+ from .ledger import Ledger, TrialBalanceRow, check_ledger, read_ledger, trial_balance
13
+ from .report import Report, scan
14
+ from .sources import Document, Limits, iter_documents
15
+
16
+ __all__ = [
17
+ "Document",
18
+ "EbelgeError",
19
+ "Finding",
20
+ "Invoice",
21
+ "Ledger",
22
+ "Limits",
23
+ "Report",
24
+ "TrialBalanceRow",
25
+ "__version__",
26
+ "check_invoice",
27
+ "check_ledger",
28
+ "find_duplicates",
29
+ "is_valid_tax_id",
30
+ "is_valid_tckn",
31
+ "is_valid_vkn",
32
+ "iter_documents",
33
+ "read_invoice",
34
+ "read_invoices",
35
+ "read_ledger",
36
+ "scan",
37
+ "trial_balance",
38
+ ]