itr-tool 1.0.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 (75) hide show
  1. itr_tool-1.0.0/LICENSE +21 -0
  2. itr_tool-1.0.0/MANIFEST.in +14 -0
  3. itr_tool-1.0.0/PKG-INFO +548 -0
  4. itr_tool-1.0.0/README.md +507 -0
  5. itr_tool-1.0.0/itr_tool/__init__.py +2 -0
  6. itr_tool-1.0.0/itr_tool/cli.py +314 -0
  7. itr_tool-1.0.0/itr_tool/config.py +271 -0
  8. itr_tool-1.0.0/itr_tool/config_migrate.py +57 -0
  9. itr_tool-1.0.0/itr_tool/config_wizard.py +455 -0
  10. itr_tool-1.0.0/itr_tool/engine/__init__.py +0 -0
  11. itr_tool-1.0.0/itr_tool/engine/compute.py +310 -0
  12. itr_tool-1.0.0/itr_tool/engine/interest_234.py +138 -0
  13. itr_tool-1.0.0/itr_tool/engine/itr_form_selector.py +91 -0
  14. itr_tool-1.0.0/itr_tool/engine/reconcile.py +91 -0
  15. itr_tool-1.0.0/itr_tool/engine/regime_new.py +141 -0
  16. itr_tool-1.0.0/itr_tool/engine/regime_old.py +97 -0
  17. itr_tool-1.0.0/itr_tool/engine/section_89.py +67 -0
  18. itr_tool-1.0.0/itr_tool/models/__init__.py +0 -0
  19. itr_tool-1.0.0/itr_tool/models/advance_tax.py +11 -0
  20. itr_tool-1.0.0/itr_tool/models/capital_gains.py +136 -0
  21. itr_tool-1.0.0/itr_tool/models/computation.py +75 -0
  22. itr_tool-1.0.0/itr_tool/models/deductions.py +59 -0
  23. itr_tool-1.0.0/itr_tool/models/foreign_assets.py +40 -0
  24. itr_tool-1.0.0/itr_tool/models/other_income.py +22 -0
  25. itr_tool-1.0.0/itr_tool/models/personal.py +46 -0
  26. itr_tool-1.0.0/itr_tool/models/salary.py +56 -0
  27. itr_tool-1.0.0/itr_tool/output/__init__.py +0 -0
  28. itr_tool-1.0.0/itr_tool/output/itr1_json.py +204 -0
  29. itr_tool-1.0.0/itr_tool/output/itr2_json.py +400 -0
  30. itr_tool-1.0.0/itr_tool/output/pdf_report.py +189 -0
  31. itr_tool-1.0.0/itr_tool/output/sti_report.py +494 -0
  32. itr_tool-1.0.0/itr_tool/output/templates/computation.html +148 -0
  33. itr_tool-1.0.0/itr_tool/output/yoy_report.py +109 -0
  34. itr_tool-1.0.0/itr_tool/parsers/__init__.py +0 -0
  35. itr_tool-1.0.0/itr_tool/parsers/ais.py +311 -0
  36. itr_tool-1.0.0/itr_tool/parsers/ais_pdf.py +148 -0
  37. itr_tool-1.0.0/itr_tool/parsers/bank_statement.py +226 -0
  38. itr_tool-1.0.0/itr_tool/parsers/dispatcher.py +371 -0
  39. itr_tool-1.0.0/itr_tool/parsers/employer_perq.py +127 -0
  40. itr_tool-1.0.0/itr_tool/parsers/etrade_benefit.py +7 -0
  41. itr_tool-1.0.0/itr_tool/parsers/etrade_gl.py +186 -0
  42. itr_tool-1.0.0/itr_tool/parsers/form16.py +230 -0
  43. itr_tool-1.0.0/itr_tool/parsers/form26as.py +250 -0
  44. itr_tool-1.0.0/itr_tool/parsers/mf_capital_gains.py +55 -0
  45. itr_tool-1.0.0/itr_tool/parsers/password_wizard.py +189 -0
  46. itr_tool-1.0.0/itr_tool/parsers/rates.py +11 -0
  47. itr_tool-1.0.0/itr_tool/parsers/sbi_ttbr.py +103 -0
  48. itr_tool-1.0.0/itr_tool/parsers/tis.py +108 -0
  49. itr_tool-1.0.0/itr_tool/parsers/vestwise.py +2336 -0
  50. itr_tool-1.0.0/itr_tool/parsers/vestwise_data/SBI_REFERENCE_RATES_USD.csv +1601 -0
  51. itr_tool-1.0.0/itr_tool/parsers/vestwise_data/sale_price_overrides.csv +37 -0
  52. itr_tool-1.0.0/itr_tool/parsers/zerodha.py +93 -0
  53. itr_tool-1.0.0/itr_tool/rules/__init__.py +0 -0
  54. itr_tool-1.0.0/itr_tool/rules/fy2020_21.json +119 -0
  55. itr_tool-1.0.0/itr_tool/rules/fy2021_22.json +120 -0
  56. itr_tool-1.0.0/itr_tool/rules/fy2022_23.json +132 -0
  57. itr_tool-1.0.0/itr_tool/rules/fy2023_24.json +133 -0
  58. itr_tool-1.0.0/itr_tool/rules/fy2024_25.json +156 -0
  59. itr_tool-1.0.0/itr_tool/rules/fy2025_26.json +150 -0
  60. itr_tool-1.0.0/itr_tool/web/__init__.py +0 -0
  61. itr_tool-1.0.0/itr_tool/web/server.py +347 -0
  62. itr_tool-1.0.0/itr_tool.egg-info/PKG-INFO +548 -0
  63. itr_tool-1.0.0/itr_tool.egg-info/SOURCES.txt +73 -0
  64. itr_tool-1.0.0/itr_tool.egg-info/dependency_links.txt +1 -0
  65. itr_tool-1.0.0/itr_tool.egg-info/entry_points.txt +2 -0
  66. itr_tool-1.0.0/itr_tool.egg-info/requires.txt +23 -0
  67. itr_tool-1.0.0/itr_tool.egg-info/top_level.txt +1 -0
  68. itr_tool-1.0.0/pyproject.toml +66 -0
  69. itr_tool-1.0.0/setup.cfg +4 -0
  70. itr_tool-1.0.0/tests/test_config.py +54 -0
  71. itr_tool-1.0.0/tests/test_engine.py +115 -0
  72. itr_tool-1.0.0/tests/test_outputs.py +106 -0
  73. itr_tool-1.0.0/tests/test_parsers.py +147 -0
  74. itr_tool-1.0.0/tests/test_regression.py +163 -0
  75. itr_tool-1.0.0/tests/test_sbi_ttbr.py +41 -0
