A Python library for calculating US Social Security, Medicare, and Federal Income taxes.
Project description
Disclaimer: This library is not intended to be used for tax advice. Please consult a tax professional for any tax-related questions or concerns.
Python-Taxes is a library designed to make calculating US Federal taxes easy.
The library supports Social Security, Medicare, and Federal Income taxes for tax years 2023 to 2025. Please note, 2025 is only added for future tax season.
CURRENT_TAX_YEAR is set to 2024.
Installation
To install the library, you can use pip or another dependency manager like Poetry.
pip install python-taxes
or
poetry add python-taxes
Usage
Social Security Tax
To calculate Social Security tax, use the social_security module:
from python_taxes.federal import social_security
social_security.withholding(5000) # Returns the amount withheld for Social Security tax
social_security.withholding(
taxable_wages=3000,
taxable_wages_ytd=100000,
self_employed=False,
tax_year=2024,
rounded=True,
)
Medicare Tax
To calculate Medicare tax, use the medicare module. There are two functions available:
medicare.required_withholding - Returns the required amount to withhold for Medicare tax regardless of filing status.
medicare.additional_withholding - Returns the amount that should be withheld based on filing status, including Additional Medicare tax.
from python_taxes.federal import medicare
medicare.required_withholding(5000) # Returns the amount withheld for Medicare tax
medicare.required_withholding(
taxable_wages=5000,
taxable_wages_ytd=100000,
self_employed=True,
rounded=True,
)
medicare.additional_withholding(100000, "married") # Returns the amount withheld for Medicare Tax and Additional Medicare tax, if applicable, based on filing status.
medicare.additional_withholding(
taxable_wages_ytd=100000,
filing_status="married",
self_employed=False,
rounded=True,
)
Federal Income Tax
To calculate Federal Income tax, use the income package. Currently, the only payroll withholding supported is for automated systems. Specifically, the percentage tables in IRS Publication 15-T section 1 (Percentage Method Tables for Automated Payroll Systems).
from python_taxes.federal import income
income.employer_withholding(10000) # Returns the amount withheld for Federal Income tax
income.employer_withholding(
taxable_wages=10000,
pay_frequency="monthly",
filing_status="married",
multiple_jobs=False,
tax_credits=0,
other_income=0,
deductions=0,
extra_withholding=0,
tax_year=2024,
rounded=True,
)
income.employer_withholding_pre_2020(10000) # Returns the amount withheld for Federal Income tax - using this method is required if Form W-4 is from 2019 or earlier.
income.employer_withholding_pre_2020(
taxable_wages=10000,
pay_frequency="monthly",
marital_status="married",
allowances_claimed=0,
extra_withholding=0,
tax_year=2024,
rounded=False,
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_taxes-0.7.0.tar.gz.
File metadata
- Download URL: python_taxes-0.7.0.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f4a5383466fd5159b36a938048fc6955e91e66ffe462d7646ac8f8e4aeeb285
|
|
| MD5 |
ea4a39ac5cdddfff97ca079907111167
|
|
| BLAKE2b-256 |
f5e64d04abdf2379970a9712b990ca5766edf8d603524c0265a07ba979878c34
|
Provenance
The following attestation bundles were made for python_taxes-0.7.0.tar.gz:
Publisher:
release.yml on stacynoland/python-taxes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_taxes-0.7.0.tar.gz -
Subject digest:
9f4a5383466fd5159b36a938048fc6955e91e66ffe462d7646ac8f8e4aeeb285 - Sigstore transparency entry: 604859662
- Sigstore integration time:
-
Permalink:
stacynoland/python-taxes@a291fb0b1fb2038eca8c2c280c772086a0ae87e7 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/stacynoland
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a291fb0b1fb2038eca8c2c280c772086a0ae87e7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_taxes-0.7.0-py3-none-any.whl.
File metadata
- Download URL: python_taxes-0.7.0-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c083cf8b01557f65bbceb3abe96fbff97fa6210f368a6d71eac834ccb347c43
|
|
| MD5 |
a7318dfaf016f985df866b7c7914d060
|
|
| BLAKE2b-256 |
7ea3e8ae11efdb543ac4aacc415836f3c9a8680b5d285f405f4b727d4b150a57
|
Provenance
The following attestation bundles were made for python_taxes-0.7.0-py3-none-any.whl:
Publisher:
release.yml on stacynoland/python-taxes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_taxes-0.7.0-py3-none-any.whl -
Subject digest:
5c083cf8b01557f65bbceb3abe96fbff97fa6210f368a6d71eac834ccb347c43 - Sigstore transparency entry: 604859663
- Sigstore integration time:
-
Permalink:
stacynoland/python-taxes@a291fb0b1fb2038eca8c2c280c772086a0ae87e7 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/stacynoland
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a291fb0b1fb2038eca8c2c280c772086a0ae87e7 -
Trigger Event:
push
-
Statement type: