python-esios 0.2.7__tar.gz → 2.0.1__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.
Files changed (90) hide show
  1. python_esios-2.0.1/.github/workflows/publish.yml +28 -0
  2. python_esios-2.0.1/.gitignore +48 -0
  3. python_esios-2.0.1/CHANGELOG.md +47 -0
  4. python_esios-2.0.1/PKG-INFO +103 -0
  5. python_esios-2.0.1/README.md +75 -0
  6. python_esios-2.0.1/examples/.gitignore +5 -0
  7. python_esios-2.0.1/examples/01_Quickstart/01_Setup and First Query.ipynb +557 -0
  8. python_esios-2.0.1/examples/02_Indicators/01_Search Indicators.ipynb +646 -0
  9. python_esios-2.0.1/examples/02_Indicators/02_Historical Data.ipynb +597 -0
  10. python_esios-2.0.1/examples/02_Indicators/03_Multi-Geography Indicators.ipynb +689 -0
  11. python_esios-2.0.1/examples/02_Indicators/04_Compare Indicators.ipynb +735 -0
  12. python_esios-2.0.1/examples/02_Indicators/05_Market Prices.ipynb +542 -0
  13. python_esios-2.0.1/examples/02_Indicators/06_Generation and Demand.ipynb +631 -0
  14. python_esios-2.0.1/examples/03_Archives/01_Download Archives.ipynb +405 -0
  15. python_esios-2.0.1/examples/03_Archives/02_I90 Settlement Files.ipynb +361 -0
  16. python_esios-2.0.1/examples/04_Caching/01_Cache Management.ipynb +256 -0
  17. python_esios-2.0.1/examples/05_Advanced/01_Ad-hoc Pandas Expressions.ipynb +838 -0
  18. python_esios-2.0.1/examples/05_Advanced/02_Async Client.ipynb +177 -0
  19. python_esios-2.0.1/examples/_specs/01_Quickstart/01_Setup and First Query.yaml +48 -0
  20. python_esios-2.0.1/examples/_specs/02_Indicators/01_Search Indicators.yaml +38 -0
  21. python_esios-2.0.1/examples/_specs/02_Indicators/02_Historical Data.yaml +48 -0
  22. python_esios-2.0.1/examples/_specs/02_Indicators/03_Multi-Geography Indicators.yaml +47 -0
  23. python_esios-2.0.1/examples/_specs/02_Indicators/04_Compare Indicators.yaml +47 -0
  24. python_esios-2.0.1/examples/_specs/02_Indicators/05_Market Prices.yaml +55 -0
  25. python_esios-2.0.1/examples/_specs/02_Indicators/06_Generation and Demand.yaml +52 -0
  26. python_esios-2.0.1/examples/_specs/03_Archives/01_Download Archives.yaml +41 -0
  27. python_esios-2.0.1/examples/_specs/03_Archives/02_I90 Settlement Files.yaml +50 -0
  28. python_esios-2.0.1/examples/_specs/04_Caching/01_Cache Management.yaml +62 -0
  29. python_esios-2.0.1/examples/_specs/05_Advanced/01_Ad-hoc Pandas Expressions.yaml +45 -0
  30. python_esios-2.0.1/examples/_specs/05_Advanced/02_Async Client.yaml +65 -0
  31. python_esios-2.0.1/examples/generate.py +47 -0
  32. python_esios-2.0.1/pyproject.toml +48 -0
  33. python_esios-2.0.1/src/esios/.agents/skills/esios/SKILL.md +162 -0
  34. python_esios-2.0.1/src/esios/__init__.py +21 -0
  35. python_esios-2.0.1/src/esios/async_client.py +121 -0
  36. python_esios-2.0.1/src/esios/cache.py +532 -0
  37. python_esios-2.0.1/src/esios/cli/__init__.py +10 -0
  38. python_esios-2.0.1/src/esios/cli/app.py +49 -0
  39. python_esios-2.0.1/src/esios/cli/archives.py +66 -0
  40. python_esios-2.0.1/src/esios/cli/cache_cmd.py +103 -0
  41. python_esios-2.0.1/src/esios/cli/config.py +63 -0
  42. python_esios-2.0.1/src/esios/cli/config_cmd.py +34 -0
  43. python_esios-2.0.1/src/esios/cli/exec_cmd.py +127 -0
  44. python_esios-2.0.1/src/esios/cli/indicators.py +192 -0
  45. python_esios-2.0.1/src/esios/client.py +181 -0
  46. python_esios-2.0.1/src/esios/constants.py +20 -0
  47. python_esios-2.0.1/src/esios/data/__init__.py +0 -0
  48. python_esios-2.0.1/src/esios/data/catalogs/__init__.py +0 -0
  49. python_esios-2.0.1/src/esios/data/catalogs/archives/__init__.py +5 -0
  50. python_esios-2.0.1/src/esios/data/catalogs/archives/catalog.py +163 -0
  51. python_esios-2.0.1/src/esios/data/catalogs/archives/refresh.py +95 -0
  52. python_esios-2.0.1/src/esios/exceptions.py +28 -0
  53. python_esios-2.0.1/src/esios/managers/__init__.py +9 -0
  54. python_esios-2.0.1/src/esios/managers/archives.py +249 -0
  55. python_esios-2.0.1/src/esios/managers/base.py +31 -0
  56. python_esios-2.0.1/src/esios/managers/indicators.py +452 -0
  57. python_esios-2.0.1/src/esios/managers/offer_indicators.py +118 -0
  58. python_esios-2.0.1/src/esios/models/__init__.py +11 -0
  59. python_esios-2.0.1/src/esios/models/archive.py +41 -0
  60. python_esios-2.0.1/src/esios/models/indicator.py +44 -0
  61. python_esios-2.0.1/src/esios/models/offer_indicator.py +30 -0
  62. python_esios-2.0.1/src/esios/processing/__init__.py +11 -0
  63. python_esios-2.0.1/src/esios/processing/dataframes.py +80 -0
  64. python_esios-2.0.1/src/esios/processing/i90.py +261 -0
  65. python_esios-2.0.1/src/esios/processing/zip.py +53 -0
  66. python_esios-2.0.1/tests/__init__.py +0 -0
  67. python_esios-2.0.1/tests/conftest.py +93 -0
  68. python_esios-2.0.1/tests/test_cache.py +605 -0
  69. python_esios-2.0.1/tests/test_client.py +58 -0
  70. python_esios-2.0.1/tests/test_dataframes.py +92 -0
  71. python_esios-2.0.1/tests/test_exceptions.py +31 -0
  72. python_esios-2.0.1/tests/test_managers.py +256 -0
  73. python_esios-2.0.1/tests/test_models.py +60 -0
  74. python_esios-2.0.1/tests/test_zip.py +44 -0
  75. python_esios-0.2.7/PKG-INFO +0 -75
  76. python_esios-0.2.7/README.md +0 -49
  77. python_esios-0.2.7/esios/__init__.py +0 -3
  78. python_esios-0.2.7/esios/archives/__init__.py +0 -100
  79. python_esios-0.2.7/esios/archives/preprocessing.py +0 -32
  80. python_esios-0.2.7/esios/client.py +0 -57
  81. python_esios-0.2.7/esios/indicators.py +0 -100
  82. python_esios-0.2.7/esios/offer_indicators.py +0 -85
  83. python_esios-0.2.7/python_esios.egg-info/PKG-INFO +0 -75
  84. python_esios-0.2.7/python_esios.egg-info/SOURCES.txt +0 -14
  85. python_esios-0.2.7/python_esios.egg-info/dependency_links.txt +0 -1
  86. python_esios-0.2.7/python_esios.egg-info/requires.txt +0 -2
  87. python_esios-0.2.7/python_esios.egg-info/top_level.txt +0 -1
  88. python_esios-0.2.7/setup.cfg +0 -4
  89. python_esios-0.2.7/setup.py +0 -29
  90. {python_esios-0.2.7 → python_esios-2.0.1}/LICENSE +0 -0
