First set environment variable for tax brackets API by running EXPORT TAX_CALCULATOR_API_URL=<url>
. If not set, the default URL (i.e. http://localhost:5001/tax-calculator/tax-year
) will be used.
- Install poetry
pip install poetry
. - Run
poetry install
. - Run
poetry run uvicorn app.main:app --reload
.
- Build container by running
docker build -t tax-calculator .
. - Run docker container by running
docker run -d -p 8000:8000 tax-calculator -e TAX_CALCULATOR_API_URL="<url>"
.
- Poetry
- FastAPI
- Ruff
- MyPy
- Pytest
GET /api/calculate-tax?tax_year=2022&salary=1234567
{
"total_taxes": 385587.65,
"taxes_per_band": {
"0 to 50197": 7529.55,
"50197 to 100392": 10289.97,
"100392 to 155625": 14360.58,
"155625 to 221708": 19164.07,
"More than 221708": 334243.47
},
"effective_rate": 31.23
}