Skip to content

Commit f873bd6

Browse files
Merge pull request #52 from PolicyEngine/docs-fixes
Add Jupyter Book documentation
2 parents cb10c5d + 5fe563f commit f873bd6

43 files changed

Lines changed: 691 additions & 584 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
## Updating data
22

33
If your changes present a non-bugfix change to one or more datasets which are cloud-hosted (CPS, ECPS and PUF), then please change both the filename and URL (in both the class definition file and in `storage/upload_completed_datasets.py`. This enables us to store historical versions of datasets separately and reproducibly.
4+
5+
## Updating versioning
6+
7+
Please add a versioning entry to `changelog_entry.yaml` (see previous PRs for examples), then run `make changelog` and commit the results ONCE in this PR.

.github/workflows/ci_cd.yaml

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,37 +22,8 @@ jobs:
2222
pip install black
2323
- name: Check formatting
2424
run: black . -l 79 --check
25-
check-version:
26-
name: Check version
27-
if: github.event_name == 'pull_request'
28-
runs-on: ubuntu-latest
29-
steps:
30-
- name: Checkout code
31-
uses: actions/checkout@v4
32-
with:
33-
fetch-depth: 0 # Fetch all history for all tags and branches
34-
repository: ${{ github.event.pull_request.head.repo.full_name }}
35-
ref: ${{ github.event.pull_request.head.ref }}
36-
- name: Set up Python
37-
uses: actions/setup-python@v5
38-
with:
39-
python-version: "3.10"
40-
- name: Build changelog
41-
run: pip install "yaml-changelog>=0.1.7" && make changelog
42-
- name: Preview changelog update
43-
run: ".github/get-changelog-diff.sh"
44-
- name: Check version number has been properly updated
45-
run: ".github/is-version-number-acceptable.sh"
46-
- name: Update changelog
47-
uses: EndBug/add-and-commit@v9
48-
with:
49-
add: "."
50-
committer_name: Github Actions[bot]
51-
author_name: Github Actions[bot]
52-
message: Update PolicyEngine US data
53-
github_token: ${{ secrets.POLICYENGINE_GITHUB }}
5425
test:
55-
name: Build and Test
26+
name: Build and test
5627
runs-on: ubuntu-latest
5728
steps:
5829
- name: Checkout code
@@ -71,8 +42,12 @@ jobs:
7142
POLICYENGINE_US_DATA_GITHUB_TOKEN: ${{ secrets.POLICYENGINE_US_DATA_GITHUB_TOKEN }}
7243
- name: Build datasets
7344
run: make data
45+
env:
46+
TEST_LITE: true
7447
- name: Run tests
7548
run: pytest
49+
- name: Test documentation builds
50+
run: make documentation
7651
publish-to-pypi:
7752
name: Publish to PyPI
7853
runs-on: ubuntu-latest
@@ -115,8 +90,31 @@ jobs:
11590
run: docker build . -f docker/policyengine_us_data.Dockerfile -t ghcr.io/policyengine/policyengine-us-data:latest
11691
- name: Push container
11792
run: docker push ghcr.io/policyengine/policyengine-us-data:latest
93+
publish-docs:
94+
name: Publish documentation
95+
runs-on: ubuntu-latest
96+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
97+
steps:
98+
- name: Checkout code
99+
uses: actions/checkout@v4
100+
with:
101+
fetch-depth: 0 # Fetch all history for all tags and branches
102+
- name: Set up Python
103+
uses: actions/setup-python@v5
104+
with:
105+
python-version: 3.12
106+
- name: Install package
107+
run: pip install -e ".[dev]"
108+
- name: Build Jupyter Book
109+
run: make documentation
110+
- name: Deploy documentation
111+
uses: JamesIves/github-pages-deploy-action@releases/v4
112+
with:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
BRANCH: gh-pages
115+
FOLDER: docs/_build/html
118116
upload:
119-
name: Upload Data
117+
name: Upload data
120118
runs-on: ubuntu-latest
121119
needs: [lint, test]
122120
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
@@ -141,12 +139,12 @@ jobs:
141139
uses: actions/upload-artifact@v4
142140
with:
143141
name: cps_2024.h5
144-
path: policyengine_us_data/data_storage/cps_2024.h5
142+
path: policyengine_us_data/storage/cps_2024.h5
145143
- name: Upload ECPS 2024
146144
uses: actions/upload-artifact@v4
147145
with:
148146
name: enhanced_cps_2024.h5
149-
path: policyengine_us_data/data_storage/enhanced_cps_2024.h5
147+
path: policyengine_us_data/storage/enhanced_cps_2024.h5
150148
- name: Upload data
151149
run: make upload
152150
env:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
**/__pycache__
33
**/.DS_STORE
44
**/*.h5
5-
*.ipynb
65
**/*.csv
76
!uprating_factors.csv
87
!uprating_growth_factors.csv
98
!healthcare_spending.csv
109
!spm_threshold_agi.csv
10+
**/_build

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.3.1] - 2024-09-17 19:37:44
9+
10+
### Added
11+
12+
- Jupyter Book documentation.
13+
814
## [1.3.0] - 2024-09-17 10:27:10
915

1016
### Fixed
@@ -59,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5965

6066

6167

68+
[1.3.1]: https://github.com/PolicyEngine/policyengine-us-data/compare/1.3.0...1.3.1
6269
[1.3.0]: https://github.com/PolicyEngine/policyengine-us-data/compare/1.2.1...1.3.0
6370
[1.2.1]: https://github.com/PolicyEngine/policyengine-us-data/compare/1.2.0...1.2.1
6471
[1.2.0]: https://github.com/PolicyEngine/policyengine-us-data/compare/1.1.1...1.2.0

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ changelog:
1919
touch changelog_entry.yaml
2020

2121
download:
22-
python policyengine_us_data/data_storage/download_public_prerequisites.py
23-
python policyengine_us_data/data_storage/download_private_prerequisites.py
22+
python policyengine_us_data/storage/download_public_prerequisites.py
23+
python policyengine_us_data/storage/download_private_prerequisites.py
2424

2525
upload:
26-
python policyengine_us_data/data_storage/upload_completed_datasets.py
26+
python policyengine_us_data/storage/upload_completed_datasets.py
2727

2828
docker:
2929
docker buildx build --platform linux/amd64 . -t policyengine-us-data:latest
30-
30+
3131
documentation:
32-
streamlit run docs/Home.py
32+
jb clean docs && jb build docs
3333

3434
data:
3535
python policyengine_us_data/datasets/cps/cps.py
3636
python policyengine_us_data/datasets/cps/enhanced_cps.py
3737

3838
clean:
39-
rm -f policyengine_us_data/data_storage/puf_2015.csv
40-
rm -f policyengine_us_data/data_storage/demographics_2015.csv
39+
rm -f policyengine_us_data/storage/puf_2015.csv
40+
rm -f policyengine_us_data/storage/demographics_2015.csv
4141

4242
build:
4343
python -m build

changelog.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@
4040
fixed:
4141
- Moved heavy dependencies to dev.
4242
date: 2024-09-17 10:27:10
43+
- bump: patch
44+
changes:
45+
added:
46+
- Jupyter Book documentation.
47+
date: 2024-09-17 19:37:44

docker/docs.Dockerfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/Home.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

docs/_config.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
title: PolicyEngine US data
2+
author: PolicyEngine
3+
copyright: "2024"
4+
logo: logo.png
5+
6+
execute:
7+
execute_notebooks: off
8+
9+
repository:
10+
url: https://github.com/policyengine/policyengine-us-data
11+
branch: master
12+
path_to_book: docs
13+
14+
sphinx:
15+
config:
16+
html_js_files:
17+
- https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.7/require.min.js
18+
html_theme: furo
19+
pygments_style: default
20+
html_css_files:
21+
- style.css
22+
nb_remove_code_source: true

docs/_static/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import url('https://fonts.googleapis.com/css2?family=Roboto+Serif:opsz@8..144&family=Roboto:wght@300&display=swap');
2+

0 commit comments

Comments
 (0)