Skip to content

Commit c9f0965

Browse files
committed
Remove universal_pathlib dependency in notebook.
1 parent c0fad5e commit c9f0965

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

.github/workflows/deploy-marimo-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Deploy Marimo Pages
44
on:
55
push:
66
branches:
7-
- main
7+
- pixi-setup
88
paths:
99
- "marimo/**"
1010
- ".github/workflows/deploy-marimo-pages.yml"

marimo/sec10k-data-review.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
@app.cell
1818
def _():
1919
import os
20+
from pathlib import Path
2021

2122
import matplotlib as mpl
2223
import matplotlib.pyplot as plt
2324
import matplotx
2425
import polars as pl
25-
from upath import UPath
2626

2727
import marimo as mo
2828

@@ -33,11 +33,11 @@ def _():
3333
mpl.rcParams["figure.figsize"] = (10, 5)
3434
mpl.rcParams["figure.dpi"] = 150
3535
mpl.style.use(matplotx.styles.onedark)
36-
return UPath, mo, os, pl, plt
36+
return Path, mo, os, pl, plt
3737

3838

3939
@app.cell
40-
def _(UPath, os, pl):
40+
def _(Path, os, pl):
4141
def get_pudl(table_name: str) -> pl.DataFrame:
4242
"""Read a PUDL table from local storage if possible, and S3 nightlies if not.
4343
@@ -49,21 +49,13 @@ def get_pudl(table_name: str) -> pl.DataFrame:
4949
"""
5050
pudl_output = os.environ.get("PUDL_OUTPUT", False)
5151
local_parquet_path = (
52-
UPath(pudl_output) / f"parquet/{table_name}.parquet"
53-
if pudl_output
54-
else None
55-
)
56-
s3_parquet_path = (
57-
UPath("s3://pudl.catalyst.coop/nightly") / f"{table_name}.parquet"
52+
Path(pudl_output) / f"parquet/{table_name}.parquet" if pudl_output else None
5853
)
54+
s3_parquet_url = f"s3://pudl.catalyst.coop/nightly/{table_name}.parquet"
5955

6056
if (local_parquet_path is not None) and (local_parquet_path.exists()):
6157
return pl.read_parquet(local_parquet_path)
62-
if s3_parquet_path.exists():
63-
return pl.read_parquet(s3_parquet_path)
64-
raise FileNotFoundError(
65-
f"Could not find {table_name}.parquet in either local or S3 path."
66-
)
58+
return pl.read_parquet(s3_parquet_url)
6759

6860
return (get_pudl,)
6961

0 commit comments

Comments
 (0)