Skip to content

Commit

Permalink
Merge pull request #75 from PolicyEngine/type-hints
Browse files Browse the repository at this point in the history
Move to Pythonic functions with strict models
  • Loading branch information
nikhilwoodruff authored Jan 28, 2025
2 parents 41a3002 + 1ba4b70 commit c61ce59
Show file tree
Hide file tree
Showing 69 changed files with 1,402 additions and 39,452 deletions.
13 changes: 12 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## Updating the versioning

Please add to `changelog.yaml` and then run `make changelog` before committing the results ONCE in this PR.
Please add to `changelog_entry.yaml` an entry in the format:

```yaml
- bump: minor
changes:
added:
- New feature.
fixed:
- Bug fix.
changed:
- Change.
```
26 changes: 26 additions & 0 deletions .github/workflows/any_changes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Workflow that runs on code changes to a pull request.

name: Any changes
on:
pull_request:
branches:
- main

jobs:
docs:
name: Test documentation builds
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install package
run: make install

- name: Test documentation builds
run: make documentation
41 changes: 41 additions & 0 deletions .github/workflows/code_changes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Workflow that runs on code changes to a pull request.

name: Code changes
on:
pull_request:
branches:
- main

paths:
- policyengine/**
- tests/**

jobs:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check formatting
uses: "lgeiger/black-action@master"
with:
args: ". -l 79 --check"
Test:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install package
run: uv pip install .[dev] --system

- name: Run tests
run: make test
env:
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
48 changes: 0 additions & 48 deletions .github/workflows/pr.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Push
on:
push:
branches: [ main ]
paths:
- pyproject.toml

jobs:
Publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Publish a git tag
run: ".github/publish-git-tag.sh || true"
- name: Install package
run: make install
- name: Build package
run: make
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI }}
skip-existing: true
69 changes: 0 additions & 69 deletions .github/workflows/push.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/versioning.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Workflow that runs on versioning metadata updates.

name: Versioning updates
on:
push:
branches:
- main

paths:
- changelog_entry.yaml

jobs:
Versioning:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.POLICYENGINE_GITHUB }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Build changelog
run: pip install yaml-changelog && make changelog
- name: Preview changelog update
run: ".github/get-changelog-diff.sh"
- name: Update changelog
uses: EndBug/add-and-commit@v9
with:
add: "."
message: Update package version
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,5 @@ cython_debug/
#.idea/

*.ipynb

!docs/**/*.ipynb
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ 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).

## [2.5.0] - 2025-01-24 00:08:26

### Changed

- Moved to strong typing.

## [2.4.1] - 2025-01-09 10:52:28

### Fixed
Expand Down Expand Up @@ -70,6 +76,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0



[2.5.0]: https://github.com/PolicyEngine/policyengine.py/compare/2.4.1...2.5.0
[2.4.1]: https://github.com/PolicyEngine/policyengine.py/compare/2.4.0...2.4.1
[2.4.0]: https://github.com/PolicyEngine/policyengine.py/compare/2.3.0...2.4.0
[2.3.0]: https://github.com/PolicyEngine/policyengine.py/compare/2.2.2...2.3.0
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ changelog:

build:
python -m build

test:
pytest tests
5 changes: 5 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,8 @@
fixed:
- Subsetting bug with time periods.
date: 2025-01-09 10:52:28
- bump: minor
changes:
changed:
- Moved to strong typing.
date: 2025-01-24 00:08:26
Binary file added docs/.DS_Store
Binary file not shown.
7 changes: 6 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ copyright: "2025"
logo: logo.png

execute:
execute_notebooks: force
execute_notebooks: cache
stderr_output: error
timeout: 600

Expand All @@ -14,6 +14,8 @@ repository:
branch: master
path_to_book: docs

title: Python documentation

sphinx:
config:
html_js_files:
Expand All @@ -24,3 +26,6 @@ sphinx:
- style.css
extra_extensions:
- "sphinx.ext.autodoc"
- "sphinxcontrib.autodoc_pydantic"

only_build_toc_files: true
10 changes: 8 additions & 2 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
@import url('https://fonts.googleapis.com/css2?family=Roboto+Serif:[email protected]&family=Roboto:wght@300&display=swap');

h1, h2, h3, h4, h5, h6 {

h1, h2, h3, h4, h5, p.rubric {
font-family: "Roboto";
font-weight: 200;
}

body {
font-family: "Roboto Serif";
}
}

.sidebar-brand-text {
text-align: left;
}
4 changes: 0 additions & 4 deletions docs/_toc.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
format: jb-book
root: index
parts:
- caption: Maintenance
chapters:
- file: maintaining
- caption: Reference
chapters:
- file: reference/simulation
- file: reference/calculate
Loading

0 comments on commit c61ce59

Please sign in to comment.