Skip to content

Commit

Permalink
Merge pull request #82 from rickecon/sc
Browse files Browse the repository at this point in the history
Merging
  • Loading branch information
rickecon authored Oct 3, 2024
2 parents d72aef2 + a8c9f4d commit bf28953
Show file tree
Hide file tree
Showing 134 changed files with 1,861 additions and 562 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
- uses: psf/black@stable
with:
options: "-l 79 --check"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniconda-version: "latest"
activate-environment: fiscalsim-us-dev
environment-file: environment.yml
python-version: "3.10"
python-version: "3.11"
auto-activate-base: false
- name: Install package and build documentation
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniconda-version: "latest"
activate-environment: fiscalsim-us-dev
environment-file: environment.yml
python-version: "3.11"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- name: Build package
run: make pip-package
- name: Publish a Python distribution to PyPI
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.0] - 2024-10-03 02:00:00

### Added

- Updates South Carolina tax logic and tests
- Replaces Mambaforge Python installer with Miniforge in GH Actions

## [0.2.9] - 2024-04-11 00:30:00

### Added
Expand Down Expand Up @@ -211,6 +218,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First prototype version based off of openfisca-us and tax-calculator.


[0.3.0]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.9...v0.3.0
[0.2.9]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.8...v0.2.9
[0.2.8]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.7...v0.2.8
[0.2.7]: https://github.com/TheCGO/fiscalsim-us/compare/v0.2.6...v0.2.7
Expand Down
6 changes: 6 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,9 @@
- Limits `docs_check.yml` to only run on pull request commits.
- Updates some tags in `README.md.`
date: 2024-04-11 00:30:00
- bump: minor
changes:
added:
- Updates South Carolina tax logic and tests.
- Replaces Mambaforge Python installer with Miniforge in GH Actions
date: 2024-10-03 02:00:00
9 changes: 9 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
name: fiscalsim-us-dev
channels:
- conda-forge
dependencies:
- python>=3.10,<3.12
- sphinx>=3.5.4
- sphinx-argparse
- sphinxcontrib-bibtex>=2.0.0
- sphinx-math-dollar
- pydata-sphinx-theme
- jupyter-book>=0.11.3
- jupyter
- pip
4 changes: 2 additions & 2 deletions fiscalsim_us/data/datasets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ If you are updating the microdata (e.g., modifying code in `cps.py`), you will n
Steps:
1. Clear old microdata with `rm fiscalsim_us/data/storage/*.h5`
2. Generate new microdata in Python with a command like this: `python -c "from fiscalsim_us.data import CPS_2023; CPS_2023().generate()"`
3. Make a copy of the new microdata file with a name that includes the _bumped_ version number. For example, if FiscalSim US is currently version 0.1.0 and you are updating the 2023 CPS in a minor-bump PR, run `cp fiscalsim_us/data/storage/cps_2023.h5 fiscalsim_us/data/storage/cps_2023_v0_263_5.h5`.
3. Make a copy of the new microdata file with a name that includes the _bumped_ version number. For example, if FiscalSim-US is currently version 0.2.9 and you are updating the 2023 CPS in a minor-bump PR, run `cp fiscalsim_us/data/storage/cps_2023.h5 fiscalsim_us/data/storage/cps_2023_v0_263_5.h5`.
4. Upload this new file to [github.com/TheCGO/fiscalsim-us/releases](https://github.com/TheCGO/fiscalsim-us/releases), both overwriting the existing unversioned file (delete the old one) and adding the versioned file as a new release.
5. Update the `CPS_2023` class in `fiscalsim_us/data/cps.py` to point to the new versioned file, e.g. `new_url="release://TheCGO/fiscalsim-us/cps-2023/cps_2023_v0_263_5.h5",`.
5. Update the `CPS_2023` class in `fiscalsim_us/data/cps.py` to point to the new versioned file, e.g. `new_url="release://TheCGO/fiscalsim-us/v0.2.9/cps_2023_v0_2_9.h5",`.
6. Verify that this works by downloading it, e.g. `python -c "from fiscalsim_us.data import CPS_2023; CPS_2023().download()"`.
4 changes: 2 additions & 2 deletions fiscalsim_us/data/datasets/cps/cps.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def add_silver_plan_cost(self, cps: h5py.File, year: int):
cps (h5py.File): The CPS dataset file.
year (int): The year of the data.
"""
from policyengine_us import Microsimulation
from fiscalsim_us import Microsimulation

sim = Microsimulation(dataset=self)
slspc = sim.calc("second_lowest_silver_plan_cost", year).values
Expand Down Expand Up @@ -374,5 +374,5 @@ class CPS_2022(CPS):
"cps_2023",
"CPS 2023",
STORAGE_FOLDER / "cps_2023.h5",
new_url="release://policyengine/policyengine-us/cps-2023/cps_2023.h5",
new_url="release://TheCGO/fiscalsim-us/v0.2.9/cps_2023.h5",
)
4 changes: 1 addition & 3 deletions fiscalsim_us/data/datasets/cps/enhanced_cps/enhanced_cps.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ class EnhancedCPS_2023(Dataset):
file_path = STORAGE_FOLDER / "enhanced_cps.h5"
data_format = Dataset.ARRAYS
time_period = "2023"
url = (
"release://policyengine/fiscalsim-us/enhanced-cps-2023/enhanced_cps.h5"
)
url = "release://policyengine/policyengine-us/enhanced-cps-2023/enhanced_cps.h5"

def generate(self):
from .puf_extended_cps import PUFExtendedCPS_2023
Expand Down
7 changes: 4 additions & 3 deletions fiscalsim_us/data/datasets/cps/raw_cps.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,10 @@ def generate(self) -> pd.DataFrame:
"Received a 404 response when fetching the data."
)
try:
with BytesIO() as file, pd.HDFStore(
self.file_path, mode="w"
) as storage:
with (
BytesIO() as file,
pd.HDFStore(self.file_path, mode="w") as storage,
):
content_length_actual = 0
for data in response.iter_content(int(1e6)):
progress_bar.update(len(data))
Expand Down
6 changes: 6 additions & 0 deletions fiscalsim_us/parameters/gov/states/sc/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# South Carolina
We do not model the following components of the South Carolina SC1040 2023 Individual Income Tax Return
- line 19, Nonresident sale of real estate (paid on form I-290)
- All credits under line 22
- line 22a, Anhydrous Ammonia (form I-333)
- line 22b, Milk credit (form I-334)
- line 22c, Classroom Teacher Expenses (form I-360)
4 changes: 0 additions & 4 deletions fiscalsim_us/parameters/gov/states/sc/index.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
description: South Carolina adds these sources from federal taxable income to determine state taxable income.
values:
2021-01-01:
- sc_state_tax_addback
# - Out-of-state losses
# - Expenses related to National Guard and Military Reserve Income
# - Interest income on obligations of states and political subdivisions other than South Carolina
# - Other additions to income

metadata:
unit: list
period: year
label: South Carolina federal taxable income additions
reference:
- title: SC 1040 tax form (2021)
href: https://dor.sc.gov/forms-site/Forms/SC1040_2021.pdf#page=2
- title: SC 1040 tax form instructions (2021)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=13
- title: SC Legal Code | SECTION 12-6-1110
href: https://www.scstatehouse.gov/code/t12c006.php
- title: SC 1040 tax form (2022)
href: https://dor.sc.gov/forms-site/Forms/SC1040_2022.pdf#page=2
- title: SC 1040 tax form instructions (2023)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=20
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: South Carolina child and dependent care credit maximum amount per child
metadata:
unit: currency-USD
name: sc_cdcc_amount_pchld
label: South Carolina child and dependent care credit maximum amount per child
period: year
reference:
- title: Form SC1040 intructions, line 11, Child and Dependent Care Credit
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page32
values:
2020-01-01: 210
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ metadata:
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=22
- title: South Carolina Legal Code | SECTION 12-6-3380
href: https://www.scstatehouse.gov/code/t12c006.php
- title: SC 1040 tax form instructions (2023)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=32
unit: int
period: year
label: Decoupled year offset for maximum CDCC expense cap
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
description: South Carolina matches this share of the federal Child and Dependent Care Credit.
values:
values:
2020-01-01: 0.07

metadata:
unit: /1
period: year
label: South Carolina Child and Dependent Care Credit match
reference:
reference:
- title: SC-1040 2020
href: https://dor.sc.gov/forms-site/Forms/SC1040_2020.pdf
- title: Instructions for Form SC-1040 (line 11)
- title: Instructions for Form SC-1040, 2020 (line 11)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2020.pdf#page=20
- title: Instructions for Form SC-1040, 2023 (line 11)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=32
- title: South Carolina Legal Code | SECTION 12-6-3380
href: https://www.scstatehouse.gov/code/t12c006.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
description: Maximum South Carolina child and dependent care total match
metadata:
unit: currency-USD
name: sc_cdcc_max_total_expense
label: Maximum care CDCC expenses total match
period: year
reference:
- title: Form SC1040 intructions, line 11, Child and Dependent Care Credit
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page32
values:
2020-01-01: 420
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ metadata:
href: https://dor.sc.gov/forms-site/Forms/TC60_2021.pdf
- title: South Carolina Schedule TC-60 2022 (2022)
href: https://dor.sc.gov/forms-site/Forms/TC60_2022.pdf
- title: South Carolina Schedule TC-60 2023 (2023)
href: https://dor.sc.gov/forms-site/Forms/TC60_2023.pdf#page=1
- title: South Carolina Code of Laws Section 12-6-3632
href: https://www.scstatehouse.gov/code/t12c006.php

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: South Carolina non-refundable tax credits.
values:
2021-01-01:
- sc_cdcc
- sc_eitc
- sc_two_wage_earner_credit
metadata:
unit: list
label: South Carolina non-refundable tax credits
reference:
- title: SC 1040 tax form (2021)
href: https://dor.sc.gov/forms-site/Forms/SC1040_2021.pdf
- title: SC 1040 tax form instructions (2021)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=22
- title: SC 1040 tax form (2022)
href: https://dor.sc.gov/forms-site/Forms/SC1040_2022.pdf#page=3
- title: SC 1040 tax form instructions (2023)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=44
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
description: South Carolina refundable tax credits.
values:
2021-01-01:
- sc_tuition_credit
- sc_parentrefund_credit
metadata:
unit: list
label: South Carolina refundable tax credits
reference:
- title: SC 1040 tax form (2021)
href: https://dor.sc.gov/forms-site/Forms/SC1040_2021.pdf#page=3
- title: SC 1040 tax form instructions (2021)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=23
- title: SC 1040 tax form (2022)
href: https://dor.sc.gov/forms-site/Forms/SC1040_2022.pdf#page=3
- title: SC 1040 tax form instructions (2023)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=44

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: South Carolina subtracts the following elements from gross earned income when computing the two wage earner credit.
values:
2021-01-01:
- self_employment_tax_ald_person
- self_employed_health_insurance_ald_person
- self_employed_pension_contribution_ald_person

metadata:
unit: list
period: year
label: South Carolina two wage earner credit earned income subtractions
reference:
- title: SC 1040 tax form instructions (2021)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=22
- title: SC 1040 tax form instructions (2023)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=23
- title: SC Legal Code | Section 12-6-3330 (C)(b)
href: https://www.scstatehouse.gov/code/t12c006.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ brackets:
- threshold:
2021-01-01: 43_333
2022-01-01: 46_667
2023-01-01: 50_000
rate:
2021-01-01: 0

Expand All @@ -17,6 +18,8 @@ metadata:
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=23
- title: SC 1040 tax form instructions (2022)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2022.pdf#page=23
- title: SC 1040 tax form instructions (2023)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=32
- title: SC Legal Code | Section 12-6-3330 (B)
# Legal code set it to $50,000, then amended it to $30,000 in 2017.
# Now adjusted for inflation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ metadata:
href: https://www.scstatehouse.gov/code/t12c006.php
- title: SC1040 tax form (2022)
href: https://dor.sc.gov/forms-site/Forms/SC1040_2022.pdf#page=2
- title: SC 1040 tax form instructions (2023)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=23
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
description: South Carolina provides a young child deduction of this amount.
values:
2019-01-01: 4_100 # Value in the legal code, last updated in 2019.
2021-01-01: 4_300
2022-01-01: 4_430
2023-01-01: 4_610

metadata:
unit: currency-USD
period: year
label: South Carolina young child deduction amount
reference:
- title: SC 1040 tax form instructions (2021)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=19
# 12-6-1160 defines the program and points to the amount in 1140.
- title: SC Legal Code | SECTION 12-6-1160
href: https://www.scstatehouse.gov/code/t12c006.php
- title: SC 1040 tax form (2022)
href: https://dor.sc.gov/forms-site/Forms/SC1040_2022.pdf#page=2
- title: SC 1040 tax form instructions (2023)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=29
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
description: South Carolina limits its young child deduction to children below this age.
values:
2021-01-01: 6
metadata:
unit: year
period: year
label: South Carolina young child deduction ineligible age
reference:
- title: SC 1040 tax form (2021) Line t
href: https://dor.sc.gov/forms-site/Forms/SC1040_2021.pdf#page=2
- title: SC 1040 tax form instructions (2021)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2021.pdf#page=19
- title: SC Legal Code | SECTION 12-6-1160
href: https://www.scstatehouse.gov/code/t12c006.php
- title: SC 1040 tax form (2022)
href: https://dor.sc.gov/forms-site/Forms/SC1040_2022.pdf#page=2
- title: SC 1040 tax form instructions (2023)
href: https://dor.sc.gov/forms-site/Forms/IITPacket_2023.pdf#page=19
Loading

0 comments on commit bf28953

Please sign in to comment.