eiax 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- eiax-0.1.0/.env.example +5 -0
- eiax-0.1.0/.github/workflows/ci.yml +21 -0
- eiax-0.1.0/.gitignore +24 -0
- eiax-0.1.0/.python-version +1 -0
- eiax-0.1.0/CHANGELOG.md +23 -0
- eiax-0.1.0/LICENSE +21 -0
- eiax-0.1.0/PKG-INFO +69 -0
- eiax-0.1.0/README.md +32 -0
- eiax-0.1.0/pyproject.toml +90 -0
- eiax-0.1.0/scripts/build_catalog.py +515 -0
- eiax-0.1.0/scripts/generate_api_routes_doc.py +112 -0
- eiax-0.1.0/src/eiax/__init__.py +34 -0
- eiax-0.1.0/src/eiax/__version__.py +1 -0
- eiax-0.1.0/src/eiax/_sync.py +18 -0
- eiax-0.1.0/src/eiax/cache.py +336 -0
- eiax-0.1.0/src/eiax/catalog/__init__.py +337 -0
- eiax-0.1.0/src/eiax/catalog/branch_notes.json +17 -0
- eiax-0.1.0/src/eiax/catalog/facet_values.parquet +0 -0
- eiax-0.1.0/src/eiax/catalog/nodes.parquet +0 -0
- eiax-0.1.0/src/eiax/catalog/routes.parquet +0 -0
- eiax-0.1.0/src/eiax/client.py +223 -0
- eiax-0.1.0/src/eiax/errors.py +35 -0
- eiax-0.1.0/src/eiax/fetch.py +320 -0
- eiax-0.1.0/src/eiax/parse.py +90 -0
- eiax-0.1.0/src/eiax/py.typed +0 -0
- eiax-0.1.0/src/eiax/schema.py +32 -0
- eiax-0.1.0/src/eiax/series.py +119 -0
- eiax-0.1.0/src/eiax/settings.py +37 -0
- eiax-0.1.0/tests/conftest.py +19 -0
- eiax-0.1.0/tests/test_cache.py +163 -0
- eiax-0.1.0/tests/test_catalog.py +81 -0
- eiax-0.1.0/tests/test_client.py +135 -0
- eiax-0.1.0/tests/test_fetch.py +269 -0
- eiax-0.1.0/tests/test_integration.py +23 -0
- eiax-0.1.0/tests/test_parse.py +59 -0
- eiax-0.1.0/tests/test_series.py +103 -0
- eiax-0.1.0/tests/test_settings.py +23 -0
- eiax-0.1.0/uv.lock +496 -0
eiax-0.1.0/.env.example
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: astral-sh/setup-uv@v5
|
|
14
|
+
with:
|
|
15
|
+
enable-cache: true
|
|
16
|
+
- run: uv sync --all-extras
|
|
17
|
+
- run: uv run ruff check src tests
|
|
18
|
+
- run: uv run ruff format --check src tests
|
|
19
|
+
- run: uv run pyright src
|
|
20
|
+
- run: uv run pytest -m "not integration"
|
|
21
|
+
- run: uv build
|
eiax-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv/
|
|
11
|
+
.venv
|
|
12
|
+
|
|
13
|
+
# Secrets and caches
|
|
14
|
+
.env
|
|
15
|
+
.pypirc
|
|
16
|
+
.cache/
|
|
17
|
+
.pytest_cache/
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
|
|
20
|
+
# Test artifacts (but keep the shipped catalog data files)
|
|
21
|
+
*.parquet
|
|
22
|
+
!src/eiax/catalog/*.parquet
|
|
23
|
+
|
|
24
|
+
docs/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.14
|
eiax-0.1.0/CHANGELOG.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are documented here. Format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versioning follows
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-06-26
|
|
10
|
+
|
|
11
|
+
Initial release — Polars-native EIA Open Data API v2 client.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `fetch()` / `fetch_async()` with auto-pagination and parallel page fetches.
|
|
16
|
+
- Offline route catalog (~230 routes): `search()`, `help_route()`, `facet_values()`.
|
|
17
|
+
- Catalog helpers in `eiax.catalog`: `list_routes()`, `list_children()`, `describe_node()`, `get_route()`.
|
|
18
|
+
- Parquet + SQLite cache with gap detection and configurable TTL.
|
|
19
|
+
- `EIAClient` with sync/async HTTP, rate limiting, and retries on 429/5xx.
|
|
20
|
+
- `to_wide()` for reshaping long frames to wide period-indexed tables.
|
|
21
|
+
- Settings via `EIA_API_KEY`, `EIA_CACHE_DIR`, `EIA_CACHE_ENABLED`, `EIA_CACHE_TTL_HOURS`, `EIA_RATE_LIMIT`.
|
|
22
|
+
- Typed exceptions: `AuthenticationError`, `RateLimitError`, `EmptyResultError`, `UnknownSeriesError`, `EIAError`.
|
|
23
|
+
- Optional `[fastjson]` extra for `orjson`-backed JSON decode.
|
eiax-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 forest green
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
eiax-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: eiax
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Fast, unofficial Python client for the EIA Open Data API v2 (Polars-native, cached)
|
|
5
|
+
Project-URL: Homepage, https://github.com/frstgrn/eiax
|
|
6
|
+
Project-URL: Repository, https://github.com/frstgrn/eiax
|
|
7
|
+
Project-URL: Issues, https://github.com/frstgrn/eiax/issues
|
|
8
|
+
Author: forest green
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: api-client,eia,electricity,energy,open-data,polars,time-series
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Requires-Dist: httpx>=0.28
|
|
25
|
+
Requires-Dist: polars>=1.0
|
|
26
|
+
Requires-Dist: pyarrow>=18
|
|
27
|
+
Requires-Dist: pydantic-settings>=2.0
|
|
28
|
+
Requires-Dist: pydantic>=2.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pyright>=1.1; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.9; extra == 'dev'
|
|
34
|
+
Provides-Extra: fastjson
|
|
35
|
+
Requires-Dist: orjson>=3.10; extra == 'fastjson'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# eiax
|
|
39
|
+
|
|
40
|
+
Unofficial Python client for the EIA Open Data API v2. polars-native, auto-paginating, and parquet cached.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install eiax # install eiax[fastjson] to use orjson for faster loads
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
eiax requires Python 3.12+.
|
|
49
|
+
|
|
50
|
+
## API key
|
|
51
|
+
|
|
52
|
+
Get a key at [eia.gov/opendata/register.php](https://www.eia.gov/opendata/register.php). Browsing the offline catalog (`search`, `help_route`, `facet_values`) does not need a key.
|
|
53
|
+
|
|
54
|
+
Provide the key any of these ways (highest precedence first):
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import eiax
|
|
58
|
+
|
|
59
|
+
# 1. Explicit argument
|
|
60
|
+
client = eiax.EIAClient(api_key="your_key")
|
|
61
|
+
# 2. Environment variable (best for pipelines / CI)
|
|
62
|
+
# export EIA_API_KEY=your_key
|
|
63
|
+
# 3. A local .env file (best for development)
|
|
64
|
+
# EIA_API_KEY=your_key
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## License & attribution
|
|
68
|
+
|
|
69
|
+
eiax is released under the [MIT License](LICENSE). It is not affiliated with the U.S. EIA.
|
eiax-0.1.0/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# eiax
|
|
2
|
+
|
|
3
|
+
Unofficial Python client for the EIA Open Data API v2. polars-native, auto-paginating, and parquet cached.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install eiax # install eiax[fastjson] to use orjson for faster loads
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
eiax requires Python 3.12+.
|
|
12
|
+
|
|
13
|
+
## API key
|
|
14
|
+
|
|
15
|
+
Get a key at [eia.gov/opendata/register.php](https://www.eia.gov/opendata/register.php). Browsing the offline catalog (`search`, `help_route`, `facet_values`) does not need a key.
|
|
16
|
+
|
|
17
|
+
Provide the key any of these ways (highest precedence first):
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
import eiax
|
|
21
|
+
|
|
22
|
+
# 1. Explicit argument
|
|
23
|
+
client = eiax.EIAClient(api_key="your_key")
|
|
24
|
+
# 2. Environment variable (best for pipelines / CI)
|
|
25
|
+
# export EIA_API_KEY=your_key
|
|
26
|
+
# 3. A local .env file (best for development)
|
|
27
|
+
# EIA_API_KEY=your_key
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## License & attribution
|
|
31
|
+
|
|
32
|
+
eiax is released under the [MIT License](LICENSE). It is not affiliated with the U.S. EIA.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "eiax"
|
|
3
|
+
dynamic = ["version"]
|
|
4
|
+
description = "Fast, unofficial Python client for the EIA Open Data API v2 (Polars-native, cached)"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "forest green" }]
|
|
10
|
+
keywords = [
|
|
11
|
+
"eia",
|
|
12
|
+
"energy",
|
|
13
|
+
"open-data",
|
|
14
|
+
"polars",
|
|
15
|
+
"electricity",
|
|
16
|
+
"api-client",
|
|
17
|
+
"time-series",
|
|
18
|
+
]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 3 - Alpha",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Intended Audience :: Science/Research",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Topic :: Scientific/Engineering",
|
|
29
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
30
|
+
"Typing :: Typed",
|
|
31
|
+
]
|
|
32
|
+
dependencies = [
|
|
33
|
+
"httpx>=0.28",
|
|
34
|
+
"polars>=1.0",
|
|
35
|
+
"pyarrow>=18",
|
|
36
|
+
"pydantic>=2.0",
|
|
37
|
+
"pydantic-settings>=2.0",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://github.com/frstgrn/eiax"
|
|
42
|
+
Repository = "https://github.com/frstgrn/eiax"
|
|
43
|
+
Issues = "https://github.com/frstgrn/eiax/issues"
|
|
44
|
+
|
|
45
|
+
[project.optional-dependencies]
|
|
46
|
+
dev = [
|
|
47
|
+
"pytest>=8",
|
|
48
|
+
"pytest-asyncio>=0.24",
|
|
49
|
+
"ruff>=0.9",
|
|
50
|
+
"pyright>=1.1",
|
|
51
|
+
]
|
|
52
|
+
fastjson = ["orjson>=3.10"]
|
|
53
|
+
|
|
54
|
+
[build-system]
|
|
55
|
+
requires = ["hatchling"]
|
|
56
|
+
build-backend = "hatchling.build"
|
|
57
|
+
|
|
58
|
+
[tool.hatch.version]
|
|
59
|
+
path = "src/eiax/__version__.py"
|
|
60
|
+
|
|
61
|
+
[tool.hatch.build.targets.wheel]
|
|
62
|
+
packages = ["src/eiax"]
|
|
63
|
+
|
|
64
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
65
|
+
"src/eiax/catalog/routes.parquet" = "eiax/catalog/routes.parquet"
|
|
66
|
+
"src/eiax/catalog/nodes.parquet" = "eiax/catalog/nodes.parquet"
|
|
67
|
+
"src/eiax/catalog/facet_values.parquet" = "eiax/catalog/facet_values.parquet"
|
|
68
|
+
"src/eiax/catalog/branch_notes.json" = "eiax/catalog/branch_notes.json"
|
|
69
|
+
|
|
70
|
+
[tool.uv]
|
|
71
|
+
package = true
|
|
72
|
+
|
|
73
|
+
[tool.ruff]
|
|
74
|
+
line-length = 88
|
|
75
|
+
target-version = "py312"
|
|
76
|
+
|
|
77
|
+
[tool.ruff.lint]
|
|
78
|
+
select = ["E", "F", "I", "UP"]
|
|
79
|
+
|
|
80
|
+
[tool.pyright]
|
|
81
|
+
include = ["src"]
|
|
82
|
+
pythonVersion = "3.12"
|
|
83
|
+
typeCheckingMode = "basic"
|
|
84
|
+
|
|
85
|
+
[tool.pytest.ini_options]
|
|
86
|
+
testpaths = ["tests"]
|
|
87
|
+
asyncio_mode = "auto"
|
|
88
|
+
markers = [
|
|
89
|
+
"integration: live EIA API tests (needs EIA_API_KEY)",
|
|
90
|
+
]
|