py-nuban 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,220 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+ *secret.py
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
201
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
203
+ # you could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
py_nuban-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pogbe Emmanuel
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,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: py-nuban
3
+ Version: 0.1.0
4
+ Summary: Nigerian Bank Account Number prediction. Get a list of possible Nigerian banks based on an account number
5
+ Author-email: Emmanuel Pogbe <mauyonpogbe@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/emmanuel-pogbe/py-nuban
8
+ Project-URL: Documentation, https://github.com/emmanuel-pogbe/py-nuban#readme
9
+ Project-URL: Bug Tracker, https://github.com/emmanuel-pogbe/py-nuban/issues
10
+ Keywords: nuban,nigeria,bank,account-number,fintech,paystack,guess-bank
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Office/Business :: Financial
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.0; extra == "dev"
27
+ Requires-Dist: black; extra == "dev"
28
+ Requires-Dist: ruff; extra == "dev"
29
+ Requires-Dist: mypy; extra == "dev"
30
+ Requires-Dist: twine; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # py-nuban
34
+
35
+ Lightweight Python utilities to detect possible Nigerian banks for a given
36
+ Nigerian Bank Account Number. Useful for validation, or bank account suggestions in payment flows.
37
+
38
+ ## Installation
39
+
40
+ Install from PyPI when published:
41
+
42
+ pip install py-nuban
43
+
44
+ Or install for development from the repository root:
45
+
46
+ pip install -e .
47
+
48
+ ## Quick start
49
+
50
+ ```python
51
+ from py_nuban import get_possible_banks
52
+
53
+ banks = get_possible_banks("1901880678")
54
+ print(banks) # e.g. [('033', 'United Bank for Africa'), ('044', 'Access Bank Nigeria')]
55
+ ```
56
+
57
+ ## What this package does
58
+
59
+ - Validates a 10-digit NUBAN account number (type and length checks).
60
+ - Runs the NUBAN checksum algorithm against all known bank codes and
61
+ returns the banks whose code+serial produce the same check digit.
62
+ - Adds simple heuristics for phone-linked accounts and Moniepoint-style
63
+ accounts so those non-standard account numbers are also considered.
64
+ - Filters results by a manually-assigned `popularity` score to surface
65
+ commonly used banks first.
66
+
67
+ ## NUBAN algorithm
68
+
69
+ To validate a Nigerian bank account number, the system uses the official NUBAN check-digit algorithm. Here's how it works:
70
+ The account number consists of a bank code, a serial number(the first 9 digits of an account number), and a check digit(the last digit of an account number). Because Nigerian banks use bank codes of different lengths (3, 5, or 6 digits), the code first normalizes every bank code to a standard format:
71
+
72
+ 3-digit codes get padded with 000 at the front.
73
+ 5-digit codes get a 9 added at the front.
74
+ 6-digit codes are used as-is.
75
+
76
+ This normalized bank code is then combined with the serial number portion of the account to form a 15-character string. Each of these 15 digits is multiplied by a specific weight from this sequence:
77
+
78
+ `[3, 7, 3, 3, 7, 3, 3, 7, 3, 3, 7, 3, 3, 7, 3]`
79
+
80
+ All the results are added together. The system then calculates what the correct check digit should be (using modulo 10 arithmetic). If the calculated check digit matches the one provided in the account number, the NUBAN is considered valid for that bank.
81
+ This process is repeated across all known banks until a match is found. The result is a reliable way to verify that an account number is correctly formed for its issuing bank.
82
+
83
+ Example (demo):
84
+
85
+ ```python
86
+ # account: 1901880678
87
+ # serial = '190188067' (first 9 digits)
88
+ # check = '8' (last digit)
89
+ from py_nuban import get_possible_banks
90
+ print(get_possible_banks('1901880678'))
91
+ # Example output (depends on the bundled bank data):
92
+ # [('033', 'United Bank for Africa'), ('044', 'Access Bank Nigeria')]
93
+ ```
94
+
95
+ ## Limitations and how this package helps
96
+
97
+ - Many new or smaller microfinance/payment institutions sometimes use non-standard codes
98
+ and algorithms to generate their account numbers.
99
+ That means the NUBAN check alone can miss or misidentify such accounts.
100
+ - To reduce false positives and surface useful results we:
101
+ - Add simple prefix checks (common phone-number prefixes) to detect
102
+ phone-linked accounts and include microfinance providers where
103
+ applicable.
104
+ - Use a manual `popularity` numeric field per bank in the bundled data to
105
+ filter out rarely-used entries. This is a pragmatic heuristic to make
106
+ results more useful in real apps; it is not a guarantee of correctness.
107
+
108
+ These heuristics make the library more practical in production, but they
109
+ also introduce opinionated filtering — see the next section.
110
+
111
+ ## Accuracy and safety notes
112
+
113
+ - Results are a best-effort list of candidate banks, not absolute
114
+ guarantees. Always treat matches as suggestions and confirm with a
115
+ reliable resolver service (like Korapay) or the bank when accuracy is critical.
116
+ You should also ideally provide a fallback for the user to select the bank they use manually
117
+
118
+ ## Contributing
119
+
120
+ Contributions welcome. Please open an issue for data updates, bug reports,
121
+ or feature requests. Include tests and small focused changes. Add a unit
122
+ test under `tests/` and update documentation as needed.
123
+
124
+ ## Testing & CI
125
+
126
+ - Run the small test harness included in `tests/test_main.py`:
127
+
128
+ ## License
129
+
130
+ This project is MIT licensed — see the `LICENSE` file for details.
131
+
@@ -0,0 +1,99 @@
1
+ # py-nuban
2
+
3
+ Lightweight Python utilities to detect possible Nigerian banks for a given
4
+ Nigerian Bank Account Number. Useful for validation, or bank account suggestions in payment flows.
5
+
6
+ ## Installation
7
+
8
+ Install from PyPI when published:
9
+
10
+ pip install py-nuban
11
+
12
+ Or install for development from the repository root:
13
+
14
+ pip install -e .
15
+
16
+ ## Quick start
17
+
18
+ ```python
19
+ from py_nuban import get_possible_banks
20
+
21
+ banks = get_possible_banks("1901880678")
22
+ print(banks) # e.g. [('033', 'United Bank for Africa'), ('044', 'Access Bank Nigeria')]
23
+ ```
24
+
25
+ ## What this package does
26
+
27
+ - Validates a 10-digit NUBAN account number (type and length checks).
28
+ - Runs the NUBAN checksum algorithm against all known bank codes and
29
+ returns the banks whose code+serial produce the same check digit.
30
+ - Adds simple heuristics for phone-linked accounts and Moniepoint-style
31
+ accounts so those non-standard account numbers are also considered.
32
+ - Filters results by a manually-assigned `popularity` score to surface
33
+ commonly used banks first.
34
+
35
+ ## NUBAN algorithm
36
+
37
+ To validate a Nigerian bank account number, the system uses the official NUBAN check-digit algorithm. Here's how it works:
38
+ The account number consists of a bank code, a serial number(the first 9 digits of an account number), and a check digit(the last digit of an account number). Because Nigerian banks use bank codes of different lengths (3, 5, or 6 digits), the code first normalizes every bank code to a standard format:
39
+
40
+ 3-digit codes get padded with 000 at the front.
41
+ 5-digit codes get a 9 added at the front.
42
+ 6-digit codes are used as-is.
43
+
44
+ This normalized bank code is then combined with the serial number portion of the account to form a 15-character string. Each of these 15 digits is multiplied by a specific weight from this sequence:
45
+
46
+ `[3, 7, 3, 3, 7, 3, 3, 7, 3, 3, 7, 3, 3, 7, 3]`
47
+
48
+ All the results are added together. The system then calculates what the correct check digit should be (using modulo 10 arithmetic). If the calculated check digit matches the one provided in the account number, the NUBAN is considered valid for that bank.
49
+ This process is repeated across all known banks until a match is found. The result is a reliable way to verify that an account number is correctly formed for its issuing bank.
50
+
51
+ Example (demo):
52
+
53
+ ```python
54
+ # account: 1901880678
55
+ # serial = '190188067' (first 9 digits)
56
+ # check = '8' (last digit)
57
+ from py_nuban import get_possible_banks
58
+ print(get_possible_banks('1901880678'))
59
+ # Example output (depends on the bundled bank data):
60
+ # [('033', 'United Bank for Africa'), ('044', 'Access Bank Nigeria')]
61
+ ```
62
+
63
+ ## Limitations and how this package helps
64
+
65
+ - Many new or smaller microfinance/payment institutions sometimes use non-standard codes
66
+ and algorithms to generate their account numbers.
67
+ That means the NUBAN check alone can miss or misidentify such accounts.
68
+ - To reduce false positives and surface useful results we:
69
+ - Add simple prefix checks (common phone-number prefixes) to detect
70
+ phone-linked accounts and include microfinance providers where
71
+ applicable.
72
+ - Use a manual `popularity` numeric field per bank in the bundled data to
73
+ filter out rarely-used entries. This is a pragmatic heuristic to make
74
+ results more useful in real apps; it is not a guarantee of correctness.
75
+
76
+ These heuristics make the library more practical in production, but they
77
+ also introduce opinionated filtering — see the next section.
78
+
79
+ ## Accuracy and safety notes
80
+
81
+ - Results are a best-effort list of candidate banks, not absolute
82
+ guarantees. Always treat matches as suggestions and confirm with a
83
+ reliable resolver service (like Korapay) or the bank when accuracy is critical.
84
+ You should also ideally provide a fallback for the user to select the bank they use manually
85
+
86
+ ## Contributing
87
+
88
+ Contributions welcome. Please open an issue for data updates, bug reports,
89
+ or feature requests. Include tests and small focused changes. Add a unit
90
+ test under `tests/` and update documentation as needed.
91
+
92
+ ## Testing & CI
93
+
94
+ - Run the small test harness included in `tests/test_main.py`:
95
+
96
+ ## License
97
+
98
+ This project is MIT licensed — see the `LICENSE` file for details.
99
+
@@ -0,0 +1,55 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel", "setuptools_scm[toml]>=6.2"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "py-nuban"
7
+ dynamic = ["version"]
8
+ description = "Nigerian Bank Account Number prediction. Get a list of possible Nigerian banks based on an account number"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = {text = "MIT"}
12
+ authors = [
13
+ {name = "Emmanuel Pogbe", email = "mauyonpogbe@gmail.com"}
14
+ ]
15
+ keywords = ["nuban", "nigeria", "bank", "account-number", "fintech", "paystack", "guess-bank"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Office/Business :: Financial",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ ]
29
+
30
+ dependencies = [
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest>=7.0",
36
+ "black",
37
+ "ruff",
38
+ "mypy",
39
+ "twine",
40
+ ]
41
+
42
+ [project.urls]
43
+ "Homepage" = "https://github.com/emmanuel-pogbe/py-nuban"
44
+ "Documentation" = "https://github.com/emmanuel-pogbe/py-nuban#readme"
45
+ "Bug Tracker" = "https://github.com/emmanuel-pogbe/py-nuban/issues"
46
+
47
+ [tool.setuptools.packages.find]
48
+ where = ["src"]
49
+ include = ["py_nuban*"]
50
+
51
+ [tool.setuptools.package-data]
52
+ "py_nuban" = ["*.json"] # Important: This includes your banks.json
53
+
54
+ [tool.setuptools_scm]
55
+ write_to = "src/py_nuban/_version.py"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ """
2
+ py-nuban: Nigerian bank account number validator and bank detector.
3
+ """
4
+
5
+ from .main import get_possible_banks, get_set_of_possible_codes
6
+
7
+ __version__ = "0.1.0"
8
+ __all__ = ["get_possible_banks", "get_set_of_possible_codes"]
@@ -0,0 +1,24 @@
1
+ # file generated by vcs-versioning
2
+ # don't change, don't track in version control
3
+ from __future__ import annotations
4
+
5
+ __all__ = [
6
+ "__version__",
7
+ "__version_tuple__",
8
+ "version",
9
+ "version_tuple",
10
+ "__commit_id__",
11
+ "commit_id",
12
+ ]
13
+
14
+ version: str
15
+ __version__: str
16
+ __version_tuple__: tuple[int | str, ...]
17
+ version_tuple: tuple[int | str, ...]
18
+ commit_id: str | None
19
+ __commit_id__: str | None
20
+
21
+ __version__ = version = '0.1.0'
22
+ __version_tuple__ = version_tuple = (0, 1, 0)
23
+
24
+ __commit_id__ = commit_id = 'g76e45f1fd'