DEV Community

taxgarden
taxgarden

Posted on

Python Function to Select Correct ITR Form (AY 2026-27)

Filing the wrong ITR form is one of the most common compliance errors for self-employed developers. Here's a deterministic function that returns the correct form given your income sources:

```python def get_itr_form(

has_salary
bool = False,
has_capital_gains
bool = False,
has_business_income
bool = False,
is_presumptive
bool = False, # 44AD/44ADA/44AE
foreign_assets_or_income
bool = False,
is_company_or_llp
bool = False,
is_director_or_unlisted_equity
bool = False,
total_income_above_50L
bool = False,
agricultural_income_above_5k
bool = False,
) -> str: """Returns correct ITR form for AY 2026-27.""" if is_company_or_llp: return 'ITR-6'

if foreign_assets_or_income or is_director_or_unlisted_equity: if has_business_income: return 'ITR-3' return 'ITR-2'

if has_business_income: if is_presumptive: return 'ITR-4' # 44AD/44ADA if income < 3Cr/75L return 'ITR-3'

if has_capital_gains: return 'ITR-2'

if total_income_above_50L or agricultural_income_above_5k: return 'ITR-2'

return 'ITR-1'

Examples print(get_itr_form(has_salary=True)) # ITR-1 print(get_itr_form(has_salary=True, has_capital_gains=True)) # ITR-2 print(get_itr_form(has_business_income=True, is_presumptive=True)) # ITR-4 print(get_itr_form(has_business_income=True)) # ITR-3 ```

Key edge cases AY 2026-27:

LTCG on listed shares (112A) triggers ITR-2, NOT ITR-1 even if otherwise salary-only
Freelancers under 44ADA (professions) use ITR-4 if income under Rs 75 lakh
Crypto/VDA income: many file ITR-2 to be safe
Director in private company: mandatory ITR-2 even with only salary
Form deadlines AY 2026-27:

ITR-1/2/4 (non-audit): July 31, 2026
ITR-3 with tax audit: October 31, 2026
ITR-6 (companies): November 30, 2026
Full ITR form guide: https://taxgarden.in/blog/which-itr-form-ay-2026-27-key-changes

python #tax #india #incometax #ITR

Top comments (0)