remitmatch 0.0.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,164 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "autocfg"
7
+ version = "1.5.1"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
10
+
11
+ [[package]]
12
+ name = "chrono"
13
+ version = "0.4.45"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327"
16
+ dependencies = [
17
+ "num-traits",
18
+ ]
19
+
20
+ [[package]]
21
+ name = "heck"
22
+ version = "0.5.0"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
25
+
26
+ [[package]]
27
+ name = "libc"
28
+ version = "0.2.191"
29
+ source = "registry+https://github.com/rust-lang/crates.io-index"
30
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
31
+
32
+ [[package]]
33
+ name = "num-traits"
34
+ version = "0.2.19"
35
+ source = "registry+https://github.com/rust-lang/crates.io-index"
36
+ checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
37
+ dependencies = [
38
+ "autocfg",
39
+ ]
40
+
41
+ [[package]]
42
+ name = "once_cell"
43
+ version = "1.21.4"
44
+ source = "registry+https://github.com/rust-lang/crates.io-index"
45
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
46
+
47
+ [[package]]
48
+ name = "portable-atomic"
49
+ version = "1.15.0"
50
+ source = "registry+https://github.com/rust-lang/crates.io-index"
51
+ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
52
+
53
+ [[package]]
54
+ name = "proc-macro2"
55
+ version = "1.0.107"
56
+ source = "registry+https://github.com/rust-lang/crates.io-index"
57
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
58
+ dependencies = [
59
+ "unicode-ident",
60
+ ]
61
+
62
+ [[package]]
63
+ name = "pyo3"
64
+ version = "0.30.1"
65
+ source = "registry+https://github.com/rust-lang/crates.io-index"
66
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
67
+ dependencies = [
68
+ "libc",
69
+ "once_cell",
70
+ "portable-atomic",
71
+ "pyo3-build-config",
72
+ "pyo3-ffi",
73
+ "pyo3-macros",
74
+ ]
75
+
76
+ [[package]]
77
+ name = "pyo3-build-config"
78
+ version = "0.30.1"
79
+ source = "registry+https://github.com/rust-lang/crates.io-index"
80
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
81
+ dependencies = [
82
+ "target-lexicon",
83
+ ]
84
+
85
+ [[package]]
86
+ name = "pyo3-ffi"
87
+ version = "0.30.1"
88
+ source = "registry+https://github.com/rust-lang/crates.io-index"
89
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
90
+ dependencies = [
91
+ "libc",
92
+ "pyo3-build-config",
93
+ ]
94
+
95
+ [[package]]
96
+ name = "pyo3-macros"
97
+ version = "0.30.1"
98
+ source = "registry+https://github.com/rust-lang/crates.io-index"
99
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
100
+ dependencies = [
101
+ "proc-macro2",
102
+ "pyo3-macros-backend",
103
+ "quote",
104
+ "syn",
105
+ ]
106
+
107
+ [[package]]
108
+ name = "pyo3-macros-backend"
109
+ version = "0.30.1"
110
+ source = "registry+https://github.com/rust-lang/crates.io-index"
111
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
112
+ dependencies = [
113
+ "heck",
114
+ "proc-macro2",
115
+ "quote",
116
+ "syn",
117
+ ]
118
+
119
+ [[package]]
120
+ name = "quote"
121
+ version = "1.0.47"
122
+ source = "registry+https://github.com/rust-lang/crates.io-index"
123
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
124
+ dependencies = [
125
+ "proc-macro2",
126
+ ]
127
+
128
+ [[package]]
129
+ name = "remitmatch"
130
+ version = "0.0.1"
131
+ dependencies = [
132
+ "chrono",
133
+ ]
134
+
135
+ [[package]]
136
+ name = "remitmatch-py"
137
+ version = "0.0.1"
138
+ dependencies = [
139
+ "pyo3",
140
+ "remitmatch",
141
+ ]
142
+
143
+ [[package]]
144
+ name = "syn"
145
+ version = "3.0.10"
146
+ source = "registry+https://github.com/rust-lang/crates.io-index"
147
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
148
+ dependencies = [
149
+ "proc-macro2",
150
+ "quote",
151
+ "unicode-ident",
152
+ ]
153
+
154
+ [[package]]
155
+ name = "target-lexicon"
156
+ version = "0.13.6"
157
+ source = "registry+https://github.com/rust-lang/crates.io-index"
158
+ checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
159
+
160
+ [[package]]
161
+ name = "unicode-ident"
162
+ version = "1.0.27"
163
+ source = "registry+https://github.com/rust-lang/crates.io-index"
164
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
@@ -0,0 +1,17 @@
1
+ [workspace]
2
+ members = ["crates/remitmatch", "crates/remitmatch-py"]
3
+ resolver = "3"
4
+
5
+ [workspace.package]
6
+ version = "0.0.1"
7
+ edition = "2024"
8
+ license = "MIT OR Apache-2.0"
9
+ repository = "https://github.com/eamigo86/remitmatch"
10
+ authors = ["Ernesto Pérez Amigo"]
11
+
12
+ [workspace.lints.rust]
13
+ missing_docs = "deny"
14
+
15
+ [workspace.lints.clippy]
16
+ missing_errors_doc = "deny"
17
+ missing_panics_doc = "deny"
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ernesto Pérez Amigo
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,50 @@
1
+ Metadata-Version: 2.4
2
+ Name: remitmatch
3
+ Version: 0.0.1
4
+ Classifier: Development Status :: 1 - Planning
5
+ Classifier: Intended Audience :: Developers
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Rust
8
+ Classifier: Topic :: Office/Business :: Financial :: Accounting
9
+ Classifier: Typing :: Typed
10
+ License-File: LICENSE-MIT
11
+ License-File: LICENSE-APACHE
12
+ Summary: Match bank payments to open invoices (1:1, 1:N, N:1) and explain every match with a per-signal score.
13
+ Keywords: reconciliation,invoices,payments,fintech,pyo3
14
+ Author: Ernesto Pérez Amigo
15
+ License-Expression: MIT OR Apache-2.0
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
18
+ Project-URL: RFC, https://github.com/eamigo86/remitmatch/blob/main/docs/rfc/0001-remitmatch.md
19
+ Project-URL: Repository, https://github.com/eamigo86/remitmatch
20
+
21
+ # remitmatch
22
+
23
+ A Python library with a Rust core (PyO3) that matches bank payments to open invoices,
24
+ including split and grouped payments (1:1, 1:N and N:1), and explains every match with a
25
+ per-signal score. Remittance matching is the accounts-receivable term for linking an
26
+ incoming payment to the invoices it settles.
27
+
28
+ **Status:** name reserved, under active development
29
+
30
+ The design is described in
31
+ [RFC 0001](https://github.com/eamigo86/remitmatch/blob/main/docs/rfc/0001-remitmatch.md).
32
+
33
+ ## Install
34
+
35
+ Python:
36
+
37
+ ```bash
38
+ pip install remitmatch
39
+ ```
40
+
41
+ Rust:
42
+
43
+ ```bash
44
+ cargo add remitmatch
45
+ ```
46
+
47
+ ## License
48
+
49
+ Licensed under either of the MIT license or the Apache License, Version 2.0, at your option.
50
+
@@ -0,0 +1,29 @@
1
+ # remitmatch
2
+
3
+ A Python library with a Rust core (PyO3) that matches bank payments to open invoices,
4
+ including split and grouped payments (1:1, 1:N and N:1), and explains every match with a
5
+ per-signal score. Remittance matching is the accounts-receivable term for linking an
6
+ incoming payment to the invoices it settles.
7
+
8
+ **Status:** name reserved, under active development
9
+
10
+ The design is described in
11
+ [RFC 0001](https://github.com/eamigo86/remitmatch/blob/main/docs/rfc/0001-remitmatch.md).
12
+
13
+ ## Install
14
+
15
+ Python:
16
+
17
+ ```bash
18
+ pip install remitmatch
19
+ ```
20
+
21
+ Rust:
22
+
23
+ ```bash
24
+ cargo add remitmatch
25
+ ```
26
+
27
+ ## License
28
+
29
+ Licensed under either of the MIT license or the Apache License, Version 2.0, at your option.
@@ -0,0 +1,17 @@
1
+ [package]
2
+ name = "remitmatch"
3
+ description = "Match bank payments to open invoices (1:1, 1:N, N:1) and explain every match with a per-signal score."
4
+ readme = "README.md"
5
+ keywords = ["reconciliation", "invoices", "payments", "fintech", "pyo3"]
6
+ categories = ["finance", "algorithms"]
7
+ version.workspace = true
8
+ edition.workspace = true
9
+ license.workspace = true
10
+ repository.workspace = true
11
+ authors.workspace = true
12
+
13
+ [dependencies]
14
+ chrono = { version = "0.4.45", default-features = false }
15
+
16
+ [lints]
17
+ workspace = true
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ernesto Pérez Amigo
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,29 @@
1
+ # remitmatch
2
+
3
+ A Python library with a Rust core (PyO3) that matches bank payments to open invoices,
4
+ including split and grouped payments (1:1, 1:N and N:1), and explains every match with a
5
+ per-signal score. Remittance matching is the accounts-receivable term for linking an
6
+ incoming payment to the invoices it settles.
7
+
8
+ **Status:** name reserved, under active development
9
+
10
+ The design is described in
11
+ [RFC 0001](https://github.com/eamigo86/remitmatch/blob/main/docs/rfc/0001-remitmatch.md).
12
+
13
+ ## Install
14
+
15
+ Python:
16
+
17
+ ```bash
18
+ pip install remitmatch
19
+ ```
20
+
21
+ Rust:
22
+
23
+ ```bash
24
+ cargo add remitmatch
25
+ ```
26
+
27
+ ## License
28
+
29
+ Licensed under either of the MIT license or the Apache License, Version 2.0, at your option.
@@ -0,0 +1,164 @@
1
+ //! Matches bank payments to open invoices and explains every match.
2
+ //!
3
+ //! Version 0.0.1 reserves the crate name and defines the public data model from
4
+ //! RFC 0001. It contains no matching logic yet; the first matching engine is
5
+ //! planned for 0.1.0.
6
+ //!
7
+ //! All monetary amounts are integers in minor units (for example cents), never
8
+ //! floating-point numbers.
9
+
10
+ use std::collections::BTreeMap;
11
+
12
+ use chrono::NaiveDate;
13
+
14
+ /// Returns the version of this crate.
15
+ ///
16
+ /// # Examples
17
+ ///
18
+ /// ```
19
+ /// assert_eq!(remitmatch::version(), env!("CARGO_PKG_VERSION"));
20
+ /// ```
21
+ #[must_use]
22
+ pub fn version() -> &'static str {
23
+ env!("CARGO_PKG_VERSION")
24
+ }
25
+
26
+ /// An open receivable that payments can settle.
27
+ #[derive(Debug, Clone, PartialEq)]
28
+ pub struct Invoice {
29
+ /// Unique invoice identifier in the caller's system.
30
+ pub id: String,
31
+ /// Human-facing invoice number searched for in payment references.
32
+ pub number: String,
33
+ /// Outstanding amount in minor units.
34
+ pub amount_minor: i64,
35
+ /// ISO 4217 currency code; invoices only match payments in the same currency.
36
+ pub currency: String,
37
+ /// Date the invoice was issued.
38
+ pub issue_date: NaiveDate,
39
+ /// Date payment is expected.
40
+ pub due_date: NaiveDate,
41
+ /// Customer name as stored in the ledger.
42
+ pub counterparty: String,
43
+ /// Partition key (company, account); different scopes never match.
44
+ pub scope: String,
45
+ }
46
+
47
+ /// A bank movement received that may settle one or more invoices.
48
+ #[derive(Debug, Clone, PartialEq)]
49
+ pub struct Payment {
50
+ /// Unique movement identifier from the bank feed.
51
+ pub id: String,
52
+ /// Received amount in minor units.
53
+ pub amount_minor: i64,
54
+ /// ISO 4217 currency code.
55
+ pub currency: String,
56
+ /// Date the funds were credited.
57
+ pub value_date: NaiveDate,
58
+ /// Free-text remittance information from the bank.
59
+ pub reference: String,
60
+ /// Payer name as reported by the bank.
61
+ pub counterparty: String,
62
+ /// Partition key; must equal the invoice scope to match.
63
+ pub scope: String,
64
+ }
65
+
66
+ /// Tolerances and thresholds that drive matching.
67
+ #[derive(Debug, Clone, PartialEq)]
68
+ pub struct MatchConfig {
69
+ /// Absolute amount difference accepted, in minor units (for example bank fees).
70
+ pub amount_tolerance_minor: i64,
71
+ /// Maximum number of days between due date and value date.
72
+ pub date_window_days: u32,
73
+ /// Maximum invoices (1:N) or payments (N:1) in one group.
74
+ pub max_group_size: usize,
75
+ /// Score at or above which a match is accepted automatically.
76
+ pub auto_threshold: f64,
77
+ /// Score at or above which a match is proposed for review.
78
+ pub suggest_threshold: f64,
79
+ /// Candidates whose scores differ by less than this are flagged ambiguous.
80
+ pub ambiguity_margin: f64,
81
+ /// Relative weight of each signal in the final score.
82
+ pub weights: BTreeMap<String, f64>,
83
+ }
84
+
85
+ impl Default for MatchConfig {
86
+ /// Returns the default configuration defined in RFC 0001.
87
+ fn default() -> Self {
88
+ let weights = [
89
+ ("reference", 0.45),
90
+ ("amount", 0.30),
91
+ ("name", 0.15),
92
+ ("date", 0.10),
93
+ ]
94
+ .into_iter()
95
+ .map(|(signal, weight)| (signal.to_owned(), weight))
96
+ .collect();
97
+ Self {
98
+ amount_tolerance_minor: 0,
99
+ date_window_days: 30,
100
+ max_group_size: 5,
101
+ auto_threshold: 0.90,
102
+ suggest_threshold: 0.60,
103
+ ambiguity_margin: 0.05,
104
+ weights,
105
+ }
106
+ }
107
+ }
108
+
109
+ /// Cardinality of a match.
110
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
111
+ pub enum MatchKind {
112
+ /// One payment settles one invoice.
113
+ OneToOne,
114
+ /// One payment settles several invoices.
115
+ OneToMany,
116
+ /// Several payments settle one invoice.
117
+ ManyToOne,
118
+ }
119
+
120
+ /// How confident the engine is in a proposed match.
121
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
122
+ pub enum MatchStatus {
123
+ /// Accepted automatically.
124
+ Auto,
125
+ /// Proposed for review.
126
+ Suggested,
127
+ /// More than one plausible candidate exists.
128
+ Ambiguous,
129
+ }
130
+
131
+ /// A proposed link between payments and invoices.
132
+ #[derive(Debug, Clone, PartialEq)]
133
+ pub struct Match {
134
+ /// Cardinality of the match.
135
+ pub kind: MatchKind,
136
+ /// Confidence in the match.
137
+ pub status: MatchStatus,
138
+ /// Identifiers of the payments in the match.
139
+ pub payment_ids: Vec<String>,
140
+ /// Identifiers of the invoices in the match.
141
+ pub invoice_ids: Vec<String>,
142
+ /// Final weighted score in the range 0 to 1.
143
+ pub score: f64,
144
+ /// Per-signal scores that explain the final score.
145
+ pub breakdown: BTreeMap<String, f64>,
146
+ /// Amount difference left after matching, in minor units (fees, rounding).
147
+ pub residual_minor: i64,
148
+ }
149
+
150
+ #[cfg(test)]
151
+ mod tests {
152
+ use super::*;
153
+
154
+ #[test]
155
+ fn version_matches_cargo_package_version() {
156
+ assert_eq!(version(), env!("CARGO_PKG_VERSION"));
157
+ }
158
+
159
+ #[test]
160
+ fn default_weights_sum_to_one() {
161
+ let sum: f64 = MatchConfig::default().weights.values().sum();
162
+ assert!((sum - 1.0).abs() < 1e-9);
163
+ }
164
+ }
@@ -0,0 +1,23 @@
1
+ [package]
2
+ name = "remitmatch-py"
3
+ description = "PyO3 bindings for remitmatch."
4
+ publish = false
5
+ version.workspace = true
6
+ edition.workspace = true
7
+ license.workspace = true
8
+ repository.workspace = true
9
+ authors.workspace = true
10
+
11
+ [lib]
12
+ name = "_core"
13
+ crate-type = ["cdylib"]
14
+ # No Rust tests live here; skipping them avoids linking libpython in test binaries.
15
+ test = false
16
+ doctest = false
17
+
18
+ [dependencies]
19
+ remitmatch = { path = "../remitmatch" }
20
+ pyo3 = { version = "0.30.1", features = ["abi3-py310"] }
21
+
22
+ [lints]
23
+ workspace = true
@@ -0,0 +1,18 @@
1
+ //! PyO3 bindings for remitmatch. Exposes the native module `_core`.
2
+
3
+ use pyo3::prelude::*;
4
+
5
+ /// Native extension module for remitmatch. Not part of the public API.
6
+ #[pymodule]
7
+ mod _core {
8
+ use pyo3::prelude::*;
9
+
10
+ /// Return the version of the native core.
11
+ ///
12
+ /// Returns:
13
+ /// The semantic version string of the remitmatch crate.
14
+ #[pyfunction]
15
+ fn version() -> &'static str {
16
+ remitmatch::version()
17
+ }
18
+ }
@@ -0,0 +1,63 @@
1
+ [build-system]
2
+ requires = ["maturin>=1.16,<2.0"]
3
+ build-backend = "maturin"
4
+
5
+ [project]
6
+ name = "remitmatch"
7
+ dynamic = ["version"]
8
+ description = "Match bank payments to open invoices (1:1, 1:N, N:1) and explain every match with a per-signal score."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT OR Apache-2.0"
12
+ license-files = ["LICENSE-MIT", "LICENSE-APACHE"]
13
+ authors = [{ name = "Ernesto Pérez Amigo" }]
14
+ keywords = ["reconciliation", "invoices", "payments", "fintech", "pyo3"]
15
+ classifiers = [
16
+ "Development Status :: 1 - Planning",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Rust",
20
+ "Topic :: Office/Business :: Financial :: Accounting",
21
+ "Typing :: Typed",
22
+ ]
23
+
24
+ [project.urls]
25
+ Repository = "https://github.com/eamigo86/remitmatch"
26
+ RFC = "https://github.com/eamigo86/remitmatch/blob/main/docs/rfc/0001-remitmatch.md"
27
+
28
+ [tool.maturin]
29
+ manifest-path = "crates/remitmatch-py/Cargo.toml"
30
+ python-source = "python"
31
+ module-name = "remitmatch._core"
32
+
33
+ [tool.uv]
34
+ # Rebuild the extension when Rust sources or manifests change.
35
+ cache-keys = [
36
+ { file = "pyproject.toml" },
37
+ { file = "**/Cargo.toml" },
38
+ { file = "**/*.rs" },
39
+ ]
40
+
41
+ [tool.ruff]
42
+ line-length = 100
43
+
44
+ [tool.ruff.lint]
45
+ select = ["E", "F", "I", "UP", "B", "D", "ANN"]
46
+
47
+ [tool.ruff.lint.pydocstyle]
48
+ convention = "google"
49
+
50
+ [tool.mypy]
51
+ strict = true
52
+
53
+ [[tool.mypy.overrides]]
54
+ module = "pyarrow.*"
55
+ ignore_missing_imports = true
56
+
57
+ [dependency-groups]
58
+ dev = [
59
+ "maturin>=1.16.0",
60
+ "mypy>=2.4.1",
61
+ "pytest>=9.2.0",
62
+ "ruff>=0.17.6",
63
+ ]
@@ -0,0 +1,29 @@
1
+ """Match bank payments to open invoices and explain every match.
2
+
3
+ Version 0.0.1 reserves the package name. The matching engine is planned for 0.1.0.
4
+ """
5
+
6
+ from typing import NoReturn
7
+
8
+ from remitmatch._core import version
9
+
10
+ __version__ = version()
11
+ __all__ = ["__version__", "reconcile", "version"]
12
+
13
+
14
+ def reconcile(
15
+ invoices: object,
16
+ payments: object,
17
+ config: object | None = None,
18
+ ) -> NoReturn:
19
+ """Match payments against open invoices.
20
+
21
+ Args:
22
+ invoices: Open invoices to settle.
23
+ payments: Bank movements received.
24
+ config: Tolerances and thresholds; defaults to a standard configuration.
25
+
26
+ Raises:
27
+ NotImplementedError: Always, because the matching engine is not available yet.
28
+ """
29
+ raise NotImplementedError("planned for 0.1.0")
@@ -0,0 +1,163 @@
1
+ """Match bank payments to open invoices and explain every match."""
2
+
3
+ from dataclasses import dataclass, field
4
+ from datetime import date
5
+ from enum import Enum
6
+
7
+ import pyarrow
8
+
9
+ __version__: str
10
+
11
+ def version() -> str:
12
+ """Return the version of the native core.
13
+
14
+ Returns:
15
+ The semantic version string of the package.
16
+ """
17
+
18
+ @dataclass(frozen=True)
19
+ class Invoice:
20
+ """An open receivable that payments can settle.
21
+
22
+ Attributes:
23
+ id: Unique invoice identifier in the caller's system.
24
+ number: Human-facing invoice number searched for in payment references.
25
+ amount_minor: Outstanding amount in minor units (e.g. cents).
26
+ currency: ISO 4217 code; invoices only match payments in the same currency.
27
+ issue_date: Date the invoice was issued.
28
+ due_date: Date payment is expected.
29
+ counterparty: Customer name as stored in the ledger.
30
+ scope: Partition key (company, account); different scopes never match.
31
+ """
32
+
33
+ id: str
34
+ number: str
35
+ amount_minor: int
36
+ currency: str
37
+ issue_date: date
38
+ due_date: date
39
+ counterparty: str
40
+ scope: str = "default"
41
+
42
+ @dataclass(frozen=True)
43
+ class Payment:
44
+ """A bank movement received that may settle one or more invoices.
45
+
46
+ Attributes:
47
+ id: Unique movement identifier from the bank feed.
48
+ amount_minor: Received amount in minor units.
49
+ currency: ISO 4217 code.
50
+ value_date: Date the funds were credited.
51
+ reference: Free-text remittance info / description from the bank.
52
+ counterparty: Payer name as reported by the bank.
53
+ scope: Partition key; must equal the invoice scope to match.
54
+ """
55
+
56
+ id: str
57
+ amount_minor: int
58
+ currency: str
59
+ value_date: date
60
+ reference: str
61
+ counterparty: str
62
+ scope: str = "default"
63
+
64
+ @dataclass(frozen=True)
65
+ class MatchConfig:
66
+ """Tolerances and thresholds that drive matching.
67
+
68
+ Attributes:
69
+ amount_tolerance_minor: Absolute amount difference accepted (e.g. bank fees).
70
+ date_window_days: Max days between due date and value date.
71
+ max_group_size: Max invoices (1:N) or payments (N:1) in one group.
72
+ auto_threshold: Score at or above which a match is accepted automatically.
73
+ suggest_threshold: Score at or above which a match is proposed for review.
74
+ ambiguity_margin: If the best two candidates differ by less than this, flag ambiguous.
75
+ weights: Relative weight of each signal in the final score.
76
+ """
77
+
78
+ amount_tolerance_minor: int = 0
79
+ date_window_days: int = 30
80
+ max_group_size: int = 5
81
+ auto_threshold: float = 0.90
82
+ suggest_threshold: float = 0.60
83
+ ambiguity_margin: float = 0.05
84
+ weights: dict[str, float] = field(
85
+ default_factory=lambda: {"reference": 0.45, "amount": 0.30, "name": 0.15, "date": 0.10}
86
+ )
87
+
88
+ class MatchKind(Enum):
89
+ """Cardinality of a match."""
90
+
91
+ ONE_TO_ONE = "1:1"
92
+ ONE_TO_MANY = "1:N"
93
+ MANY_TO_ONE = "N:1"
94
+
95
+ class MatchStatus(Enum):
96
+ """How confident the engine is in a proposed match."""
97
+
98
+ AUTO = "auto"
99
+ SUGGESTED = "suggested"
100
+ AMBIGUOUS = "ambiguous"
101
+
102
+ @dataclass(frozen=True)
103
+ class Match:
104
+ """A proposed link between payments and invoices.
105
+
106
+ Attributes:
107
+ kind: 1:1, 1:N or N:1.
108
+ status: auto, suggested or ambiguous.
109
+ payment_ids: Payments in the match.
110
+ invoice_ids: Invoices in the match.
111
+ score: Final weighted score in [0, 1].
112
+ breakdown: Per-signal scores that explain the final score.
113
+ residual_minor: Amount difference left after matching (fees, rounding).
114
+ """
115
+
116
+ kind: MatchKind
117
+ status: MatchStatus
118
+ payment_ids: tuple[str, ...]
119
+ invoice_ids: tuple[str, ...]
120
+ score: float
121
+ breakdown: dict[str, float]
122
+ residual_minor: int
123
+
124
+ @dataclass(frozen=True)
125
+ class ReconciliationResult:
126
+ """Output of a reconciliation run.
127
+
128
+ Attributes:
129
+ matches: Proposed matches, best score first.
130
+ unmatched_payments: Payment ids with no acceptable candidate.
131
+ unmatched_invoices: Invoice ids with no acceptable candidate.
132
+ """
133
+
134
+ matches: list[Match]
135
+ unmatched_payments: list[str]
136
+ unmatched_invoices: list[str]
137
+
138
+ def to_arrow(self) -> pyarrow.Table:
139
+ """Return matches as a flat Arrow table (one row per payment-invoice pair).
140
+
141
+ Returns:
142
+ A table with one row for each payment-invoice pair in every match.
143
+ """
144
+
145
+ def reconcile(
146
+ invoices: list[Invoice] | pyarrow.Table,
147
+ payments: list[Payment] | pyarrow.Table,
148
+ config: MatchConfig | None = None,
149
+ ) -> ReconciliationResult:
150
+ """Match payments against open invoices.
151
+
152
+ Runs in Rust and releases the GIL. Each invoice and payment appears in at
153
+ most one match. Inputs may be Python objects or Arrow tables with the same
154
+ column names as the dataclass fields.
155
+
156
+ Args:
157
+ invoices: Open invoices to settle.
158
+ payments: Bank movements received.
159
+ config: Tolerances and thresholds; defaults to MatchConfig().
160
+
161
+ Returns:
162
+ Matches with per-signal breakdown, plus unmatched ids on each side.
163
+ """
@@ -0,0 +1,8 @@
1
+ """Native extension module for remitmatch. Not part of the public API."""
2
+
3
+ def version() -> str:
4
+ """Return the version of the native core.
5
+
6
+ Returns:
7
+ The semantic version string of the remitmatch crate.
8
+ """
File without changes