iso8583sim 1.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.
Files changed (100) hide show
  1. iso8583sim-1.1.0/.github/workflows/ci.yml +58 -0
  2. iso8583sim-1.1.0/.github/workflows/docs.yml +55 -0
  3. iso8583sim-1.1.0/.github/workflows/publish.yml +50 -0
  4. iso8583sim-1.1.0/.gitignore +59 -0
  5. iso8583sim-1.1.0/.pre-commit-config.yaml +37 -0
  6. iso8583sim-1.1.0/CHANGELOG.md +0 -0
  7. iso8583sim-1.1.0/LICENSE +0 -0
  8. iso8583sim-1.1.0/PKG-INFO +233 -0
  9. iso8583sim-1.1.0/README.md +171 -0
  10. iso8583sim-1.1.0/benchmarks/BASELINE.md +99 -0
  11. iso8583sim-1.1.0/benchmarks/__init__.py +1 -0
  12. iso8583sim-1.1.0/benchmarks/bench_builder.py +154 -0
  13. iso8583sim-1.1.0/benchmarks/bench_parser.py +79 -0
  14. iso8583sim-1.1.0/benchmarks/bench_roundtrip.py +236 -0
  15. iso8583sim-1.1.0/benchmarks/conftest.py +90 -0
  16. iso8583sim-1.1.0/benchmarks/run_all.py +48 -0
  17. iso8583sim-1.1.0/docs/api/core.md +63 -0
  18. iso8583sim-1.1.0/docs/api/demo.md +13 -0
  19. iso8583sim-1.1.0/docs/api/llm.md +93 -0
  20. iso8583sim-1.1.0/docs/architecture/message-flow.md +187 -0
  21. iso8583sim-1.1.0/docs/architecture/module-structure.md +224 -0
  22. iso8583sim-1.1.0/docs/architecture/overview.md +144 -0
  23. iso8583sim-1.1.0/docs/cli/index.md +301 -0
  24. iso8583sim-1.1.0/docs/core/builder.md +199 -0
  25. iso8583sim-1.1.0/docs/core/emv.md +183 -0
  26. iso8583sim-1.1.0/docs/core/index.md +97 -0
  27. iso8583sim-1.1.0/docs/core/parser.md +114 -0
  28. iso8583sim-1.1.0/docs/core/pool.md +200 -0
  29. iso8583sim-1.1.0/docs/core/types.md +253 -0
  30. iso8583sim-1.1.0/docs/core/validator.md +190 -0
  31. iso8583sim-1.1.0/docs/getting-started/concepts.md +179 -0
  32. iso8583sim-1.1.0/docs/getting-started/installation.md +103 -0
  33. iso8583sim-1.1.0/docs/getting-started/quickstart.md +146 -0
  34. iso8583sim-1.1.0/docs/index.md +81 -0
  35. iso8583sim-1.1.0/docs/llm/explainer.md +213 -0
  36. iso8583sim-1.1.0/docs/llm/generator.md +235 -0
  37. iso8583sim-1.1.0/docs/llm/index.md +123 -0
  38. iso8583sim-1.1.0/docs/llm/providers.md +235 -0
  39. iso8583sim-1.1.0/docs/networks/index.md +129 -0
  40. iso8583sim-1.1.0/docs/networks/mastercard.md +186 -0
  41. iso8583sim-1.1.0/docs/networks/others.md +248 -0
  42. iso8583sim-1.1.0/docs/networks/visa.md +154 -0
  43. iso8583sim-1.1.0/docs/performance.md +272 -0
  44. iso8583sim-1.1.0/docs/troubleshooting.md +331 -0
  45. iso8583sim-1.1.0/examples/fields.json +11 -0
  46. iso8583sim-1.1.0/iso8583sim/__init__.py +0 -0
  47. iso8583sim-1.1.0/iso8583sim/cli/__init__.py +4 -0
  48. iso8583sim-1.1.0/iso8583sim/cli/commands.py +314 -0
  49. iso8583sim-1.1.0/iso8583sim/cli/config.py +65 -0
  50. iso8583sim-1.1.0/iso8583sim/cli/formatter.py +110 -0
  51. iso8583sim-1.1.0/iso8583sim/cli/utils.py +128 -0
  52. iso8583sim-1.1.0/iso8583sim/core/__init__.py +57 -0
  53. iso8583sim-1.1.0/iso8583sim/core/_bitmap.pyx +149 -0
  54. iso8583sim-1.1.0/iso8583sim/core/_parser_fast.pyx +169 -0
  55. iso8583sim-1.1.0/iso8583sim/core/_validator_fast.pyx +197 -0
  56. iso8583sim-1.1.0/iso8583sim/core/builder.py +318 -0
  57. iso8583sim-1.1.0/iso8583sim/core/emv.py +347 -0
  58. iso8583sim-1.1.0/iso8583sim/core/parser.py +576 -0
  59. iso8583sim-1.1.0/iso8583sim/core/pool.py +158 -0
  60. iso8583sim-1.1.0/iso8583sim/core/types.py +1447 -0
  61. iso8583sim-1.1.0/iso8583sim/core/validator.py +482 -0
  62. iso8583sim-1.1.0/iso8583sim/demo.py +452 -0
  63. iso8583sim-1.1.0/iso8583sim/llm/__init__.py +65 -0
  64. iso8583sim-1.1.0/iso8583sim/llm/base.py +123 -0
  65. iso8583sim-1.1.0/iso8583sim/llm/explainer.py +162 -0
  66. iso8583sim-1.1.0/iso8583sim/llm/generator.py +219 -0
  67. iso8583sim-1.1.0/iso8583sim/llm/prompts.py +266 -0
  68. iso8583sim-1.1.0/iso8583sim/llm/providers/__init__.py +139 -0
  69. iso8583sim-1.1.0/iso8583sim/llm/providers/anthropic.py +141 -0
  70. iso8583sim-1.1.0/iso8583sim/llm/providers/google.py +138 -0
  71. iso8583sim-1.1.0/iso8583sim/llm/providers/ollama.py +135 -0
  72. iso8583sim-1.1.0/iso8583sim/llm/providers/openai.py +154 -0
  73. iso8583sim-1.1.0/iso8583sim/utils/helpers.py +0 -0
  74. iso8583sim-1.1.0/iso8583sim/web/app.py +0 -0
  75. iso8583sim-1.1.0/mkdocs.yml +104 -0
  76. iso8583sim-1.1.0/notebooks/01_getting_started.ipynb +392 -0
  77. iso8583sim-1.1.0/notebooks/02_parsing_messages.ipynb +628 -0
  78. iso8583sim-1.1.0/notebooks/03_building_messages.ipynb +670 -0
  79. iso8583sim-1.1.0/notebooks/04_network_specifics.ipynb +815 -0
  80. iso8583sim-1.1.0/notebooks/05_emv_data.ipynb +833 -0
  81. iso8583sim-1.1.0/notebooks/06_benchmarking.ipynb +955 -0
  82. iso8583sim-1.1.0/notebooks/07_llm_features.ipynb +474 -0
  83. iso8583sim-1.1.0/pyproject.toml +135 -0
  84. iso8583sim-1.1.0/pytest.ini +39 -0
  85. iso8583sim-1.1.0/setup.py +36 -0
  86. iso8583sim-1.1.0/tests/__init__.py +0 -0
  87. iso8583sim-1.1.0/tests/conftest.py +219 -0
  88. iso8583sim-1.1.0/tests/setup_test_structure.py +25 -0
  89. iso8583sim-1.1.0/tests/test_builder.py +334 -0
  90. iso8583sim-1.1.0/tests/test_cli.py +298 -0
  91. iso8583sim-1.1.0/tests/test_data/test_config.yaml +75 -0
  92. iso8583sim-1.1.0/tests/test_data/test_messages.json +79 -0
  93. iso8583sim-1.1.0/tests/test_demo.py +383 -0
  94. iso8583sim-1.1.0/tests/test_emv.py +288 -0
  95. iso8583sim-1.1.0/tests/test_integration.py +75 -0
  96. iso8583sim-1.1.0/tests/test_llm.py +409 -0
  97. iso8583sim-1.1.0/tests/test_parser.py +256 -0
  98. iso8583sim-1.1.0/tests/test_pool.py +114 -0
  99. iso8583sim-1.1.0/tests/test_types.py +206 -0
  100. iso8583sim-1.1.0/tests/test_validator.py +236 -0