itr_tool-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kailash Chandrasekaran
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,14 @@
1
+ include LICENSE
2
+ include README.md
3
+ include pyproject.toml
4
+
5
+ # Package data files
6
+ recursive-include itr_tool/rules *.json
7
+ recursive-include itr_tool/output/templates *.html
8
+ recursive-include itr_tool/parsers/vestwise_data *.csv *.ini
9
+
10
+ # Exclude sensitive/test data
11
+ exclude *.pdf *.xlsx *.xls
12
+ prune tests/golden
13
+ prune itr_tool/web/frontend/node_modules
14
+ prune itr_tool/web/frontend/dist
@@ -0,0 +1,548 @@
1
+ Metadata-Version: 2.4
2
+ Name: itr-tool
3
+ Version: 1.0.0
4
+ Summary: Offline Indian Income Tax computation tool for salaried individuals with ESOP/ESPP/RSU
5
+ Author: Kailash Chandrasekaran
6
+ License-Expression: MIT
7
+ Keywords: income-tax,india,itr,tax,esop,espp,form16,ais
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: End Users/Desktop
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Office/Business :: Financial :: Accounting
16
+ Requires-Python: >=3.11
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: click>=8.1
20
+ Requires-Dist: rich>=13.0
21
+ Requires-Dist: pydantic>=2.7
22
+ Requires-Dist: pyyaml>=6.0
23
+ Requires-Dist: openpyxl>=3.1
24
+ Requires-Dist: pdfplumber>=0.10
25
+ Requires-Dist: pymupdf>=1.24
26
+ Requires-Dist: pandas>=2.0
27
+ Requires-Dist: requests>=2.31
28
+ Requires-Dist: jinja2>=3.1
29
+ Requires-Dist: form16x>=2.0
30
+ Requires-Dist: itd-aisparser>=0.1
31
+ Requires-Dist: yfinance>=0.2
32
+ Provides-Extra: web
33
+ Requires-Dist: fastapi>=0.110; extra == "web"
34
+ Requires-Dist: uvicorn>=0.27; extra == "web"
35
+ Requires-Dist: python-multipart>=0.0.9; extra == "web"
36
+ Provides-Extra: dev
37
+ Requires-Dist: pytest>=8.0; extra == "dev"
38
+ Requires-Dist: build; extra == "dev"
39
+ Requires-Dist: twine; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # itr-tool
43
+
44
+ **Offline Indian Income Tax computation tool for salaried individuals with ESOP/ESPP/RSU.**
45
+
46
+ Privacy-first, fully offline CLI. Parses Form 16, AIS, 26AS, E-Trade exports, broker P&L, and mutual fund reports. Computes tax under both old and new regimes, generates ITR-1/ITR-2 JSON, Statement of Total Income (STI), and PDF computation sheets.
47
+
48
+ ---
49
+
50
+ ## Table of Contents
51
+
52
+ 1. [Installation](#installation)
53
+ 2. [Quick Start](#quick-start)
54
+ 3. [Folder Structure](#folder-structure)
55
+ 4. [Supported File Types](#supported-file-types)
56
+ 5. [config.yaml Reference](#configyaml-reference)
57
+ 6. [Commands](#commands)
58
+ 7. [Interactive Config Wizard](#interactive-config-wizard)
59
+ 8. [Encrypted Files & Passwords](#encrypted-files--passwords)
60
+ 9. [Vestwise ESOP/ESPP Workbook](#vestwise-esopespp-workbook)
61
+ 10. [Outputs](#outputs)
62
+ 11. [Multi-Year Usage](#multi-year-usage)
63
+ 12. [FAQ](#faq)
64
+
65
+ ---
66
+
67
+ ## Installation
68
+
69
+ ```bash
70
+ # Clone and install
71
+ git clone <repo-url>
72
+ cd itr-tool
73
+ pip install -e .
74
+
75
+ # Verify
76
+ itr-tool --version
77
+ itr-tool --help
78
+ ```
79
+
80
+ **Requirements:** Python 3.11+
81
+
82
+ **Key dependencies** (installed automatically):
83
+ - `form16x` — Form 16 PDF parser
84
+ - `itd-aisparser` — AIS JSON decryptor
85
+ - `pdfplumber` — PDF text extraction (fallback for encrypted/unusual PDFs)
86
+ - `yfinance` — Stock price lookup for ESOP sale price resolution
87
+ - `openpyxl` — Excel workbook generation
88
+ - `rich` — Beautiful CLI output
89
+
90
+ ---
91
+
92
+ ## Quick Start
93
+
94
+ ```bash
95
+ # 1. Organize your documents (see Folder Structure below)
96
+ # 2. Run the tool — it will guide you through config interactively
97
+ itr-tool compute "C:\Users\Me\IT\2026-27"
98
+
99
+ # Or skip the interactive wizard if config.yaml already exists
100
+ itr-tool compute "C:\Users\Me\IT\2026-27" --no-wizard
101
+
102
+ # Just create/update config.yaml without computing
103
+ itr-tool init "C:\Users\Me\IT\2026-27"
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Folder Structure
109
+
110
+ Create **one folder per assessment year** (AY = FY + 1). The folder name should be the AY (e.g. `2026-27` for FY 2025-26).
111
+
112
+ ```
113
+ IT/
114
+ └── 2026-27/ # Assessment Year folder
115
+ ├── config.yaml # Personal details, deductions, bank accounts
116
+
117
+ ├── Form 16/ # Employer Form 16 PDFs
118
+ │ ├── Employer1_Form16.pdf # (any naming works)
119
+ │ └── Employer2_Form16B.pdf # supports Part A + Part B splits
120
+
121
+ ├── Employer/ # Employer perquisite workings
122
+ │ └── perquisite.pdf # ESOP perquisite rate extraction
123
+
124
+ ├── E-Trade/ # E-Trade exports for ESOP/ESPP
125
+ │ ├── BenefitHistory.xlsx # ★ REQUIRED for Vestwise workbook
126
+ │ ├── G&L_Expanded_*.xlsx # Gains & Losses — STCG/LTCG
127
+ │ └── (can have multiple year files)
128
+
129
+ ├── Stocks/ # Brokerage & MF reports
130
+ │ ├── taxpnl-*.xlsx # Broker tax P&L (Zerodha/Groww)
131
+ │ └── *Capital_Gains*.xlsx # Mutual fund CG report
132
+
133
+ ├── IT/ # Income Tax department documents
134
+ │ ├── *_AIS*.json # AIS JSON (encrypted)
135
+ │ ├── *_AIS*.pdf # AIS PDF
136
+ │ ├── *_TIS*.pdf # TIS PDF
137
+ │ ├── *-26AS*.pdf # Form 26AS
138
+ │ └── Form16*.pdf # Form 16 from IT portal
139
+
140
+ ├── Bank/ # Bank statements (optional)
141
+ │ └── *.pdf / *.csv
142
+
143
+ └── output/ # ← Generated automatically
144
+ ├── STI_2025-26_Name.txt # Statement of Total Income
145
+ ├── ITR2_AY202627.json # ITR-2 JSON (or ITR1_*)
146
+ ├── TaxComputation_2025-26.pdf# PDF computation sheet
147
+ └── ESOP_Summary_2025-26.xlsx # Vestwise ESOP workbook
148
+ ```
149
+
150
+ ### Accepted subfolder names
151
+
152
+ The tool scans for these folder name variants (case-sensitive on Linux, case-insensitive on Windows):
153
+
154
+ | Category | Accepted folder names |
155
+ |---|---|
156
+ | **Form 16** | `Form 16`, `form16`, `Form16`, `form 16`, `To Send` |
157
+ | **E-Trade** | `E-Trade`, `etrade`, `e-trade`, `ESOP ESPP`, `ESOP` |
158
+ | **Employer perq** | `Employer`, `employer` |
159
+ | **Brokerage** | `Stocks`, `stocks`, `broker`, `MF Stocks`, `mf`, `MF` |
160
+ | **IT dept** | `IT`, `it` |
161
+ | **Bank** | `Bank`, `bank`, `Bank Statements` |
162
+
163
+ Files in the **root** of the AY folder are also scanned (e.g. `Form16B.pdf` at root level).
164
+
165
+ ---
166
+
167
+ ## Supported File Types
168
+
169
+ | Type | Format | Auto-detected by | What it extracts |
170
+ |---|---|---|---|
171
+ | **Form 16** | PDF | Folder name or `form16` in filename | Salary, TDS, perquisites, employer details |
172
+ | **AIS JSON** | JSON | `ais` in filename, `.json` extension | Interest, dividends, TDS credits |
173
+ | **AIS PDF** | PDF | `ais` in filename, `.pdf` extension | (metadata only — used for verification) |
174
+ | **26AS** | PDF | `26as` or `form26` in filename | (metadata only) |
175
+ | **E-Trade G&L** | XLSX | `G&L_Expanded` in filename | ESOP sale transactions, STCG/LTCG |
176
+ | **E-Trade Benefit** | XLSX | `BenefitHistory` in filename | Grant vesting history, Schedule FA |
177
+ | **Employer Perq** | PDF | Perquisite workings filename pattern | Perquisite exchange rates for ESOP valuation |
178
+ | **Broker P&L** | XLSX | `taxpnl` in filename | Dividends, equity trades |
179
+ | **MF CG Report** | XLSX | `capital_gains` in filename | Mutual fund capital gains |
180
+ | **Bank Statement** | PDF/CSV | In `bank/` folder | Interest income extraction |
181
+
182
+ ---
183
+
184
+ ## config.yaml Reference
185
+
186
+ The `config.yaml` file contains data that **cannot be auto-extracted** from documents — personal details, deductions, property info, and bank accounts. The interactive wizard helps you create this file.
187
+
188
+ ```yaml
189
+ # ─── Personal Details ───
190
+ pan: ABCDE1234F
191
+ name: Your Full Name
192
+ father_name: Father Name
193
+ dob: 1990-01-15 # YYYY-MM-DD format
194
+ address: "123, Example Street"
195
+ city: Mumbai
196
+ state: Maharashtra
197
+ pincode: "400001"
198
+ email: taxpayer@example.com
199
+ phone: "9800000000"
200
+ aadhaar: "XXXX XXXX XXXX" # optional
201
+
202
+ # ─── Financial Year ───
203
+ financial_year: "2025-26"
204
+ assessment_year: "2026-27" # auto-derived if omitted
205
+ regime: both # old | new | both
206
+
207
+ # ─── AIS Password ───
208
+ ais_password: ABCDE1234F15011990 # PAN + DOB(DDMMYYYY)
209
+
210
+ # ─── Deductions (Chapter VI-A) — Old Regime Only ───
211
+ deductions:
212
+ 80c:
213
+ epf: 150000 # Employee PF contribution
214
+ ppf: 0 # Public Provident Fund
215
+ elss: 50000 # ELSS mutual funds
216
+ lic: 0 # LIC premium
217
+ tuition_fees: 0 # Children tuition fees
218
+ housing_principal: 0 # Housing loan principal
219
+ fd_5year: 0 # 5-year tax saver FD
220
+ other: 0
221
+ 80d:
222
+ self_premium: 25000 # Medical insurance — self/family
223
+ parents_premium: 25000 # Medical insurance — parents
224
+ preventive_checkup: 5000 # Health checkup (max 5K)
225
+ 80ccd:
226
+ employee_nps: 0 # NPS employee contribution (80CCD1)
227
+ additional_nps: 50000 # Additional NPS (80CCD1B, max 50K)
228
+ employer_nps: 0 # Employer NPS (80CCD2, new regime eligible)
229
+ 80e: 0 # Education loan interest (no limit)
230
+ 80g: 0 # Donations
231
+ 80gg: 0 # Rent paid (if no HRA from employer)
232
+
233
+ # ─── HRA Exemption ───
234
+ hra:
235
+ rent_paid_annual: 360000 # Total rent paid in the FY
236
+ is_metro: true # Delhi/Mumbai/Kolkata/Chennai
237
+
238
+ # ─── House Property ───
239
+ house_property:
240
+ - type: self_occupied # self_occupied | let_out
241
+ loan_interest: 200000 # Annual housing loan interest
242
+ # - type: let_out
243
+ # rent_received: 240000
244
+ # municipal_taxes: 12000
245
+ # loan_interest: 180000
246
+
247
+ # ─── Property Capital Gains ───
248
+ property_transactions: []
249
+ # - description: "Apartment in Chennai"
250
+ # purchase_date: "2010-06-15"
251
+ # sale_date: "2025-09-10"
252
+ # purchase_cost: 3600000
253
+ # improvement_cost: 200000
254
+ # sale_consideration: 8500000
255
+ # stamp_duty_value: 8200000 # for S.50C check
256
+ # tds_buyer: 85000 # TDS u/s 194IA
257
+ # exemption_54: 5000000 # Reinvestment in new house
258
+ # exemption_54f: 0
259
+
260
+ # ─── Prior Year Losses (Brought Forward) ───
261
+ prior_year_losses:
262
+ hp_loss_bf: 50000 # House property loss B/F
263
+ stcg_loss_bf: 10000 # Short-term CG loss B/F
264
+ ltcg_loss_bf: 25000 # Long-term CG loss B/F
265
+ source_ay: "2025-26"
266
+
267
+ # ─── Bank Accounts (for refund) ───
268
+ banks:
269
+ - name: Example Bank
270
+ ifsc: EXAM0001234
271
+ account: "123456789012"
272
+ type: savings # savings | current
273
+ - name: Another Bank
274
+ ifsc: ANOT0005678
275
+ account: "987654321098"
276
+ type: savings
277
+ ```
278
+
279
+ ### What's auto-extracted (no config needed)
280
+
281
+ | Data | Source | Auto-detected |
282
+ |---|---|---|
283
+ | Salary (gross, 17(1), 17(2), 17(3)) | Form 16 | Yes |
284
+ | TDS on salary | Form 16 | Yes |
285
+ | Employer name & TAN | Form 16 | Yes |
286
+ | ESOP perquisite details | Form 12BA / Employer perquisite PDF | Yes |
287
+ | ESOP/ESPP STCG & LTCG | E-Trade G&L Expanded | Yes |
288
+ | Bank interest | AIS JSON | Yes |
289
+ | Dividends | AIS JSON / Broker P&L | Yes |
290
+ | TDS on interest/dividends | AIS JSON | Yes |
291
+ | MF capital gains | MF CG report | Yes |
292
+ | SBI TTBR exchange rates | Downloaded from GitHub | Yes |
293
+
294
+ ### What you must enter in config.yaml
295
+
296
+ | Data | Why |
297
+ |---|---|
298
+ | PAN, name, DOB, address | Not reliably in all Form 16 formats |
299
+ | Deductions (80C/D/CCD/E/G) | Not in any document — only you know |
300
+ | HRA details | Rent receipts aren't parsed |
301
+ | House property info | Loan interest certificate not parsed |
302
+ | Property sale transactions | Sale deed details not in standard docs |
303
+ | Prior year losses | From previous year's ITR acknowledgment |
304
+ | Bank accounts | For refund credit — IFSC, account number |
305
+
306
+ ---
307
+
308
+ ## Commands
309
+
310
+ ### `itr-tool compute <FOLDER>`
311
+
312
+ Main command — full pipeline: parse → wizard → compute → generate reports.
313
+
314
+ ```bash
315
+ itr-tool compute "C:\Users\Me\IT\2026-27"
316
+
317
+ # Options:
318
+ --regime old|new|both # Default: both (compare and recommend)
319
+ --fy 2025-26 # Auto-detected from config.yaml
320
+ --ais-password PAN+DOB # Or set in config.yaml
321
+ --output /path/to/out # Default: <FOLDER>/output/
322
+ --no-wizard # Skip interactive config wizard
323
+ ```
324
+
325
+ ### `itr-tool init <FOLDER>`
326
+
327
+ Just run the config wizard — scan documents, auto-fill, prompt, save `config.yaml`. No tax computation.
328
+
329
+ ```bash
330
+ itr-tool init "C:\Users\Me\IT\2026-27"
331
+ ```
332
+
333
+ ### `itr-tool parse <TYPE> <FILE>`
334
+
335
+ Parse a single document and display structured JSON output.
336
+
337
+ ```bash
338
+ itr-tool parse form16 "Form 16.pdf"
339
+ itr-tool parse ais "AIS.json" --password ABCDE1234F15011990
340
+ itr-tool parse auto "some_file.xlsx" # auto-detect type
341
+ ```
342
+
343
+ ### `itr-tool verify <FOLDER>`
344
+
345
+ Cross-verify Form 16 vs AIS vs 26AS for discrepancies before filing.
346
+
347
+ ```bash
348
+ itr-tool verify "C:\Users\Me\IT\2026-27"
349
+ ```
350
+
351
+ ### `itr-tool formats`
352
+
353
+ Display supported file types and expected folder structure.
354
+
355
+ ---
356
+
357
+ ## Interactive Config Wizard
358
+
359
+ When you run `itr-tool compute` (without `--no-wizard`), or `itr-tool init`, the tool:
360
+
361
+ 1. **Scans** all subfolders and detects parseable files
362
+ 2. **Parses** Form 16, AIS, E-Trade, etc. to auto-detect PAN, salary, TDS
363
+ 3. **Shows auto-detected salary** (read-only, from Form 16)
364
+ 4. **Walks through each config section** interactively:
365
+
366
+ ```
367
+ ┌─ Configuration Wizard ────────────────────────────────┐
368
+ │ Press Enter to accept the shown value, │
369
+ │ or type a new value. │
370
+ │ Values in [brackets] are auto-detected or existing. │
371
+ └───────────────────────────────────────────────────────┘
372
+
373
+ ── 1. Personal Details ──
374
+ Financial Year [2025-26]:
375
+ PAN [ABCDE1234F]:
376
+ Full Name [Your Name]:
377
+ ...
378
+
379
+ ── 2. Salary (auto-detected from Form 16) ──
380
+ Employer 1: ACME TECH PVT LTD TAN: DELA12345B Gross: 22,50,000 TDS: 5,20,000
381
+ (not editable in config — extracted from documents)
382
+
383
+ ── 3. Deductions (Chapter VI-A) ──
384
+ Section 80C (limit Rs.1,50,000):
385
+ EPF contribution [1,50,000]:
386
+ ELSS mutual funds [50,000]:
387
+ ...
388
+
389
+ ── 4. HRA Exemption ──
390
+ ── 5. House Property Income ──
391
+ ── 6. Property Capital Gains ──
392
+ ── 7. Prior Year Losses ──
393
+ ── 8. Bank Accounts ──
394
+
395
+ ┌─ Configuration Summary ──────────────┐
396
+ │ Personal │ PAN: ABCDE1234F FY: ... │
397
+ │ Deductions│ 80C: 1,50,000 80D: ... │
398
+ │ ... │ │
399
+ └───────────────────────────────────────┘
400
+ Save this configuration? [Y/n]:
401
+ ```
402
+
403
+ After saving, the tool reloads the config and proceeds with tax computation.
404
+
405
+ ---
406
+
407
+ ## Encrypted Files & Passwords
408
+
409
+ ### Password-protected files the tool handles:
410
+
411
+ | File | Common password | How the tool handles it |
412
+ |---|---|---|
413
+ | **AIS JSON** | PAN + DOB (`ABCDE1234F15011990`) | Set `ais_password` in config.yaml, or prompted |
414
+ | **Form 16 PDF** | Varies by employer (DOB, employee ID) | Prompted interactively with 3 retries |
415
+ | **26AS PDF** | Usually PAN lowercase + DOB | Not parsed yet (metadata only) |
416
+
417
+ ### Password prompt behavior:
418
+
419
+ ```
420
+ 🔒 Form 16 PDF file is encrypted: Employer_Form16B.pdf
421
+ Type password and press Enter. Type 'skip' to skip this file.
422
+ Password (attempt 1/3): ********
423
+ ✗ Wrong password. 2 attempt(s) remaining.
424
+ Password (attempt 2/3): ********
425
+ ✓ Password accepted
426
+ ```
427
+
428
+ - **3 attempts** per file — wrong/empty counts as a failed attempt
429
+ - **Type `skip`** to skip a file immediately
430
+ - **Password is hidden** while typing (like sudo)
431
+ - **Password cache** — once a password works for one Form 16, it's auto-tried for the next Form 16
432
+ - **AIS password** — set it in `config.yaml` to avoid prompts every run
433
+
434
+ ---
435
+
436
+ ## Vestwise ESOP/ESPP Workbook
437
+
438
+ If an `E-Trade/BenefitHistory.xlsx` file is found in any subfolder, the tool automatically runs **Vestwise** to generate a detailed ESOP/ESPP tax workbook.
439
+
440
+ ### Required input
441
+
442
+ | File | Where to get it | Location |
443
+ |---|---|---|
444
+ | **BenefitHistory.xlsx** | E-Trade → My Account → Benefits → Export to Excel | `E-Trade/BenefitHistory.xlsx` |
445
+
446
+ ### What Vestwise generates
447
+
448
+ The output is a multi-sheet Excel workbook (`ESOP_Summary_YYYY-YY.xlsx`) with:
449
+
450
+ | Sheet | Contents |
451
+ |---|---|
452
+ | **Grant Summary** | All grants, vested/unvested/sold quantities, current status |
453
+ | **Sales History** | Every sale transaction with acquisition cost, sale proceeds, STCG/LTCG |
454
+ | **Year-wise Tax Summary** | Capital gains aggregated by FY with subtotals |
455
+ | **Schedule FA (Table A3)** | Foreign asset disclosure — shares held on Dec 31 each year |
456
+ | **Validation** | Cross-checks against E-Trade data, flags discrepancies |
457
+
458
+ ### Key features
459
+
460
+ - **SBI TTBR rates** — Rule 115 compliant USD→INR conversion (auto-downloaded from GitHub)
461
+ - **Sale price resolution** — priority: override file → E-Trade xlsx → yfinance closing price
462
+ - **STCG vs LTCG classification** — 24-month holding period for unlisted/foreign shares
463
+ - **Tax rate calculation** — LTCG 12.5%, STCG at slab rate (30%)
464
+ - **Sale price overrides** — persisted in `vestwise_data/sale_price_overrides.csv` for accuracy
465
+
466
+ ### Note
467
+
468
+ Vestwise runs automatically as Phase 4 when `BenefitHistory.xlsx` is detected. No additional config needed.
469
+
470
+ ---
471
+
472
+ ## Outputs
473
+
474
+ All outputs go to `<FOLDER>/output/`:
475
+
476
+ | File | Description |
477
+ |---|---|
478
+ | `STI_YYYY-YY_Name.txt` | Statement of Total Income — full text report with 7 annexures |
479
+ | `ITR2_AY*.json` or `ITR1_AY*.json` | ITR JSON ready for upload to IT portal (auto-selects form) |
480
+ | `TaxComputation_YYYY-YY.pdf` | PDF computation sheet |
481
+ | `ESOP_Summary_YYYY-YY.xlsx` | Vestwise ESOP workbook (if BenefitHistory.xlsx found) |
482
+
483
+ ### ITR Form Auto-Selection
484
+
485
+ The tool automatically determines whether to generate **ITR-1 (Sahaj)** or **ITR-2**:
486
+
487
+ | Condition | Form |
488
+ |---|---|
489
+ | Salary + interest only, ≤ 50L, no CG, no foreign assets, ≤ 1 HP | **ITR-1** |
490
+ | Has ESOP/equity capital gains | **ITR-2** |
491
+ | Has property capital gains | **ITR-2** |
492
+ | Has foreign assets (ESOP shares) | **ITR-2** |
493
+ | Multiple house properties | **ITR-2** |
494
+ | Total income > 50L | **ITR-2** |
495
+
496
+ ---
497
+
498
+ ## Multi-Year Usage
499
+
500
+ The tool supports running against multiple financial years. Create separate AY folders:
501
+
502
+ ```
503
+ IT/
504
+ ├── 2021-22/ # FY 2020-21
505
+ ├── 2022-23/ # FY 2021-22
506
+ ├── 2023-24/ # FY 2022-23
507
+ ├── 2024-25/ # FY 2023-24
508
+ ├── 2025-26/ # FY 2024-25
509
+ └── 2026-27/ # FY 2025-26
510
+ ```
511
+
512
+ Each folder needs its own `config.yaml` (the wizard creates it). Rule packs for FY 2020-21 through 2025-26 are included, covering slab rates, deduction limits, CII tables, and CG rates for each year.
513
+
514
+ ```bash
515
+ # Run for a specific year
516
+ itr-tool compute "IT/2026-27" --no-wizard
517
+
518
+ # Run all years (batch)
519
+ for dir in IT/202*; do itr-tool compute "$dir" --no-wizard; done
520
+ ```
521
+
522
+ ---
523
+
524
+ ## FAQ
525
+
526
+ **Q: Do I need to sort files into exact subfolder names?**
527
+ No. The tool scans 20+ folder name variants. `Form 16/`, `form16/`, `To Send/Form 16/` all work. Files in the root folder are also detected.
528
+
529
+ **Q: What if I have multiple employers?**
530
+ Put all Form 16 PDFs in the same folder. The tool deduplicates by employer TAN and aggregates salary from all employers.
531
+
532
+ **Q: What if form16x can't parse my Form 16?**
533
+ The tool has a pdfplumber fallback parser with regex-based extraction. If both fail (e.g. scanned/image PDF), you'll see a warning. Consider entering salary manually in a future release.
534
+
535
+ **Q: Is my data sent anywhere?**
536
+ No. Everything runs offline on your machine. The only network call is downloading SBI TTBR exchange rates from a public GitHub CSV (and optional yfinance stock price lookup). No data is uploaded.
537
+
538
+ **Q: How do I update deductions after filing?**
539
+ Edit `config.yaml` directly or run `itr-tool init <folder>` to re-run the wizard.
540
+
541
+ **Q: What Python version do I need?**
542
+ Python 3.11 or newer.
543
+
544
+ ---
545
+
546
+ ## License
547
+
548
+ MIT