@@ -0,0 +1,28 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ id-token: write # Required for trusted publishing
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+
19
+ - name: Install build tools
20
+ run: pip install build
21
+
22
+ - name: Build package
23
+ run: python -m build
24
+
25
+ - name: Publish to PyPI
26
+ uses: pypa/gh-action-pypi-publish@release/v1
27
+ with:
28
+ skip-existing: true
@@ -0,0 +1,48 @@
1
+ # Python
2
+ __pycache__/
3
+ *.pyc
4
+ *.pyo
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+
9
+ # uv
10
+ .venv/
11
+ uv.lock
12
+
13
+ # Environment
14
+ .env
15
+ .env.*
16
+
17
+ # OS
18
+ .DS_Store
19
+ Thumbs.db
20
+
21
+ # IDE
22
+ .idea/
23
+ .vscode/
24
+ *.swp
25
+ *.swo
26
+
27
+ # Generated docs
28
+ docs/
29
+
30
+ # Data files (large / sensitive)
31
+ *.xls
32
+ *.xlsx
33
+ data/
34
+ !src/esios/data/
35
+
36
+ # Legacy code (superseded by src/)
37
+ esios_legacy/
38
+
39
+ # Test / coverage
40
+ .pytest_cache/
41
+ .coverage
42
+ htmlcov/
43
+
44
+ # Config with secrets
45
+ .config/
46
+
47
+ # Dev scripts
48
+ random/
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ ## [2.0.0] - 2026-02-27
4
+
5
+ Complete rewrite of the library with a new architecture, CLI, and caching system.
6
+
7
+ ### Breaking Changes
8
+
9
+ - New package structure: `from esios import ESIOSClient` (was `from esios.client import Esios`)
10
+ - Indicators return wide-format DataFrames with geo names as columns (e.g., `"España"`)
11
+ - Archives API redesigned with `client.archives.download()`
12
+
13
+ ### Added
14
+
15
+ - **CLI** (`esios`): full command-line interface with `indicators`, `archives`, `cache`, and `config` commands
16
+ - **Multi-geo support**: indicators with multiple geographies return one column per geo (e.g., España, Francia, Portugal)
17
+ - **`--geo` filter**: filter by geography ID or name in both CLI and Python API
18
+ - **Smart caching**: parquet-based cache with per-column gap detection and sparse column support
19
+ - Per-indicator directories (`{id}/data.parquet` + `{id}/meta.json`)
20
+ - Global geo registry (`geos.json`) learned incrementally from API responses
21
+ - Per-endpoint catalog (`catalog.json`) with 24h TTL
22
+ - Per-indicator metadata (`meta.json`) with 7-day TTL
23
+ - Auto-migration from v1 flat cache files
24
+ - **`esios exec`**: ad-hoc pandas expressions on indicator data
25
+ - **`esios indicators meta`**: inspect indicator metadata
26
+ - **`esios cache status`**: Rich panel showing cache health, geos registry, and catalog info
27
+ - **`esios cache geos`**: inspect the global geography registry
28
+ - **`esios config set token`**: store API token in `~/.config/esios/config.toml`
29
+ - **I90 processing**: `I90Book` class for parsing settlement files with automatic frequency detection
30
+ - **Async client**: `AsyncESIOSClient` for concurrent requests
31
+ - **Claude Code plugin**: installable skill with full domain knowledge (`/plugin marketplace add datons/python-esios`)
32
+
33
+ ### Improved
34
+
35
+ - Automatic date-range chunking for large queries (>3 weeks)
36
+ - Atomic file writes (tempfile + rename) for cache safety
37
+ - TTL-based cache freshness: recent data (48h) re-fetched for electricity market corrections
38
+ - Geo enrichment: learns missing geo mappings from API values (e.g., indicator 600 omits Países Bajos/8828)
39
+ - Custom exceptions: `ESIOSError`, `AuthenticationError`, `APIResponseError`, `NetworkError`
40
+
41
+ ## [0.1.0] - 2024-05-15
42
+
43
+ Initial release.
44
+
45
+ - Basic indicator data download
46
+ - Archive file download (I90, Liquicomun, CoefK)
47
+ - I90 preprocessing with sheet access
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-esios
3
+ Version: 2.0.1
4
+ Summary: A Python wrapper for the ESIOS API (Spanish electricity market)
5
+ Project-URL: Homepage, https://github.com/datons/python-esios
6
+ Project-URL: Repository, https://github.com/datons/python-esios
7
+ Author-email: Jesús López <jesus.lopez@datons.ai>
8
+ License-Expression: GPL-3.0-only
9
+ License-File: LICENSE
10
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Requires-Python: >=3.10
18
+ Requires-Dist: beautifulsoup4>=4.12
19
+ Requires-Dist: httpx>=0.27
20
+ Requires-Dist: pandas>=2.0
21
+ Requires-Dist: pyarrow>=15.0
22
+ Requires-Dist: pydantic>=2.0
23
+ Requires-Dist: python-calamine>=0.2
24
+ Requires-Dist: rich>=13.0
25
+ Requires-Dist: tenacity>=8.0
26
+ Requires-Dist: typer>=0.12
27
+ Description-Content-Type: text/markdown
28
+
29
+ # python-esios
30
+
31
+ A Python library and CLI to query the Spanish electricity market API (ESIOS/REE).
32
+
33
+ Download indicators (prices, generation, demand), archives (I90 settlement files), and more.
34
+
35
+ ## Install
36
+
37
+ ```shell
38
+ pip install python-esios
39
+ ```
40
+
41
+ ## Configure your token
42
+
43
+ Request a personal token from [REE](https://www.esios.ree.es/es/pagina/api), then:
44
+
45
+ ```shell
46
+ esios config set token YOUR_TOKEN
47
+ ```
48
+
49
+ This stores the token in `~/.config/esios/config.toml`. Alternatively, set the `ESIOS_API_KEY` environment variable.
50
+
51
+ ## CLI usage
52
+
53
+ ```shell
54
+ # Search indicators
55
+ esios indicators search "precio"
56
+
57
+ # Download historical data
58
+ esios indicators history 600 --start 2025-01-01 --end 2025-01-31
59
+
60
+ # Export to CSV
61
+ esios indicators history 600 -s 2025-01-01 -e 2025-01-31 --format csv --output prices.csv
62
+
63
+ # List archives
64
+ esios archives list
65
+
66
+ # Download I90 settlement files
67
+ esios archives download 1 --start 2025-01-01 --end 2025-01-31
68
+
69
+ # Cache status
70
+ esios cache status
71
+ ```
72
+
73
+ ## Python usage
74
+
75
+ ```python
76
+ from esios import ESIOSClient
77
+
78
+ client = ESIOSClient()
79
+
80
+ # Get indicator data as DataFrame
81
+ handle = client.indicators.get(600) # PVPC price
82
+ df = handle.historical("2025-01-01", "2025-01-31")
83
+
84
+ # Search indicators
85
+ results = client.indicators.search("precio")
86
+
87
+ # Download archives
88
+ client.archives.download(1, start="2025-01-01", end="2025-01-31", output_dir="./data")
89
+ ```
90
+
91
+ ## Common indicators
92
+
93
+ | ID | Name | Description |
94
+ |----|------|-------------|
95
+ | 600 | PVPC | Voluntary price for small consumers |
96
+ | 1001 | Day-ahead price | OMIE spot market price |
97
+ | 10033 | Demand | Real-time electricity demand |
98
+ | 10034 | Wind generation | Real-time wind generation |
99
+ | 10035 | Solar PV generation | Real-time solar generation |
100
+
101
+ ## License
102
+
103
+ GPL-3.0
@@ -0,0 +1,75 @@
1
+ # python-esios
2
+
3
+ A Python library and CLI to query the Spanish electricity market API (ESIOS/REE).
4
+
5
+ Download indicators (prices, generation, demand), archives (I90 settlement files), and more.
6
+
7
+ ## Install
8
+
9
+ ```shell
10
+ pip install python-esios
11
+ ```
12
+
13
+ ## Configure your token
14
+
15
+ Request a personal token from [REE](https://www.esios.ree.es/es/pagina/api), then:
16
+
17
+ ```shell
18
+ esios config set token YOUR_TOKEN
19
+ ```
20
+
21
+ This stores the token in `~/.config/esios/config.toml`. Alternatively, set the `ESIOS_API_KEY` environment variable.
22
+
23
+ ## CLI usage
24
+
25
+ ```shell
26
+ # Search indicators
27
+ esios indicators search "precio"
28
+
29
+ # Download historical data
30
+ esios indicators history 600 --start 2025-01-01 --end 2025-01-31
31
+
32
+ # Export to CSV
33
+ esios indicators history 600 -s 2025-01-01 -e 2025-01-31 --format csv --output prices.csv
34
+
35
+ # List archives
36
+ esios archives list
37
+
38
+ # Download I90 settlement files
39
+ esios archives download 1 --start 2025-01-01 --end 2025-01-31
40
+
41
+ # Cache status
42
+ esios cache status
43
+ ```
44
+
45
+ ## Python usage
46
+
47
+ ```python
48
+ from esios import ESIOSClient
49
+
50
+ client = ESIOSClient()
51
+
52
+ # Get indicator data as DataFrame
53
+ handle = client.indicators.get(600) # PVPC price
54
+ df = handle.historical("2025-01-01", "2025-01-31")
55
+
56
+ # Search indicators
57
+ results = client.indicators.search("precio")
58
+
59
+ # Download archives
60
+ client.archives.download(1, start="2025-01-01", end="2025-01-31", output_dir="./data")
61
+ ```
62
+
63
+ ## Common indicators
64
+
65
+ | ID | Name | Description |
66
+ |----|------|-------------|
67
+ | 600 | PVPC | Voluntary price for small consumers |
68
+ | 1001 | Day-ahead price | OMIE spot market price |
69
+ | 10033 | Demand | Real-time electricity demand |
70
+ | 10034 | Wind generation | Real-time wind generation |
71
+ | 10035 | Solar PV generation | Real-time solar generation |
72
+
73
+ ## License
74
+
75
+ GPL-3.0
@@ -0,0 +1,5 @@
1
+ # Generated artifacts from running notebooks
2
+ *.csv
3
+ *.xlsx
4
+ *.parquet
5
+ data/