Skip to content

Commit b1b3d23

Browse files
chekosclaude
andauthored
Update GitHub Actions to latest and deprecate ACS class (#300)
* Update GitHub Actions to latest versions and deprecate ACS class Bump actions/checkout v4→v6, astral-sh/setup-uv v5→v7, and actions/first-interaction v1→v3 across all workflows. Deprecate the legacy ACS class in favor of get_pums() and get_acs(). Closes #5 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix deprecation warning stacklevel, add version, and test coverage Address PR review: use stacklevel=3 so the warning points to user code (not the dataclass __init__), add version to Sphinx deprecated directive, and add explicit test for the DeprecationWarning. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8081679 commit b1b3d23

6 files changed

Lines changed: 33 additions & 11 deletions

File tree

.github/workflows/claude.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
actions: read # Required for Claude to read CI results on PRs
2727
steps:
2828
- name: Checkout repository
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@v6
3030
with:
3131
fetch-depth: 1
3232

.github/workflows/greetings.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
issues: write
1010
pull-requests: write
1111
steps:
12-
- uses: actions/first-interaction@v1
12+
- uses: actions/first-interaction@v3
1313
with:
1414
repo-token: ${{ secrets.GITHUB_TOKEN }}
1515
pr-message: 'Hello @${{ github.actor }}, thank you for submitting a PR! We will respond as soon as possible.'

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
matrix:
1212
python-version: ["3.10", "3.11", "3.12", "3.13"]
1313
steps:
14-
- uses: actions/checkout@v4
15-
- uses: astral-sh/setup-uv@v5
14+
- uses: actions/checkout@v6
15+
- uses: astral-sh/setup-uv@v7
1616
with:
1717
python-version: ${{ matrix.python-version }}
1818
- name: Install dependencies
@@ -27,8 +27,8 @@ jobs:
2727
permissions:
2828
id-token: write
2929
steps:
30-
- uses: actions/checkout@v4
31-
- uses: astral-sh/setup-uv@v5
30+
- uses: actions/checkout@v6
31+
- uses: astral-sh/setup-uv@v7
3232
- name: Build package
3333
run: uv build
3434
- name: Publish to PyPI

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v4
10-
- uses: astral-sh/setup-uv@v5
9+
- uses: actions/checkout@v6
10+
- uses: astral-sh/setup-uv@v7
1111
- run: uvx ruff check .
1212
- run: uvx ruff format --check .
1313

@@ -17,8 +17,8 @@ jobs:
1717
matrix:
1818
python-version: ["3.10", "3.11", "3.12", "3.13"]
1919
steps:
20-
- uses: actions/checkout@v4
21-
- uses: astral-sh/setup-uv@v5
20+
- uses: actions/checkout@v6
21+
- uses: astral-sh/setup-uv@v7
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424
- name: Install dependencies

pypums/surveys.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Surveys module."""
22

3+
import warnings
34
from dataclasses import dataclass
45
from pathlib import Path
56

@@ -18,14 +19,25 @@
1819

1920
@dataclass
2021
class ACS:
21-
"""American Community Survey base class."""
22+
"""American Community Survey base class.
23+
24+
.. deprecated:: 0.2
25+
Use :func:`pypums.get_pums` for PUMS microdata or
26+
:func:`pypums.get_acs` for ACS summary tables instead.
27+
"""
2228

2329
year: int = 2023
2430
state: str = "California"
2531
survey: str = "1-Year"
2632
sample_unit: str = "person"
2733

2834
def __post_init__(self):
35+
warnings.warn(
36+
"ACS() is deprecated. Use get_pums() for PUMS microdata "
37+
"or get_acs() for ACS summary tables.",
38+
DeprecationWarning,
39+
stacklevel=3,
40+
)
2941
self._year = _clean_year(self.year)
3042
self._survey = _clean_survey(self.survey, self._year)
3143
self._sample_unit = self.sample_unit[0].lower()

tests/test_pypums.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def test_clean_year_range():
6868
_clean_year(1999)
6969

7070

71+
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
7172
def test_acs_class_urls():
7273
assert (
7374
ACS()._survey_url
@@ -87,6 +88,7 @@ def test_acs_class_urls():
8788
)
8889

8990

91+
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
9092
def test_acs_class_2020():
9193
"""ACS for 2020 should always use 5-Year survey."""
9294
acs_2020 = ACS(2020, "Ohio", "1-Year")
@@ -97,6 +99,7 @@ def test_acs_class_2020():
9799
)
98100

99101

102+
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
100103
def test_acs_class_attributes():
101104
assert ACS()._sample_unit == ACS().sample_unit[0].lower()
102105
assert ACS(sample_unit="household")._sample_unit == "h"
@@ -105,10 +108,12 @@ def test_acs_class_attributes():
105108
assert ACS(2020, survey="1-Year")._survey == "5-Year/"
106109

107110

111+
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
108112
def test_acs_class_as_df():
109113
assert isinstance(ACS(state="alaska").as_dataframe(), DataFrame)
110114

111115

116+
@pytest.mark.filterwarnings("ignore::DeprecationWarning")
112117
def test_instantiated_acs():
113118
instantiated_ACS = ACS()
114119
instantiated_ACS.download()
@@ -122,3 +127,8 @@ def test_instantiated_acs():
122127
f"raw/acs_{str(instantiated_ACS._year)[-2:]}/"
123128
)
124129
assert isinstance(instantiated_df, DataFrame)
130+
131+
132+
def test_acs_class_emits_deprecation_warning():
133+
with pytest.warns(DeprecationWarning, match="ACS\\(\\) is deprecated"):
134+
ACS()

0 commit comments

Comments
 (0)