@@ -0,0 +1,58 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ['3.10', '3.11', '3.12']
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -e ".[test]"
28
+
29
+ - name: Run tests
30
+ run: pytest --cov=iso8583sim --cov-report=xml -v
31
+
32
+ - name: Upload coverage
33
+ uses: codecov/codecov-action@v4
34
+ if: matrix.python-version == '3.12'
35
+ with:
36
+ files: coverage.xml
37
+ fail_ci_if_error: false
38
+
39
+ lint:
40
+ runs-on: ubuntu-latest
41
+ steps:
42
+ - uses: actions/checkout@v4
43
+
44
+ - name: Set up Python
45
+ uses: actions/setup-python@v5
46
+ with:
47
+ python-version: '3.12'
48
+
49
+ - name: Install dependencies
50
+ run: |
51
+ python -m pip install --upgrade pip
52
+ pip install ruff mypy
53
+
54
+ - name: Run ruff
55
+ run: ruff check .
56
+
57
+ - name: Run ruff format check
58
+ run: ruff format --check .
@@ -0,0 +1,55 @@
1
+ name: Deploy Documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'docs/**'
9
+ - 'mkdocs.yml'
10
+ - 'iso8583sim/**'
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+ pages: write
16
+ id-token: write
17
+
18
+ concurrency:
19
+ group: "pages"
20
+ cancel-in-progress: false
21
+
22
+ jobs:
23
+ build:
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+
28
+ - name: Set up Python
29
+ uses: actions/setup-python@v5
30
+ with:
31
+ python-version: '3.12'
32
+
33
+ - name: Install dependencies
34
+ run: |
35
+ python -m pip install --upgrade pip
36
+ pip install -e ".[docs]"
37
+
38
+ - name: Build documentation
39
+ run: mkdocs build
40
+
41
+ - name: Upload artifact
42
+ uses: actions/upload-pages-artifact@v3
43
+ with:
44
+ path: site/
45
+
46
+ deploy:
47
+ environment:
48
+ name: github-pages
49
+ url: ${{ steps.deployment.outputs.page_url }}
50
+ runs-on: ubuntu-latest
51
+ needs: build
52
+ steps:
53
+ - name: Deploy to GitHub Pages
54
+ id: deployment
55
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,50 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+
14
+ - name: Set up Python
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: '3.12'
18
+
19
+ - name: Install build dependencies
20
+ run: |
21
+ python -m pip install --upgrade pip
22
+ pip install build twine
23
+
24
+ - name: Build package
25
+ run: python -m build
26
+
27
+ - name: Check package
28
+ run: twine check dist/*
29
+
30
+ - name: Upload artifacts
31
+ uses: actions/upload-artifact@v4
32
+ with:
33
+ name: dist
34
+ path: dist/
35
+
36
+ publish:
37
+ needs: build
38
+ runs-on: ubuntu-latest
39
+ environment: pypi
40
+ permissions:
41
+ id-token: write
42
+ steps:
43
+ - name: Download artifacts
44
+ uses: actions/download-artifact@v4
45
+ with:
46
+ name: dist
47
+ path: dist/
48
+
49
+ - name: Publish to PyPI
50
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,59 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.class
5
+ .Python
6
+ build/
7
+
8
+ # Cython
9
+ *.so
10
+ *.c
11
+ iso8583sim/core/_bitmap.c
12
+ iso8583sim/core/_parser_fast.c
13
+ iso8583sim/core/_validator_fast.c
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+
29
+ # Virtual Environment
30
+ venv/
31
+ .venv/
32
+ ENV/
33
+ env/
34
+
35
+ # IDE
36
+ .idea/
37
+ .vscode/
38
+ *.swp
39
+ *.swo
40
+
41
+ # Testing
42
+ .coverage
43
+ htmlcov/
44
+ .pytest_cache/
45
+ test-results.xml
46
+
47
+ # Distribution
48
+ dist/
49
+ build/
50
+ *.egg-info/
51
+
52
+ # Documentation
53
+ docs/_build/
54
+ /_dev/
55
+
56
+ # Jupyter
57
+ .ipynb_checkpoints/
58
+ notebooks/.ipynb_checkpoints/
59
+ site/
@@ -0,0 +1,37 @@
1
+ # Pre-commit configuration for iso8583sim
2
+ # Install: pre-commit install
3
+ # Run manually: pre-commit run --all-files
4
+
5
+ repos:
6
+ # Ruff - Fast Python linter and formatter
7
+ - repo: https://github.com/astral-sh/ruff-pre-commit
8
+ rev: v0.8.4
9
+ hooks:
10
+ - id: ruff
11
+ args: [--fix, --exit-non-zero-on-fix]
12
+ - id: ruff-format
13
+
14
+ # Mypy - Static type checking
15
+ # TODO: Re-enable in v0.3.0 after fixing type annotations
16
+ # - repo: https://github.com/pre-commit/mirrors-mypy
17
+ # rev: v1.14.1
18
+ # hooks:
19
+ # - id: mypy
20
+ # additional_dependencies:
21
+ # - pydantic>=2.0
22
+ # - typer>=0.9.0
23
+ # args: [--ignore-missing-imports]
24
+ # exclude: ^(tests|benchmarks)/
25
+
26
+ # Pre-commit hooks
27
+ - repo: https://github.com/pre-commit/pre-commit-hooks
28
+ rev: v5.0.0
29
+ hooks:
30
+ - id: trailing-whitespace
31
+ - id: end-of-file-fixer
32
+ - id: check-yaml
33
+ - id: check-json
34
+ - id: check-added-large-files
35
+ args: [--maxkb=500]
36
+ - id: check-merge-conflict
37
+ - id: debug-statements
File without changes
File without changes
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: iso8583sim
3
+ Version: 1.1.0
4
+ Summary: High-performance ISO 8583 message simulator with CLI, Python SDK, and LLM features
5
+ Author-email: Subhadip Mitra <contact@subhadipmitra.com>
6
+ License-File: LICENSE
7
+ Keywords: banking,financial,iso8583,payment,simulator
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Intended Audience :: Financial and Insurance Industry
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Office/Business :: Financial
16
+ Classifier: Topic :: Software Development :: Testing
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: click>=8.0.0
19
+ Requires-Dist: fastapi>=0.68.0
20
+ Requires-Dist: pydantic>=2.0.0
21
+ Requires-Dist: rich>=10.0.0
22
+ Requires-Dist: typer>=0.4.0
23
+ Requires-Dist: uvicorn>=0.15.0
24
+ Provides-Extra: anthropic
25
+ Requires-Dist: anthropic>=0.40.0; extra == 'anthropic'
26
+ Provides-Extra: dev
27
+ Requires-Dist: black>=22.0.0; extra == 'dev'
28
+ Requires-Dist: coverage>=7.4.0; extra == 'dev'
29
+ Requires-Dist: cython>=3.0.0; extra == 'dev'
30
+ Requires-Dist: isort>=5.0.0; extra == 'dev'
31
+ Requires-Dist: mypy>=0.900; extra == 'dev'
32
+ Requires-Dist: pre-commit>=3.5.0; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
34
+ Requires-Dist: pytest-html>=4.1.1; extra == 'dev'
35
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
36
+ Requires-Dist: pyyaml>=6.0.0; extra == 'dev'
37
+ Requires-Dist: ruff>=0.0.290; extra == 'dev'
38
+ Provides-Extra: docs
39
+ Requires-Dist: mkdocs-material>=9.5.0; extra == 'docs'
40
+ Requires-Dist: mkdocs>=1.6.0; extra == 'docs'
41
+ Requires-Dist: mkdocstrings[python]>=0.24.0; extra == 'docs'
42
+ Provides-Extra: google
43
+ Requires-Dist: google-generativeai>=0.8.0; extra == 'google'
44
+ Provides-Extra: llm
45
+ Requires-Dist: anthropic>=0.40.0; extra == 'llm'
46
+ Requires-Dist: google-generativeai>=0.8.0; extra == 'llm'
47
+ Requires-Dist: ollama>=0.4.0; extra == 'llm'
48
+ Requires-Dist: openai>=1.50.0; extra == 'llm'
49
+ Provides-Extra: ollama
50
+ Requires-Dist: ollama>=0.4.0; extra == 'ollama'
51
+ Provides-Extra: openai
52
+ Requires-Dist: openai>=1.50.0; extra == 'openai'
53
+ Provides-Extra: perf
54
+ Requires-Dist: cython>=3.0.0; extra == 'perf'
55
+ Provides-Extra: test
56
+ Requires-Dist: coverage>=7.4.0; extra == 'test'
57
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'test'
58
+ Requires-Dist: pytest-html>=4.1.1; extra == 'test'
59
+ Requires-Dist: pytest>=7.0.0; extra == 'test'
60
+ Requires-Dist: pyyaml>=6.0.0; extra == 'test'
61
+ Description-Content-Type: text/markdown
62
+
63
+ # ISO8583 Simulator
64
+
65
+ [![PyPI version](https://img.shields.io/pypi/v/iso8583sim.svg)](https://pypi.org/project/iso8583sim/)
66
+ [![Python versions](https://img.shields.io/pypi/pyversions/iso8583sim.svg)](https://pypi.org/project/iso8583sim/)
67
+ [![License](https://img.shields.io/github/license/bassrehab/ISO8583-Simulator.svg)](https://github.com/bassrehab/ISO8583-Simulator/blob/main/LICENSE)
68
+ [![CI](https://github.com/bassrehab/ISO8583-Simulator/actions/workflows/ci.yml/badge.svg)](https://github.com/bassrehab/ISO8583-Simulator/actions/workflows/ci.yml)
69
+ [![Documentation](https://img.shields.io/badge/docs-iso8583.subhadipmitra.com-blue.svg)](https://iso8583.subhadipmitra.com)
70
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
71
+
72
+ A modern, high-performance ISO 8583 message simulator with CLI, Python SDK, and interactive Jupyter notebooks.
73
+
74
+ ## Features
75
+
76
+ - **Message Handling**:
77
+ - Parse ISO 8583 messages (180k+ TPS with Cython)
78
+ - Build ISO 8583 messages (150k+ TPS)
79
+ - Validate message structure and content
80
+ - Support for ISO versions (1987, 1993, 2003)
81
+
82
+ - **Network Support**:
83
+ - VISA, Mastercard, AMEX, Discover, JCB, UnionPay
84
+ - Network-specific field validation
85
+ - EMV/chip card data handling (Field 55)
86
+
87
+ - **Multiple Interfaces**:
88
+ - Command Line Interface (CLI)
89
+ - Python SDK for programmatic usage
90
+ - Interactive Jupyter notebooks
91
+
92
+ - **Performance Optimized**:
93
+ - Optional Cython extensions for 2x speedup
94
+ - Object pooling for high-throughput scenarios
95
+ - See [Performance Guide](docs/performance.md)
96
+
97
+ ## Installation
98
+
99
+ ```bash
100
+ pip install iso8583sim
101
+
102
+ # For Cython performance extensions
103
+ pip install iso8583sim[perf]
104
+ python setup.py build_ext --inplace
105
+ ```
106
+
107
+ ## Quick Start
108
+
109
+ ### Python SDK
110
+
111
+ ```python
112
+ from iso8583sim.core.parser import ISO8583Parser
113
+ from iso8583sim.core.builder import ISO8583Builder
114
+ from iso8583sim.core.validator import ISO8583Validator
115
+ from iso8583sim.core.types import ISO8583Message
116
+
117
+ # Build a message
118
+ builder = ISO8583Builder()
119
+ message = ISO8583Message(
120
+ mti="0100",
121
+ fields={
122
+ 0: "0100",
123
+ 2: "4111111111111111",
124
+ 3: "000000",
125
+ 4: "000000001000",
126
+ 11: "123456",
127
+ 41: "TERM0001",
128
+ 42: "MERCHANT123456 ",
129
+ }
130
+ )
131
+ raw = builder.build(message)
132
+
133
+ # Parse a message
134
+ parser = ISO8583Parser()
135
+ parsed = parser.parse(raw)
136
+
137
+ # Validate a message
138
+ validator = ISO8583Validator()
139
+ errors = validator.validate_message(parsed)
140
+ ```
141
+
142
+ ### CLI Usage
143
+
144
+ ```bash
145
+ # Parse a message
146
+ iso8583sim parse "0100..." --version 1987
147
+
148
+ # Build a message
149
+ iso8583sim build --mti 0100 --fields fields.json
150
+
151
+ # Validate a message
152
+ iso8583sim validate "0100..."
153
+
154
+ # Generate sample messages
155
+ iso8583sim generate --type auth --pan 4111111111111111 --amount 1000
156
+ ```
157
+
158
+ ## Interactive Notebooks
159
+
160
+ Learn ISO 8583 with our Jupyter notebooks:
161
+
162
+ | Notebook | Description |
163
+ |----------|-------------|
164
+ | [01_getting_started.ipynb](notebooks/01_getting_started.ipynb) | Basic concepts and quick start |
165
+ | [02_parsing_messages.ipynb](notebooks/02_parsing_messages.ipynb) | Deep dive into message parsing |
166
+ | [03_building_messages.ipynb](notebooks/03_building_messages.ipynb) | Building various message types |
167
+ | [04_network_specifics.ipynb](notebooks/04_network_specifics.ipynb) | VISA, Mastercard, and other networks |
168
+ | [05_emv_data.ipynb](notebooks/05_emv_data.ipynb) | Working with EMV/chip card data |
169
+ | [06_benchmarking.ipynb](notebooks/06_benchmarking.ipynb) | Performance testing and benchmarks |
170
+
171
+ Run locally:
172
+ ```bash
173
+ pip install jupyter
174
+ jupyter notebook notebooks/
175
+ ```
176
+
177
+ ## Performance
178
+
179
+ Benchmarks on Apple Silicon (M-series), Python 3.12:
180
+
181
+ | Operation | Pure Python | With Cython |
182
+ |-----------|-------------|-------------|
183
+ | Parse | ~105k TPS | ~182k TPS |
184
+ | Build | ~150k TPS | ~150k TPS |
185
+ | Roundtrip | ~49k TPS | ~63k TPS |
186
+
187
+ See [benchmarks/BASELINE.md](benchmarks/BASELINE.md) for detailed results.
188
+
189
+ ## Documentation
190
+
191
+ Full documentation is available at **[iso8583.subhadipmitra.com](https://iso8583.subhadipmitra.com)**
192
+
193
+ - [Getting Started](https://iso8583.subhadipmitra.com/getting-started/quickstart/) - Quick start guide
194
+ - [Architecture](https://iso8583.subhadipmitra.com/architecture/overview/) - System design and decisions
195
+ - [API Reference](https://iso8583.subhadipmitra.com/api/core/) - Complete API documentation
196
+ - [Performance Guide](https://iso8583.subhadipmitra.com/performance/) - Optimization techniques
197
+
198
+ ## Development
199
+
200
+ ```bash
201
+ # Clone and setup
202
+ git clone https://github.com/bassrehab/ISO8583-Simulator.git
203
+ cd iso8583sim
204
+ python -m venv .venv
205
+ source .venv/bin/activate
206
+ pip install -e ".[dev]"
207
+
208
+ # Run tests
209
+ pytest
210
+
211
+ # Run benchmarks
212
+ python benchmarks/bench_parser.py
213
+ python benchmarks/bench_roundtrip.py
214
+ ```
215
+
216
+ ## Contributing
217
+
218
+ 1. Fork the repository
219
+ 2. Create your feature branch (`git checkout -b feature/my-feature`)
220
+ 3. Commit your changes (`git commit -am 'Add new feature'`)
221
+ 4. Push to the branch (`git push origin feature/my-feature`)
222
+ 5. Create a Pull Request
223
+
224
+ ## Author
225
+
226
+ **Subhadip Mitra** - [subhadipmitra.com](https://subhadipmitra.com)
227
+
228
+ - GitHub: [@bassrehab](https://github.com/bassrehab)
229
+ - LinkedIn: [subhadipmitra](https://linkedin.com/in/subhadipmitra)
230
+
231
+ ## License
232
+
233
+ MIT License - see [LICENSE](LICENSE) for details.
@@ -0,0 +1,171 @@
1
+ # ISO8583 Simulator
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/iso8583sim.svg)](https://pypi.org/project/iso8583sim/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/iso8583sim.svg)](https://pypi.org/project/iso8583sim/)
5
+ [![License](https://img.shields.io/github/license/bassrehab/ISO8583-Simulator.svg)](https://github.com/bassrehab/ISO8583-Simulator/blob/main/LICENSE)
6
+ [![CI](https://github.com/bassrehab/ISO8583-Simulator/actions/workflows/ci.yml/badge.svg)](https://github.com/bassrehab/ISO8583-Simulator/actions/workflows/ci.yml)
7
+ [![Documentation](https://img.shields.io/badge/docs-iso8583.subhadipmitra.com-blue.svg)](https://iso8583.subhadipmitra.com)
8
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
9
+
10
+ A modern, high-performance ISO 8583 message simulator with CLI, Python SDK, and interactive Jupyter notebooks.
11
+
12
+ ## Features
13
+
14
+ - **Message Handling**:
15
+ - Parse ISO 8583 messages (180k+ TPS with Cython)
16
+ - Build ISO 8583 messages (150k+ TPS)
17
+ - Validate message structure and content
18
+ - Support for ISO versions (1987, 1993, 2003)
19
+
20
+ - **Network Support**:
21
+ - VISA, Mastercard, AMEX, Discover, JCB, UnionPay
22
+ - Network-specific field validation
23
+ - EMV/chip card data handling (Field 55)
24
+
25
+ - **Multiple Interfaces**:
26
+ - Command Line Interface (CLI)
27
+ - Python SDK for programmatic usage
28
+ - Interactive Jupyter notebooks
29
+
30
+ - **Performance Optimized**:
31
+ - Optional Cython extensions for 2x speedup
32
+ - Object pooling for high-throughput scenarios
33
+ - See [Performance Guide](docs/performance.md)
34
+
35
+ ## Installation
36
+
37
+ ```bash
38
+ pip install iso8583sim
39
+
40
+ # For Cython performance extensions
41
+ pip install iso8583sim[perf]
42
+ python setup.py build_ext --inplace
43
+ ```
44
+
45
+ ## Quick Start
46
+
47
+ ### Python SDK
48
+
49
+ ```python
50
+ from iso8583sim.core.parser import ISO8583Parser
51
+ from iso8583sim.core.builder import ISO8583Builder
52
+ from iso8583sim.core.validator import ISO8583Validator
53
+ from iso8583sim.core.types import ISO8583Message
54
+
55
+ # Build a message
56
+ builder = ISO8583Builder()
57
+ message = ISO8583Message(
58
+ mti="0100",
59
+ fields={
60
+ 0: "0100",
61
+ 2: "4111111111111111",
62
+ 3: "000000",
63
+ 4: "000000001000",
64
+ 11: "123456",
65
+ 41: "TERM0001",
66
+ 42: "MERCHANT123456 ",
67
+ }
68
+ )
69
+ raw = builder.build(message)
70
+
71
+ # Parse a message
72
+ parser = ISO8583Parser()
73
+ parsed = parser.parse(raw)
74
+
75
+ # Validate a message
76
+ validator = ISO8583Validator()
77
+ errors = validator.validate_message(parsed)
78
+ ```
79
+
80
+ ### CLI Usage
81
+
82
+ ```bash
83
+ # Parse a message
84
+ iso8583sim parse "0100..." --version 1987
85
+
86
+ # Build a message
87
+ iso8583sim build --mti 0100 --fields fields.json
88
+
89
+ # Validate a message
90
+ iso8583sim validate "0100..."
91
+
92
+ # Generate sample messages
93
+ iso8583sim generate --type auth --pan 4111111111111111 --amount 1000
94
+ ```
95
+
96
+ ## Interactive Notebooks
97
+
98
+ Learn ISO 8583 with our Jupyter notebooks:
99
+
100
+ | Notebook | Description |
101
+ |----------|-------------|
102
+ | [01_getting_started.ipynb](notebooks/01_getting_started.ipynb) | Basic concepts and quick start |
103
+ | [02_parsing_messages.ipynb](notebooks/02_parsing_messages.ipynb) | Deep dive into message parsing |
104
+ | [03_building_messages.ipynb](notebooks/03_building_messages.ipynb) | Building various message types |
105
+ | [04_network_specifics.ipynb](notebooks/04_network_specifics.ipynb) | VISA, Mastercard, and other networks |
106
+ | [05_emv_data.ipynb](notebooks/05_emv_data.ipynb) | Working with EMV/chip card data |
107
+ | [06_benchmarking.ipynb](notebooks/06_benchmarking.ipynb) | Performance testing and benchmarks |
108
+
109
+ Run locally:
110
+ ```bash
111
+ pip install jupyter
112
+ jupyter notebook notebooks/
113
+ ```
114
+
115
+ ## Performance
116
+
117
+ Benchmarks on Apple Silicon (M-series), Python 3.12:
118
+
119
+ | Operation | Pure Python | With Cython |
120
+ |-----------|-------------|-------------|
121
+ | Parse | ~105k TPS | ~182k TPS |
122
+ | Build | ~150k TPS | ~150k TPS |
123
+ | Roundtrip | ~49k TPS | ~63k TPS |
124
+
125
+ See [benchmarks/BASELINE.md](benchmarks/BASELINE.md) for detailed results.
126
+
127
+ ## Documentation
128
+
129
+ Full documentation is available at **[iso8583.subhadipmitra.com](https://iso8583.subhadipmitra.com)**
130
+
131
+ - [Getting Started](https://iso8583.subhadipmitra.com/getting-started/quickstart/) - Quick start guide
132
+ - [Architecture](https://iso8583.subhadipmitra.com/architecture/overview/) - System design and decisions
133
+ - [API Reference](https://iso8583.subhadipmitra.com/api/core/) - Complete API documentation
134
+ - [Performance Guide](https://iso8583.subhadipmitra.com/performance/) - Optimization techniques
135
+
136
+ ## Development
137
+
138
+ ```bash
139
+ # Clone and setup
140
+ git clone https://github.com/bassrehab/ISO8583-Simulator.git
141
+ cd iso8583sim
142
+ python -m venv .venv
143
+ source .venv/bin/activate
144
+ pip install -e ".[dev]"
145
+
146
+ # Run tests
147
+ pytest
148
+
149
+ # Run benchmarks
150
+ python benchmarks/bench_parser.py
151
+ python benchmarks/bench_roundtrip.py
152
+ ```
153
+
154
+ ## Contributing
155
+
156
+ 1. Fork the repository
157
+ 2. Create your feature branch (`git checkout -b feature/my-feature`)
158
+ 3. Commit your changes (`git commit -am 'Add new feature'`)
159
+ 4. Push to the branch (`git push origin feature/my-feature`)
160
+ 5. Create a Pull Request
161
+
162
+ ## Author
163
+
164
+ **Subhadip Mitra** - [subhadipmitra.com](https://subhadipmitra.com)
165
+
166
+ - GitHub: [@bassrehab](https://github.com/bassrehab)
167
+ - LinkedIn: [subhadipmitra](https://linkedin.com/in/subhadipmitra)
168
+
169
+ ## License
170
+
171
+ MIT License - see [LICENSE](LICENSE) for details.