Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor PUDL to use Pydantic v2 #3051

Merged
merged 31 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
80a3e6d
Refactor PUDL to use Pydantic v2
zaneselvans Nov 15, 2023
3ea7d15
Pydantic m.dict() => m.model_dump(); add type hints to conftest.py
zaneselvans Nov 23, 2023
953c748
use Pydantic strict types directly
zaneselvans Nov 23, 2023
0361826
Remove Base class, and schema_ & fields_ aliases.
zaneselvans Nov 23, 2023
7f7acee
Remove unnecessary allow_arbitrary_types configs
zaneselvans Nov 23, 2023
47050e3
Migrate from @root_validator to @model_validator in metadata classes
zaneselvans Nov 23, 2023
6ca2f9a
Type hints, naming, and 2 non-working draft model_validators
zaneselvans Nov 23, 2023
7fcb635
Migrate final @validator to @field_validator
zaneselvans Nov 23, 2023
76a7056
Suppress warning about shadowing deprecated BaseModel.schema attribute.
zaneselvans Nov 24, 2023
933f210
Convert parent_cols into @property; more model_validtors in XBRL Expl…
zaneselvans Nov 24, 2023
28aaa41
Address several deprecation warnings.
zaneselvans Nov 24, 2023
a8423da
Migrate PK/FK schema field validations to Pydantic v2
zaneselvans Nov 24, 2023
78dc8fa
Update conda-lock.yml and rendered conda environment files.
zaneselvans Nov 25, 2023
32dec0e
Fix generic settings model validations
zaneselvans Nov 25, 2023
9a0ba5d
Re-disable b0rken calc tol validator. sa.engine.Engine => sa.Engine
zaneselvans Nov 25, 2023
72fd01e
Ruff formatting changes.
zaneselvans Nov 25, 2023
2ad6de6
Revert temporary validator method name.
zaneselvans Nov 25, 2023
016e50f
Reinstate model_config arguments across all PudlMeta classes.
zaneselvans Nov 25, 2023
e182875
Add release notes about using v2 of Pandas, Pydantic, & SQLAlchemy.
zaneselvans Nov 25, 2023
d27359e
Merge branch 'dev' into pydantic-v2
zaneselvans Nov 25, 2023
8d534c9
Update conda-lock.yml and rendered conda environment files.
zaneselvans Nov 25, 2023
09a2ca1
Merge branch 'dev' into pydantic-v2
zaneselvans Nov 25, 2023
86c411b
Merge branch 'dev' into pydantic-v2
zaneselvans Nov 25, 2023
628f41a
Validate default values in PudlMeta and add None to optional args.
zaneselvans Nov 26, 2023
097376e
Merge branch 'dev' into pydantic-v2
zaneselvans Nov 28, 2023
2b9315a
Update conda-lock.yml and rendered conda environment files.
zaneselvans Nov 28, 2023
f1f54fd
Fiddle with GHA PUDL input/output dirs.
zaneselvans Nov 28, 2023
83188ce
Update conda-lock.yml and rendered conda environment files.
zaneselvans Nov 28, 2023
a8f4cac
More PUDL in/out fiddling
zaneselvans Nov 28, 2023
0a7c77b
More PUDL in/out fiddling
zaneselvans Nov 28, 2023
9b8cfb2
More PUDL in/out fiddling
zaneselvans Nov 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
conda config --show
printenv | sort

- name: Make input, output and dagster dirs
run: mkdir -p ${{ env.PUDL_OUTPUT }} ${{ env.PUDL_INPUT}} ${{ env.DAGSTER_HOME }}
zaneselvans marked this conversation as resolved.
Show resolved Hide resolved

