Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Imagine if the tax code itself were written in Python.

  def computeTax(**kwargs):
    .. blah blah ..
    return how_much_you_owe
Of course we all know what comes next...

  from scipy.optimize import minimize


In 2014, the Policy Simulation Library [1] added a model called Tax-Simulator [2], which is a Python reimplementation of TAXSIM [3][4]. It is available as open-source [5], and designed to let researchers both change existing policy variables and implement new tax reforms in Python.

[1] https://pslmodels.org/

[2] https://taxcalc.pslmodels.org/

[3] https://taxcalc.pslmodels.org/about/history.html

[4] https://github.com/PSLmodels/Tax-Calculator/blob/master/taxc...

[5] https://github.com/PSLmodels/Tax-Calculator


My team at PolicyEngine [1] is also now further reimplementing Tax-Calculator in the Python-based OpenFisca framework [2]. OpenFisca US [3] includes all tax logic in Tax-Calculator, plus many means-tested benefit programs like SNAP, and some state tax logic (currently only Massachusetts is complete, though we'll finish the country in the next 12-18 months). You can try it in our PolicyEngine US web app [4].

(OpenFisca US is part of the Policy Simulation Library, and it's developed by a number of former Tax-Calculator developers, myself included.)

[1] https://policyengine.org

[2] https://openfisca.org

[3] https://github.com/policyengine/openfisca-us

[4] https://policyengine.org/us


France has an open source implementation of their tax code [0]. The paper [1] gives an overview of the implementation language, mlang.

[0] https://github.com/MLanguage/mlang [1] https://arxiv.org/abs/2011.07966


France has also developed the OpenFisca framework [1] for tax and benefit rules as code, and its OpenFisca France [2] model is widely used (I think significantly more than mlang). We've extended it to the UK [3] and the US [4].

[1] https://openfisca.org

[2] https://github.com/openfisca/openfisca-france

[3] https://github.com/policyengine/openfisca-uk

[4] https://github.com/policyengine/openfisca-us


`policy_current_law.json` is really interesting:

https://github.com/PSLmodels/Tax-Calculator/blob/master/taxc...

Looks like the data in there goes back to 2013/2014. I'd love to see older historical policy data.


It has been proposed in professional tax forums that this is in fact how tax code should be legislated, using some kind of pseudo-code. Even just using symbols for things such as >=, <, and so on would eliminate a lot of the garbage in the verbal version.


This would be incredible -- it feels like the tax form documentation is written in a dialect of Accounting English from the 50s, and just little things like adding some parentheses to group and/or con/disjunctions would go a long ways.

Nearly every year I don't feel confident that I've filled out my taxes accurately, and it's not for lack of trying.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: