Skip to content

Commit

Permalink
Define a minimal Python version of the package containing `vars_renam…
Browse files Browse the repository at this point in the history
…e` (#31)

* Add basic Python project with just vars_rename

* Add unit tests for vars_rename

* Add pytest-coverage workflow

* Add Development docs to python/README.md

* Clean up docs in vars_funs.py

* Fix typo in pytest-coverage workflow

* Accept any python >=3.9 in python package

* Use optional-dependencies for dev deps in pyproject.toml

* Fix vars_rename docstring in Python package

* Update typing in vars_funs.py to be compatible with Python 3.9

* Add Sphinx docs for Python package

* Update actions/checkout versions across workflows

* Add Python docs generation to docs workflow

* Fix ruff linter errors

* Install both test and docs requirements when running pytest

* Fix paths in pytest-coverage workflow

* Better path management in docs conf.py

* Rename build jobs in docs workflow

* Include csv files in package data when building Python package

* Temporarily disable branch restriction for docs deployment to test it out

* Update deploy-pages version

* Revert "Temporarily disable branch restriction for docs deployment to test it out"

This reverts commit 9cc256b.

* Fix broken link in Python docs

* Switch to new style python type hints since we don't support 3.9 anyway

* Remove unnecessary templates_path config from pyproject.toml

* Empty commit to try to bust build-pkgdown-site actions cache

* Remove unnecessary .python-version file

* Add pip install directions to README and index.rst for Python package

* Remove unnecessary uv.lock file

* Rename 'test' -> 'dev' in pyproject optional-dependencies

* Switch order of authors in pyproject.toml

* Capitalize VAR_NAME_PREFIX constant in vars_funs.py

* Remove unnecessary OutputType enum from vars_funs.py

* Remove duplicative type checking in vars_funs.py

* Wrap Python tests in classes for clearer organization

* Change chars_sample fixtures to symlinks to R data in Python package
  • Loading branch information
jeancochrane authored Nov 26, 2024
1 parent d85e0d4 commit 5be78a6
Show file tree
Hide file tree
Showing 28 changed files with 697 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
R_KEEP_PKG_SOURCE: yes
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2
Expand Down
40 changes: 32 additions & 8 deletions .github/workflows/pkgdown.yaml → .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ on:
push:
branches: [main, master]

name: pkgdown
name: docs

env:
PYTHONUNBUFFERED: "1"
UV_SYSTEM_PYTHON: 1

jobs:
build-pkgdown-site:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2
Expand All @@ -28,21 +32,41 @@ jobs:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build pkgdown site
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: python/pyproject.toml
cache-suffix: docs

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version-file: python/pyproject.toml

- name: Install Python dependencies
working-directory: python
shell: bash
run: uv pip install .[docs]

- name: Build R docs
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Build Python docs
run: sphinx-build python/docs/source docs/python

- name: Configure pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'

deploy:
if: contains(fromJSON('["main", "master"]'), github.ref_name) && github.event_name != 'pull_request'
needs: build-pkgdown-site
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
Expand All @@ -53,4 +77,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup R
uses: r-lib/actions/setup-r@v2
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/pytest-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
pull_request:
push:
branches: [main, master]

name: pytest-coverage

env:
PYTHONUNBUFFERED: "1"
UV_SYSTEM_PYTHON: 1

jobs:
pytest-coverage:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: python/pyproject.toml
cache-suffix: test

- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install Python dependencies
working-directory: python
shell: bash
run: uv pip install .[dev,docs]

- name: Run pytest
working-directory: python
shell: bash
run: |
pytest -v --doctest-modules \
--junitxml=junit/test-results-${{ matrix.python-version }}.xmlpytest
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: python/pytest-results-${{ matrix.python-version }}
path: python/junit/test-results-${{ matrix.python-version }}.xml
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup R
uses: r-lib/actions/setup-r@v2
Expand Down
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ repos:
- id: use-tidy-description
- id: lintr
- id: readme-rmd-rendered
exclude: ^python/
- id: parsable-R
- id: no-browser-statement
- id: no-debug-statement
Expand All @@ -33,3 +34,15 @@ repos:
entry: Cannot commit .Rhistory, .RData, .Rds or .rds.
language: fail
files: '\.(Rhistory|RData|Rds|rds)$'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
hooks:
# Python linter. Ruff recommends running this before the formatter to
# avoid conflicts when using the --fix flag
- id: ruff
args:
- --fix
files: ^python/
# Formatter
- id: ruff-format
files: ^python/
4 changes: 4 additions & 0 deletions data-raw/chars_sample.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ chars_sample_athena <- dbGetQuery(
"
)
usethis::use_data(chars_sample_athena, overwrite = TRUE)
# Write the data to CSV so that the Python version of the package can consume
# it as well
readr::write_csv(chars_sample_athena, "data-raw/chars_sample_athena.csv")

# Get sample ADDCHARS data
chars_sample_hie <- dbGetQuery(
Expand All @@ -69,3 +72,4 @@ chars_sample_hie <- dbGetQuery(
"
)
usethis::use_data(chars_sample_hie, overwrite = TRUE)
readr::write_csv(chars_sample_hie, "data-raw/chars_sample_hie.csv")
71 changes: 71 additions & 0 deletions data-raw/chars_sample_athena.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
pin,year,class,char_yrblt,char_bldg_sf,char_land_sf,char_beds,char_rooms,char_fbath,char_hbath,char_frpl,char_type_resd,char_cnst_qlty,char_apts,char_tp_dsgn,char_attic_fnsh,char_gar1_att,char_gar1_area,char_gar1_size,char_gar1_cnst,char_attic_type,char_bsmt,char_ext_wall,char_heat,char_repair_cnd,char_bsmt_fin,char_roof_cnst,char_use,char_age,char_site,char_ncu,char_renovation,char_porch,char_air,char_tp_plan
10254170360000,2015,205,1948,1775,4340,4,7,2,1,2,2,2,6,2,3,2,2,7,0,3,1,2,1,2,1,1,1,67,2,0,0,0,1,2
09363230550000,2019,203,1923,1200,4375,3,5,1,1,0,1,2,6,2,3,2,2,7,0,3,1,3,2,2,3,1,1,95,2,0,0,1,2,2
09363230550000,2016,203,1923,1200,4375,3,5,1,1,0,1,2,6,2,3,2,2,7,0,3,1,3,2,2,3,1,1,92,2,0,0,1,2,2
14321260280000,2018,211,1878,2850,3125,4,9,3,0,0,3,2,2,2,3,2,2,7,0,3,3,2,1,2,1,2,2,140,2,0,0,0,2,2
10253190450000,2018,204,1951,2469,11160,3,8,2,1,1,1,2,6,0,3,1,2,3,2,3,3,2,1,2,3,1,1,67,2,0,0,0,1,2
14321260280000,2016,211,1878,2850,3125,4,9,3,0,0,3,2,2,2,3,2,2,7,0,3,3,2,1,2,1,2,2,137,2,0,0,0,2,2
09254040180000,2020,203,1955,1571,3750,3,6,1,0,0,5,2,6,2,1,2,2,7,0,1,1,2,1,2,3,1,1,63,2,0,0,0,1,2
13362270230000,2015,202,1890,756,2750,2,4,1,1,0,1,2,6,0,3,2,2,3,1,1,1,3,2,3,1,1,1,125,2,0,0,1,2,2
13253160160000,2020,202,1904,706,3150,2,5,1,0,0,1,2,6,2,3,2,2,3,1,1,1,2,2,2,3,1,1,117,2,0,0,0,2,2
10254170360000,2018,205,1948,1829,4340,3,7,2,1,2,2,2,6,2,3,2,2,3,1,3,1,2,1,2,1,1,1,70,2,0,0,0,1,2
13253160160000,2017,202,1901,706,3150,2,5,1,0,0,1,2,6,2,3,2,2,3,1,1,1,2,2,2,3,1,1,114,2,0,0,0,2,2
09363230550000,2017,203,1923,1200,4375,3,5,1,1,0,1,2,6,2,3,2,2,7,0,3,1,3,2,2,3,1,1,92,2,0,0,1,2,2
10253190450000,2017,204,1951,2469,11160,3,8,2,1,1,1,2,6,0,3,1,2,3,2,3,3,2,1,2,3,1,1,64,2,0,0,0,1,2
13253230040000,2019,203,1969,1040,3150,2,5,1,0,0,1,2,6,2,3,2,2,7,0,3,1,2,1,2,3,1,1,49,2,0,0,0,2,2
17032010190000,2016,211,1887,3299,1204,8,11,3,0,2,3,2,2,2,3,2,2,7,0,3,1,2,2,2,1,6,2,128,2,0,0,0,1,2
09361030150000,2016,203,1928,1200,5280,2,5,1,0,0,1,2,6,0,3,1,1,1,1,1,1,3,2,2,3,1,1,87,3,0,0,0,2,0
09361030150000,2015,203,1928,1200,5280,2,5,1,0,0,1,2,6,0,3,1,1,1,1,1,1,3,2,2,3,1,1,87,3,0,0,0,2,0
17032010190000,2015,211,1887,3299,1204,8,11,3,0,2,3,2,2,2,3,2,2,7,0,3,1,2,2,2,1,6,2,128,2,0,0,0,1,2
10253190450000,2021,209,1954,6027,11160,5,12,4,1,1,2,2,6,2,3,1,2,3,2,3,3,4,1,2,3,1,1,70,2,0,0,0,1,2
09254040180000,2018,203,1955,1571,3750,3,6,1,0,0,5,2,6,2,1,2,2,7,0,1,1,2,1,2,3,1,1,63,2,0,0,0,1,2
09254040180000,2017,203,1955,1571,3750,3,6,1,0,0,5,2,6,2,1,2,2,7,0,1,1,2,1,2,3,1,1,60,2,0,0,0,1,2
13362270230000,2016,202,1890,756,2750,2,4,1,1,0,1,2,6,0,3,2,2,3,1,1,1,3,2,3,1,1,1,125,2,0,0,1,2,2
13253230040000,2021,278,1972,2210,3150,4,9,3,0,0,2,2,6,2,3,2,2,7,0,3,1,2,1,2,1,1,1,52,2,0,0,0,1,2
09254040180000,2015,203,1955,1571,3750,3,6,1,0,0,5,2,6,2,1,2,2,7,0,1,1,2,1,2,3,1,1,60,2,0,0,0,1,2
13362270230000,2017,202,1890,756,2750,2,4,1,1,0,1,2,6,0,3,2,2,3,1,1,1,3,2,3,1,1,1,125,2,0,0,1,2,2
13253230040000,2015,203,1969,1040,3150,2,5,1,0,0,1,2,6,0,3,2,2,3,1,3,2,2,1,2,3,1,1,46,2,0,0,0,2,2
13253160160000,2019,202,1901,706,3150,2,5,1,0,0,1,2,6,2,3,2,2,3,1,1,1,2,2,2,3,1,1,117,2,0,0,0,2,2
10254170360000,2017,205,1948,1829,4340,3,7,2,1,2,2,2,6,2,3,2,2,3,1,3,1,2,1,2,1,1,1,67,2,0,0,0,1,2
10253190450000,2019,204,1951,2469,11160,3,8,2,1,1,1,2,6,0,3,1,2,3,2,3,3,2,1,2,3,1,1,67,2,0,0,0,1,2
14321260280000,2021,206,1880,3660,3125,4,11,5,0,0,3,2,6,2,3,2,2,4,2,3,3,2,1,2,1,2,1,143,2,0,1,0,2,2
09361030150000,2018,203,1928,1357,5280,2,6,1,1,0,1,2,6,2,3,2,2,1,1,3,1,2,2,2,3,1,1,90,3,0,0,0,2,2
09361030150000,2021,206,1931,2772,5280,5,9,3,1,0,2,2,6,2,3,2,2,1,1,3,1,3,2,2,3,1,1,93,3,0,0,0,1,2
17032010190000,2021,210,1887,3299,1204,8,11,3,1,2,3,2,6,2,3,2,2,7,0,3,1,2,2,2,1,6,1,134,2,0,1,0,1,2
13253160160000,2021,205,1904,1790,3150,3,7,3,0,0,2,2,6,2,3,2,2,3,1,1,1,2,2,2,1,1,1,120,2,0,1,0,1,2
10254170360000,2021,206,1959,2312,4340,4,8,3,1,2,2,2,6,2,3,2,2,3,1,3,1,2,1,2,1,1,1,73,2,0,0,0,1,2
13362270230000,2020,202,1890,756,2750,2,4,1,1,0,1,2,6,0,3,2,2,3,1,1,1,3,2,3,1,1,1,128,2,0,0,1,2,2
09361030150000,2017,203,1928,1357,5280,2,6,1,1,0,1,2,6,2,3,2,2,1,1,3,1,2,2,2,3,1,1,87,3,0,0,0,2,2
17032010190000,2017,211,1887,3299,1204,8,11,3,0,2,3,2,2,2,3,2,2,7,0,3,1,2,2,2,1,6,2,128,2,0,0,0,1,2
13253230040000,2017,203,1969,1040,3150,2,5,1,0,0,1,2,6,2,3,2,2,3,1,3,1,2,1,2,3,1,1,46,2,0,0,0,2,2
17032010190000,2019,211,1888,3299,1204,8,11,3,0,2,3,2,2,2,3,2,2,7,0,3,1,2,2,2,1,6,2,131,2,0,0,0,1,2
09361030150000,2019,203,1928,1357,5280,2,6,1,1,0,1,2,6,2,3,2,2,1,1,3,1,2,2,2,3,1,1,90,3,0,0,0,2,2
09363230550000,2015,203,1923,1200,4375,3,5,1,1,0,1,2,6,2,3,2,2,7,0,3,1,3,2,2,3,1,1,92,2,0,0,1,2,2
09254040180000,2016,203,1955,1571,3750,3,6,1,0,0,5,2,6,2,1,2,2,7,0,1,1,2,1,2,3,1,1,60,2,0,0,0,1,2
13362270230000,2019,202,1890,756,2750,2,4,1,1,0,1,2,6,0,3,2,2,3,1,1,1,3,2,3,1,1,1,128,2,0,0,1,2,2
13253160160000,2018,202,1901,706,3150,2,5,1,0,0,1,2,6,2,3,2,2,3,1,1,1,2,2,2,3,1,1,117,2,0,0,0,2,2
09363230550000,2021,206,1926,2376,4375,4,7,3,1,0,2,2,6,2,3,2,2,3,1,3,1,3,2,2,3,1,1,98,2,0,0,1,1,2
13253230040000,2016,203,1969,1040,3150,2,5,1,0,0,1,2,6,0,3,2,2,3,1,3,2,2,1,2,3,1,1,46,2,0,0,0,2,2
10254170360000,2016,205,1948,1775,4340,4,7,2,1,2,2,2,6,2,3,2,2,7,0,3,1,2,1,2,1,1,1,67,2,0,0,0,1,2
13362270230000,2021,205,1893,1476,2750,4,6,3,1,0,2,2,6,2,3,2,2,3,1,1,1,3,2,3,1,1,1,131,2,0,1,1,1,2
17032010190000,2018,211,1887,3299,1204,8,11,3,0,2,3,2,2,2,3,2,2,7,0,3,1,2,2,2,1,6,2,131,2,0,0,0,1,2
14321260280000,2015,211,1878,2850,3125,6,15,3,0,0,3,2,2,0,3,2,2,7,0,3,1,2,2,2,3,2,2,137,2,0,0,1,2,2
17032010190000,2020,211,1888,3299,1204,8,11,3,0,2,3,2,2,2,3,2,2,7,0,3,1,2,2,2,1,6,2,131,2,0,0,0,1,2
13253160160000,2015,202,1901,706,3150,2,5,1,0,0,1,2,6,2,3,2,2,3,1,1,1,2,2,2,3,1,1,114,2,0,0,1,2,2
09363230550000,2018,203,1923,1200,4375,3,5,1,1,0,1,2,6,2,3,2,2,7,0,3,1,3,2,2,3,1,1,95,2,0,0,1,2,2
09254040180000,2019,203,1955,1571,3750,3,6,1,0,0,5,2,6,2,1,2,2,7,0,1,1,2,1,2,3,1,1,63,2,0,0,0,1,2
10253190450000,2020,204,1951,2469,11160,3,8,2,1,1,1,2,6,0,3,1,2,3,2,3,3,2,1,2,3,1,1,67,2,0,0,0,1,2
09361030150000,2020,203,1928,1357,5280,2,6,1,1,0,1,2,6,2,3,2,2,1,1,3,1,2,2,2,3,1,1,90,3,0,0,0,2,2
13362270230000,2018,202,1890,756,2750,2,4,1,1,0,1,2,6,0,3,2,2,3,1,1,1,3,2,3,1,1,1,128,2,0,0,1,2,2
10253190450000,2015,204,1951,2469,11160,3,8,2,1,1,1,2,6,0,3,1,2,3,2,3,3,2,1,2,3,1,1,64,2,0,0,0,1,2
13253230040000,2018,203,1969,1040,3150,2,5,1,0,0,1,2,6,2,3,2,2,3,1,3,1,2,1,2,3,1,1,49,2,0,0,0,2,2
10253190450000,2016,204,1951,2469,11160,3,8,2,1,1,1,2,6,0,3,1,2,3,2,3,3,2,1,2,3,1,1,64,2,0,0,0,1,2
14321260280000,2019,211,1878,2850,3125,4,9,3,0,0,3,2,2,2,3,2,2,7,0,3,3,2,1,2,1,2,2,140,2,0,0,0,2,2
13253160160000,2016,202,1901,706,3150,2,5,1,0,0,1,2,6,2,3,2,2,3,1,1,1,2,2,2,3,1,1,114,2,0,0,0,2,2
09363230550000,2020,203,1923,1200,4375,3,5,1,1,0,1,2,6,2,3,2,2,7,0,3,1,3,2,2,3,1,1,95,2,0,0,1,2,2
10254170360000,2019,205,1948,1829,4340,3,7,2,1,2,2,2,6,2,3,2,2,3,1,3,1,2,1,2,1,1,1,70,2,0,0,0,1,2
13253230040000,2020,203,1969,1040,3150,2,5,1,0,0,1,2,6,2,3,2,2,7,0,3,1,2,1,2,3,1,1,49,2,0,0,0,2,2
10254170360000,2020,205,1948,1829,4340,3,7,2,1,2,2,2,6,2,3,2,2,3,1,3,1,2,1,2,1,1,1,70,2,0,0,0,1,2
09254040180000,2021,203,1958,1568,3750,3,8,3,0,0,6,2,6,2,1,2,2,3,1,1,1,2,1,2,1,1,1,66,2,0,0,0,1,2
14321260280000,2020,211,1878,2850,3125,4,9,3,0,0,3,2,2,2,3,2,2,7,0,3,3,2,1,2,1,2,2,140,2,0,0,0,2,2
14321260280000,2017,211,1878,2850,3125,4,9,3,0,0,3,2,2,2,3,2,2,7,0,3,3,2,1,2,1,2,2,137,2,0,0,0,2,2
12 changes: 12 additions & 0 deletions data-raw/chars_sample_hie.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
pin,qu_town,qu_mlt_cd,qu_home_improvement,qu_use,qu_exterior_wall,qu_roof,qu_basement_type,qu_basement_finish,qu_heat,qu_air,qu_attic_type,qu_attic_finish,qu_type_plan,qu_type_design,qu_construct_quality,qu_porch,qu_garage_size,qu_garage_const,qu_garage_attached,qu_garage_area,qu_num_apts,qu_sqft_bld,qu_lnd_sqft,qu_class,qu_rooms,qu_beds,qu_full_bath,qu_half_bath,qu_fire_place,qu_no_com_unit,qu_type_of_res,qu_upload_date,hie_last_year_active,year
13253230040000,77,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,2,2,0,0,0,203,0,0,0,0,0,0,0,2019-06-19,2023,2019
10254170360000,75,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,483,0,206,1,1,1,0,0,0,0,2017-01-23,2020,2017
13253230040000,77,3,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1170,0,278,4,2,2,0,0,0,2,2017-04-20,2020,2017
09361030150000,71,3,1,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1415,0,206,3,3,2,0,0,0,2,2017-06-09,2020,2017
13362270230000,77,3,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,720,0,205,2,2,2,0,0,0,2,2015-07-01,2020,2015
09254040180000,71,3,1,0,0,0,0,0,0,1,0,0,0,0,0,0,3,1,2,2,0,845,0,207,2,2,2,0,0,0,2,2015-08-01,2020,2015
09363230550000,71,3,1,0,0,0,0,0,0,1,0,0,0,0,0,0,3,1,2,2,0,1176,0,206,2,1,2,0,0,0,2,2015-08-01,2020,2015
17032010190000,74,3,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,210,0,0,0,1,0,0,0,2015-09-02,2020,2015
10253190450000,75,3,1,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3558,0,209,4,2,2,0,0,0,2,2016-02-03,2020,2016
13253160160000,77,3,1,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1084,0,205,2,1,2,0,0,0,2,2016-08-01,2020,2016
14321260280000,74,3,1,1,0,0,0,0,0,0,0,0,0,0,0,0,4,2,2,2,6,810,0,206,2,0,2,0,0,0,0,2016-09-13,2020,2016
40 changes: 40 additions & 0 deletions python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
uv.lock

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Sphinx documentation
_build/
51 changes: 51 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# CCAO Python package

This is a Python version of the [`ccao` R
package](https://ccao-data.github.io/ccao/), providing utilities for
managing, distributing, and version controlling *CCAO-specific* functions
used throughout CCAO applications, models, and diagnostics. For generalized
versions of assessment-related functions, see
[assesspy](https://github.com/ccao-data/assesspy).

## Installation

Install the latest release of `ccao` from PyPI:

```bash
pip install ccao
```

You can also install the most recent code directly from GitHub:

```bash
pip install "git+https://github.com/ccao-data/ccao.git#egg=ccao&subdirectory=python"
```

## Development

Create a development environment using [`uv`](https://docs.astral.sh/uv/):

```
uv venv
source .venv/bin/activate
uv python install
uv pip install .[dev,docs]
```

### Running tests

Run tests with pytest:

```
pytest
```

### Building docs

Build and serve the docs locally with sphinx:

```
sphinx-autobuild docs/source _build/html
```

Navigate to http://localhost:8000 to view the docs.
1 change: 1 addition & 0 deletions python/ccao/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ccao.vars_funs import vars_dict, vars_rename
Empty file added python/ccao/data/__init__.py
Empty file.
1 change: 1 addition & 0 deletions python/ccao/data/vars_dict.csv
Loading

0 comments on commit 5be78a6

Please sign in to comment.