- name: Lint and build PUDL documentation with Sphinx
run: |
pip install --no-deps --editable .
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
docs/data_dictionaries/pudl_db.rst
.ipynb_checkpoints/
.cache/
.ruff_cache/
.mypy_cache/
.pytest_cache/*
.DS_Store
build/
Expand Down
2 changes: 1 addition & 1 deletion devtools/materialize_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def main(asset_id):
config={
"resources": {
"dataset_settings": {
"config": etl_fast_settings.dict(),
"config": etl_fast_settings.model_dump(),
zaneselvans marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
Expand Down
6 changes: 6 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import datetime
import importlib.metadata
import os
import shutil
from pathlib import Path

Expand All @@ -18,6 +19,11 @@
from pudl.metadata.resources import RESOURCE_METADATA

DOCS_DIR = Path(__file__).parent.resolve()
if os.environ.get("READTHEDOCS"):
pudl_input = Path(os.environ["PUDL_INPUT"])
pudl_input.mkdir(parents=True, exist_ok=True)
pudl_output = Path(os.environ["PUDL_OUTPUT"])
pudl_output.mkdir(parents=True, exist_ok=True)
zaneselvans marked this conversation as resolved.
Show resolved Hide resolved

# -- Path setup --------------------------------------------------------------
# We are building and installing the pudl package in order to get access to
Expand Down
17 changes: 10 additions & 7 deletions environments/conda-linux-64.lock.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by conda-lock.
# platform: linux-64
# input_hash: 88ab6b06102bd362f7a93aacfa6fd9a41a0824c3982e85120db6a645c2c00351
# input_hash: b9f8826532896e72ca49913a87e8be150e02e08901365edadcf42074ef6dec9c

channels:
- conda-forge
Expand Down Expand Up @@ -63,7 +63,7 @@ dependencies:
- lzo=2.10=h516909a_1000
- ncurses=6.4=h59595ed_2
- nspr=4.35=h27087fc_0
- openssl=3.1.4=hd590300_0
- openssl=3.2.0=hd590300_0
- pixman=0.42.2=h59595ed_0
- pthread-stubs=0.4=h36c2ea0_1001
- rdma-core=28.9=h59595ed_1
Expand Down Expand Up @@ -98,7 +98,7 @@ dependencies:
- libprotobuf=4.24.4=hf27288f_0
- libre2-11=2023.06.02=h7a70373_0
- librttopo=1.1.0=h8917695_15
- libsqlite=3.44.1=h2797004_0
- libsqlite=3.44.2=h2797004_0
- libssh2=1.11.0=h0841786_0
- libxcb=1.15=h0b41bf4_0
- libxml2=2.11.6=h232c23b_0
Expand Down Expand Up @@ -131,7 +131,7 @@ dependencies:
- pandoc=3.1.3=h32600fe_0
- python=3.11.6=hab00c5b_0_cpython
- re2=2023.06.02=h2873b5e_0
- sqlite=3.44.1=h2c6b66d_0
- sqlite=3.44.2=h2c6b66d_0
- xorg-libx11=1.8.7=h8ee46fc_0
- aiofiles=23.2.1=pyhd8ed1ab_0
- alabaster=0.7.13=pyhd8ed1ab_0
Expand Down Expand Up @@ -189,7 +189,7 @@ dependencies:
- humanfriendly=10.0=pyhd8ed1ab_6
- hupper=1.12=pyhd8ed1ab_0
- hyperframe=6.0.1=pyhd8ed1ab_0
- idna=3.4=pyhd8ed1ab_0
- idna=3.5=pyhd8ed1ab_0
- ijson=3.2.3=pyhd8ed1ab_0
- imagesize=1.4.1=pyhd8ed1ab_0
- iniconfig=2.0.0=pyhd8ed1ab_0
Expand Down Expand Up @@ -396,6 +396,7 @@ dependencies:
- yarl=1.9.2=py311h459d7ec_1
- addfips=0.4.0=pyhd8ed1ab_1
- aniso8601=9.0.1=pyhd8ed1ab_0
- annotated-types=0.6.0=pyhd8ed1ab_0
- argon2-cffi-bindings=21.2.0=py311h459d7ec_4
- arrow=1.3.0=pyhd8ed1ab_0
- async-timeout=4.0.3=pyhd8ed1ab_0
Expand All @@ -422,14 +423,14 @@ dependencies:
- libnetcdf=4.9.2=nompi_h80fb2b6_112
- libspatialite=5.1.0=h7385560_2
- mako=1.3.0=pyhd8ed1ab_0
- numpy=1.26.0=py311h64a7726_0
- numpy=1.26.2=py311h64a7726_0
- pbr=6.0.0=pyhd8ed1ab_0
- pendulum=2.1.2=py311h459d7ec_6
- poppler=23.11.0=h590f24d_0
- prompt_toolkit=3.0.41=hd8ed1ab_0
- psycopg2-binary=2.9.7=pyhd8ed1ab_1
- pybtex=0.24.0=pyhd8ed1ab_2
- pydantic=1.10.13=py311h459d7ec_1
- pydantic-core=2.14.5=py311h46250e7_0
- pyproj=3.6.1=py311h1facc83_4
- pytest-console-scripts=1.4.1=pyhd8ed1ab_0
- pytest-cov=4.1.0=pyhd8ed1ab_0
Expand Down Expand Up @@ -475,6 +476,7 @@ dependencies:
- pandas=2.1.3=py311h320fe9a_0
- pango=1.50.14=ha41ecd1_2
- pybtex-docutils=1.0.3=py311h38be061_1
- pydantic=2.5.2=pyhd8ed1ab_0
- pyopenssl=23.3.0=pyhd8ed1ab_0
- readthedocs-sphinx-ext=2.2.3=pyhd8ed1ab_0
- requests-toolbelt=0.10.1=pyhd8ed1ab_0
Expand Down Expand Up @@ -509,6 +511,7 @@ dependencies:
- nbformat=5.9.2=pyhd8ed1ab_0
- pandera-core=0.17.2=pyhd8ed1ab_1
- pre-commit=3.5.0=pyha770c72_0
- pydantic-settings=2.1.0=pyhd8ed1ab_1
- requests-oauthlib=1.3.1=pyhd8ed1ab_0
- scikit-learn=1.3.2=py311hc009520_1
- timezonefinder=6.2.0=py311h459d7ec_2
Expand Down
Loading