pypsa-explorer 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.
- pypsa_explorer-0.1.0/CHANGELOG.md +45 -0
- pypsa_explorer-0.1.0/CONTRIBUTING.md +267 -0
- pypsa_explorer-0.1.0/LICENSE +21 -0
- pypsa_explorer-0.1.0/MANIFEST.in +14 -0
- pypsa_explorer-0.1.0/PKG-INFO +355 -0
- pypsa_explorer-0.1.0/README.md +302 -0
- pypsa_explorer-0.1.0/pyproject.toml +161 -0
- pypsa_explorer-0.1.0/setup.cfg +4 -0
- pypsa_explorer-0.1.0/setup.py +10 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/__init__.py +20 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/app.py +127 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/callbacks/__init__.py +36 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/callbacks/data_explorer.py +227 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/callbacks/filters.py +40 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/callbacks/navigation.py +55 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/callbacks/network.py +434 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/callbacks/theme.py +25 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/callbacks/visualizations.py +521 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/cli.py +162 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/config.py +1579 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/layouts/__init__.py +33 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/layouts/components.py +506 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/layouts/dashboard.py +158 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/layouts/tabs.py +165 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/layouts/welcome.py +325 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/py.typed +1 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/utils/__init__.py +17 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/utils/data_table.py +129 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/utils/helpers.py +208 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer/utils/network_loader.py +102 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer.egg-info/PKG-INFO +355 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer.egg-info/SOURCES.txt +42 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer.egg-info/dependency_links.txt +1 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer.egg-info/entry_points.txt +2 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer.egg-info/requires.txt +32 -0
- pypsa_explorer-0.1.0/src/pypsa_explorer.egg-info/top_level.txt +1 -0
- pypsa_explorer-0.1.0/tests/__init__.py +1 -0
- pypsa_explorer-0.1.0/tests/conftest.py +47 -0
- pypsa_explorer-0.1.0/tests/test_app.py +101 -0
- pypsa_explorer-0.1.0/tests/test_callbacks_data_explorer.py +673 -0
- pypsa_explorer-0.1.0/tests/test_cli.py +232 -0
- pypsa_explorer-0.1.0/tests/test_navigation.py +322 -0
- pypsa_explorer-0.1.0/tests/test_theme.py +185 -0
- pypsa_explorer-0.1.0/tests/test_utils.py +138 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2024-10-04
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Initial release of PyPSA Explorer
|
|
14
|
+
- Interactive dashboard with multiple visualization tabs:
|
|
15
|
+
- Energy Balance Timeseries
|
|
16
|
+
- Energy Balance Totals
|
|
17
|
+
- Capacity Totals
|
|
18
|
+
- CAPEX Totals
|
|
19
|
+
- OPEX Totals
|
|
20
|
+
- Network Configuration (map + metadata)
|
|
21
|
+
- Multi-network support with dropdown selector
|
|
22
|
+
- Global filters for carriers and countries
|
|
23
|
+
- Command-line interface for easy deployment
|
|
24
|
+
- Python API for programmatic usage
|
|
25
|
+
- Comprehensive documentation and examples
|
|
26
|
+
- Production-ready package structure with:
|
|
27
|
+
- Modular codebase organization
|
|
28
|
+
- Type hints throughout
|
|
29
|
+
- Testing infrastructure with pytest
|
|
30
|
+
- CI/CD pipeline with GitHub Actions
|
|
31
|
+
- Pre-commit hooks for code quality
|
|
32
|
+
- Professional README and documentation
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- Refactored from single-file application to modular package structure
|
|
36
|
+
- Improved code organization with separate modules for layouts, callbacks, and utilities
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- None
|
|
40
|
+
|
|
41
|
+
### Security
|
|
42
|
+
- None
|
|
43
|
+
|
|
44
|
+
[Unreleased]: https://github.com/openenergytransition/pypsa-explorer/compare/v0.1.0...HEAD
|
|
45
|
+
[0.1.0]: https://github.com/openenergytransition/pypsa-explorer/releases/tag/v0.1.0
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Contributing to PyPSA Explorer
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to PyPSA Explorer! This document provides guidelines and instructions for contributing.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
We are committed to providing a welcoming and inclusive environment. Please be respectful and constructive in your interactions.
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
### 1. Fork and Clone
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Fork the repository on GitHub, then clone your fork
|
|
15
|
+
git clone https://github.com/YOUR_USERNAME/pypsa-explorer.git
|
|
16
|
+
cd pypsa-explorer
|
|
17
|
+
|
|
18
|
+
# Add upstream remote
|
|
19
|
+
git remote add upstream https://github.com/openenergytransition/pypsa-explorer.git
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### 2. Set Up Development Environment
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Create virtual environment
|
|
26
|
+
python -m venv venv
|
|
27
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
28
|
+
|
|
29
|
+
# Install development dependencies
|
|
30
|
+
pip install -e ".[dev]"
|
|
31
|
+
|
|
32
|
+
# Install pre-commit hooks
|
|
33
|
+
pre-commit install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 3. Create a Branch
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Update your main branch
|
|
40
|
+
git checkout main
|
|
41
|
+
git pull upstream main
|
|
42
|
+
|
|
43
|
+
# Create a feature branch
|
|
44
|
+
git checkout -b feature/your-feature-name
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Development Workflow
|
|
48
|
+
|
|
49
|
+
### Code Style
|
|
50
|
+
|
|
51
|
+
We use the following tools for code quality:
|
|
52
|
+
|
|
53
|
+
- **Black**: Code formatting (line length: 125)
|
|
54
|
+
- **Ruff**: Linting and code quality checks
|
|
55
|
+
- **MyPy**: Static type checking
|
|
56
|
+
|
|
57
|
+
Format your code before committing:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Format code
|
|
61
|
+
black src/ tests/
|
|
62
|
+
ruff format src/ tests/
|
|
63
|
+
|
|
64
|
+
# Check linting
|
|
65
|
+
ruff check src/ tests/ --fix
|
|
66
|
+
|
|
67
|
+
# Type checking
|
|
68
|
+
mypy src/
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Testing
|
|
72
|
+
|
|
73
|
+
Write tests for new features and bug fixes:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Run all tests
|
|
77
|
+
pytest
|
|
78
|
+
|
|
79
|
+
# Run with coverage
|
|
80
|
+
pytest --cov=pypsa_explorer --cov-report=html
|
|
81
|
+
|
|
82
|
+
# Run specific test
|
|
83
|
+
pytest tests/test_app.py -v
|
|
84
|
+
|
|
85
|
+
# Run tests in watch mode (requires pytest-watch)
|
|
86
|
+
ptw
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Documentation
|
|
90
|
+
|
|
91
|
+
Update documentation for any user-facing changes:
|
|
92
|
+
|
|
93
|
+
- Update docstrings in code (Google style)
|
|
94
|
+
- Update README.md if needed
|
|
95
|
+
- Add examples for new features
|
|
96
|
+
- Update CHANGELOG.md
|
|
97
|
+
|
|
98
|
+
### Type Hints
|
|
99
|
+
|
|
100
|
+
All code should include type hints:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
def process_network(
|
|
104
|
+
network: pypsa.Network,
|
|
105
|
+
carriers: list[str],
|
|
106
|
+
query: str | None = None,
|
|
107
|
+
) -> dict[str, Any]:
|
|
108
|
+
"""
|
|
109
|
+
Process network data with optional filtering.
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
network : pypsa.Network
|
|
114
|
+
The PyPSA network to process
|
|
115
|
+
carriers : list[str]
|
|
116
|
+
List of carrier names to include
|
|
117
|
+
query : str | None
|
|
118
|
+
Optional pandas query string for filtering
|
|
119
|
+
|
|
120
|
+
Returns
|
|
121
|
+
-------
|
|
122
|
+
dict[str, Any]
|
|
123
|
+
Processed network data
|
|
124
|
+
"""
|
|
125
|
+
# Implementation
|
|
126
|
+
pass
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Pull Request Process
|
|
130
|
+
|
|
131
|
+
### 1. Commit Your Changes
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Stage changes
|
|
135
|
+
git add .
|
|
136
|
+
|
|
137
|
+
# Commit with descriptive message
|
|
138
|
+
git commit -m "Add feature: description of your changes"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Follow these commit message guidelines:
|
|
142
|
+
- Use present tense ("Add feature" not "Added feature")
|
|
143
|
+
- Use imperative mood ("Move cursor to..." not "Moves cursor to...")
|
|
144
|
+
- Reference issues and pull requests where applicable
|
|
145
|
+
- First line should be concise (50 chars or less)
|
|
146
|
+
|
|
147
|
+
### 2. Push to Your Fork
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
git push origin feature/your-feature-name
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 3. Create Pull Request
|
|
154
|
+
|
|
155
|
+
1. Go to the [PyPSA Explorer repository](https://github.com/openenergytransition/pypsa-explorer)
|
|
156
|
+
2. Click "New Pull Request"
|
|
157
|
+
3. Select your fork and branch
|
|
158
|
+
4. Fill in the PR template:
|
|
159
|
+
- Describe the changes
|
|
160
|
+
- Reference related issues
|
|
161
|
+
- Include screenshots for UI changes
|
|
162
|
+
- List any breaking changes
|
|
163
|
+
- Confirm tests pass
|
|
164
|
+
|
|
165
|
+
### 4. Code Review
|
|
166
|
+
|
|
167
|
+
- Address review comments
|
|
168
|
+
- Push updates to the same branch
|
|
169
|
+
- Request re-review when ready
|
|
170
|
+
|
|
171
|
+
### 5. Merge
|
|
172
|
+
|
|
173
|
+
Once approved, a maintainer will merge your PR.
|
|
174
|
+
|
|
175
|
+
## What to Contribute
|
|
176
|
+
|
|
177
|
+
### Bug Reports
|
|
178
|
+
|
|
179
|
+
Found a bug? Please open an issue with:
|
|
180
|
+
- Clear description of the problem
|
|
181
|
+
- Steps to reproduce
|
|
182
|
+
- Expected vs actual behavior
|
|
183
|
+
- Environment details (OS, Python version, package versions)
|
|
184
|
+
- Minimal code example if possible
|
|
185
|
+
|
|
186
|
+
### Feature Requests
|
|
187
|
+
|
|
188
|
+
Have an idea? Open an issue with:
|
|
189
|
+
- Clear description of the feature
|
|
190
|
+
- Use cases and benefits
|
|
191
|
+
- Possible implementation approach
|
|
192
|
+
- Willingness to contribute
|
|
193
|
+
|
|
194
|
+
### Good First Issues
|
|
195
|
+
|
|
196
|
+
Look for issues labeled `good-first-issue` for beginner-friendly tasks.
|
|
197
|
+
|
|
198
|
+
### Priority Areas
|
|
199
|
+
|
|
200
|
+
We especially welcome contributions in:
|
|
201
|
+
- Additional visualization types
|
|
202
|
+
- Export functionality (PNG, PDF, CSV)
|
|
203
|
+
- Performance optimizations
|
|
204
|
+
- Documentation improvements
|
|
205
|
+
- Test coverage expansion
|
|
206
|
+
- Accessibility improvements
|
|
207
|
+
|
|
208
|
+
## Project Structure
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
pypsa-explorer/
|
|
212
|
+
├── src/pypsa_explorer/ # Main package code
|
|
213
|
+
│ ├── callbacks/ # Dash callbacks
|
|
214
|
+
│ ├── layouts/ # UI components
|
|
215
|
+
│ └── utils/ # Utility functions
|
|
216
|
+
├── tests/ # Test suite
|
|
217
|
+
├── docs/ # Documentation
|
|
218
|
+
└── examples/ # Example scripts and notebooks
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Development Tips
|
|
222
|
+
|
|
223
|
+
### Running in Debug Mode
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
from pypsa_explorer import run_dashboard
|
|
227
|
+
|
|
228
|
+
run_dashboard(debug=True) # Enable hot-reloading
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Testing Callbacks
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
from dash.testing.application_runners import import_app
|
|
235
|
+
|
|
236
|
+
def test_callback(dash_duo):
|
|
237
|
+
app = import_app("pypsa_explorer.app")
|
|
238
|
+
dash_duo.start_server(app)
|
|
239
|
+
# Test interactions
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Adding New Visualizations
|
|
243
|
+
|
|
244
|
+
1. Add layout in `src/pypsa_explorer/layouts/tabs.py`
|
|
245
|
+
2. Add callback in `src/pypsa_explorer/callbacks/visualizations.py`
|
|
246
|
+
3. Register callback in `src/pypsa_explorer/callbacks/__init__.py`
|
|
247
|
+
4. Add tests in `tests/test_visualizations.py`
|
|
248
|
+
|
|
249
|
+
## Release Process
|
|
250
|
+
|
|
251
|
+
(For maintainers)
|
|
252
|
+
|
|
253
|
+
1. Update version in `pyproject.toml` and `src/pypsa_explorer/__init__.py`
|
|
254
|
+
2. Update CHANGELOG.md
|
|
255
|
+
3. Create release branch: `git checkout -b release/vX.Y.Z`
|
|
256
|
+
4. Tag release: `git tag vX.Y.Z`
|
|
257
|
+
5. Push tag: `git push origin vX.Y.Z`
|
|
258
|
+
6. Build and publish to PyPI: `python -m build && twine upload dist/*`
|
|
259
|
+
7. Create GitHub release with changelog
|
|
260
|
+
|
|
261
|
+
## Questions?
|
|
262
|
+
|
|
263
|
+
- Open an issue for questions
|
|
264
|
+
- Join our [discussions](https://github.com/openenergytransition/pypsa-explorer/discussions)
|
|
265
|
+
- Contact the maintainers
|
|
266
|
+
|
|
267
|
+
Thank you for contributing to PyPSA Explorer! 🎉
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 OET Network Viewer contributors
|
|
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
|
|
13
|
+
all 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.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include CHANGELOG.md
|
|
4
|
+
include CONTRIBUTING.md
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
|
|
7
|
+
recursive-include src/pypsa_explorer *.py
|
|
8
|
+
recursive-include src/pypsa_explorer py.typed
|
|
9
|
+
recursive-include tests *.py
|
|
10
|
+
|
|
11
|
+
exclude .gitignore
|
|
12
|
+
exclude .pre-commit-config.yaml
|
|
13
|
+
recursive-exclude * __pycache__
|
|
14
|
+
recursive-exclude * *.py[co]
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pypsa-explorer
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Interactive dashboard for visualizing and analyzing PyPSA energy system networks
|
|
5
|
+
Author-email: Open Energy Transition <info@openenergytransition.org>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/openenergytransition/pypsa-explorer
|
|
8
|
+
Project-URL: Documentation, https://pypsa-explorer.readthedocs.io
|
|
9
|
+
Project-URL: Repository, https://github.com/openenergytransition/pypsa-explorer
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/openenergytransition/pypsa-explorer/issues
|
|
11
|
+
Keywords: pypsa,energy,visualization,dashboard,power-system
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: plotly>=5.0
|
|
24
|
+
Requires-Dist: dash>=2.14
|
|
25
|
+
Requires-Dist: folium>=0.14
|
|
26
|
+
Requires-Dist: mapclassify>=2.5
|
|
27
|
+
Requires-Dist: dash-bootstrap-components>=1.5
|
|
28
|
+
Requires-Dist: pypsa>=1.0.3
|
|
29
|
+
Requires-Dist: pyyaml>=6.0
|
|
30
|
+
Requires-Dist: typer>=0.9
|
|
31
|
+
Requires-Dist: rich>=13.0
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-mock>=3.11; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy>=1.5; extra == "dev"
|
|
39
|
+
Requires-Dist: pre-commit>=3.4; extra == "dev"
|
|
40
|
+
Requires-Dist: ipython>=8.0; extra == "dev"
|
|
41
|
+
Requires-Dist: jupyter>=1.0; extra == "dev"
|
|
42
|
+
Requires-Dist: nbconvert>=7.0; extra == "dev"
|
|
43
|
+
Provides-Extra: docs
|
|
44
|
+
Requires-Dist: sphinx>=7.0; extra == "docs"
|
|
45
|
+
Requires-Dist: sphinx-rtd-theme>=1.3; extra == "docs"
|
|
46
|
+
Requires-Dist: sphinx-autodoc-typehints>=1.24; extra == "docs"
|
|
47
|
+
Requires-Dist: myst-parser>=2.0; extra == "docs"
|
|
48
|
+
Provides-Extra: test
|
|
49
|
+
Requires-Dist: pytest>=7.4; extra == "test"
|
|
50
|
+
Requires-Dist: pytest-cov>=4.1; extra == "test"
|
|
51
|
+
Requires-Dist: pytest-mock>=3.11; extra == "test"
|
|
52
|
+
Dynamic: license-file
|
|
53
|
+
|
|
54
|
+
# PyPSA Explorer
|
|
55
|
+
|
|
56
|
+
[](https://badge.fury.io/py/pypsa-explorer)
|
|
57
|
+
[](https://opensource.org/licenses/MIT)
|
|
58
|
+
[](https://www.python.org/downloads/)
|
|
59
|
+
[](https://github.com/psf/black)
|
|
60
|
+
|
|
61
|
+
Interactive dashboard for visualizing and analyzing PyPSA energy system networks. Built with Dash and Plotly, PyPSA Explorer provides a comprehensive web interface for exploring energy system models with powerful filtering and visualization capabilities.
|
|
62
|
+
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
### 📊 Interactive Visualizations
|
|
66
|
+
- **Energy Balance Analysis**: Timeseries and aggregated views of energy flows
|
|
67
|
+
- **Capacity Planning**: Visualize optimal capacity distribution by carrier and region
|
|
68
|
+
- **Economic Analysis**: CAPEX and OPEX breakdowns across the system
|
|
69
|
+
- **Network Maps**: Interactive geographical visualization of network topology
|
|
70
|
+
- **Multi-Network Support**: Load and compare multiple networks seamlessly
|
|
71
|
+
|
|
72
|
+
### 🎯 Advanced Filtering
|
|
73
|
+
- Filter by energy carrier (sector)
|
|
74
|
+
- Filter by country/region
|
|
75
|
+
- Dynamic updates across all visualizations
|
|
76
|
+
- Tab-specific filter behavior
|
|
77
|
+
|
|
78
|
+
### 🚀 Production Ready
|
|
79
|
+
- Well-structured, modular codebase
|
|
80
|
+
- Comprehensive type hints
|
|
81
|
+
- Extensive test coverage
|
|
82
|
+
- CI/CD pipeline integration
|
|
83
|
+
- Professional documentation
|
|
84
|
+
|
|
85
|
+
## Installation
|
|
86
|
+
|
|
87
|
+
### From PyPI (Recommended)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip install pypsa-explorer
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### From Source
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git clone https://github.com/openenergytransition/pypsa-explorer.git
|
|
97
|
+
cd pypsa-explorer
|
|
98
|
+
pip install -e .
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Development Installation
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
git clone https://github.com/openenergytransition/pypsa-explorer.git
|
|
105
|
+
cd pypsa-explorer
|
|
106
|
+
pip install -e ".[dev]"
|
|
107
|
+
pre-commit install
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Quick Start
|
|
111
|
+
|
|
112
|
+
### Command Line Interface
|
|
113
|
+
|
|
114
|
+
Launch the landing page and drag-and-drop networks or load the bundled example:
|
|
115
|
+
```bash
|
|
116
|
+
pypsa-explorer
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Run with your own network:
|
|
120
|
+
```bash
|
|
121
|
+
pypsa-explorer /path/to/network.nc
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Run with multiple networks:
|
|
125
|
+
```bash
|
|
126
|
+
pypsa-explorer /path/to/network1.nc:Label1 /path/to/network2.nc:Label2
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Custom host and port:
|
|
130
|
+
```bash
|
|
131
|
+
pypsa-explorer --host 0.0.0.0 --port 8080
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Production mode (no debug):
|
|
135
|
+
```bash
|
|
136
|
+
pypsa-explorer --no-debug
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Python API
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from pypsa_explorer import run_dashboard
|
|
143
|
+
|
|
144
|
+
# Run with default network
|
|
145
|
+
run_dashboard()
|
|
146
|
+
|
|
147
|
+
# Run with custom network
|
|
148
|
+
run_dashboard("/path/to/network.nc")
|
|
149
|
+
|
|
150
|
+
# Run with multiple networks
|
|
151
|
+
networks = {
|
|
152
|
+
"Scenario A": "/path/to/network1.nc",
|
|
153
|
+
"Scenario B": "/path/to/network2.nc",
|
|
154
|
+
}
|
|
155
|
+
run_dashboard(networks, debug=True, host="0.0.0.0", port=8050)
|
|
156
|
+
|
|
157
|
+
# Run with Network objects
|
|
158
|
+
import pypsa
|
|
159
|
+
n1 = pypsa.Network("network1.nc")
|
|
160
|
+
n2 = pypsa.Network("network2.nc")
|
|
161
|
+
|
|
162
|
+
run_dashboard({"Network 1": n1, "Network 2": n2})
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Programmatic App Creation
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
from pypsa_explorer import create_app
|
|
169
|
+
|
|
170
|
+
# Create app instance
|
|
171
|
+
app = create_app(networks_input="/path/to/network.nc", title="My Dashboard")
|
|
172
|
+
|
|
173
|
+
# Run with custom server
|
|
174
|
+
app.run(debug=True, host="0.0.0.0", port=8050)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Project Structure
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
pypsa-explorer/
|
|
181
|
+
├── src/
|
|
182
|
+
│ └── pypsa_explorer/
|
|
183
|
+
│ ├── __init__.py # Package initialization
|
|
184
|
+
│ ├── app.py # Main application factory
|
|
185
|
+
│ ├── cli.py # Command-line interface
|
|
186
|
+
│ ├── config.py # Configuration and theming
|
|
187
|
+
│ ├── callbacks/ # Dash callbacks
|
|
188
|
+
│ │ ├── __init__.py
|
|
189
|
+
│ │ ├── filters.py # Filter callbacks
|
|
190
|
+
│ │ ├── navigation.py # Navigation callbacks
|
|
191
|
+
│ │ ├── network.py # Network callbacks
|
|
192
|
+
│ │ └── visualizations.py # Visualization callbacks
|
|
193
|
+
│ ├── layouts/ # UI layouts
|
|
194
|
+
│ │ ├── __init__.py
|
|
195
|
+
│ │ ├── components.py # Reusable components
|
|
196
|
+
│ │ ├── dashboard.py # Main dashboard layout
|
|
197
|
+
│ │ ├── tabs.py # Tab definitions
|
|
198
|
+
│ │ └── welcome.py # Welcome page
|
|
199
|
+
│ └── utils/ # Utility functions
|
|
200
|
+
│ ├── __init__.py
|
|
201
|
+
│ ├── helpers.py # Helper functions
|
|
202
|
+
│ └── network_loader.py # Network loading utilities
|
|
203
|
+
├── tests/ # Test suite
|
|
204
|
+
├── docs/ # Documentation
|
|
205
|
+
├── examples/ # Example notebooks and scripts
|
|
206
|
+
├── pyproject.toml # Project configuration
|
|
207
|
+
├── README.md # This file
|
|
208
|
+
├── LICENSE # MIT License
|
|
209
|
+
└── CHANGELOG.md # Version history
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Development
|
|
213
|
+
|
|
214
|
+
### Setup Development Environment
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# Clone repository
|
|
218
|
+
git clone https://github.com/openenergytransition/pypsa-explorer.git
|
|
219
|
+
cd pypsa-explorer
|
|
220
|
+
|
|
221
|
+
# Install with dev dependencies
|
|
222
|
+
pip install -e ".[dev]"
|
|
223
|
+
|
|
224
|
+
# Install pre-commit hooks
|
|
225
|
+
pre-commit install
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Running Tests
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Run all tests
|
|
232
|
+
pytest
|
|
233
|
+
|
|
234
|
+
# Run with coverage
|
|
235
|
+
pytest --cov=pypsa_explorer --cov-report=html
|
|
236
|
+
|
|
237
|
+
# Run specific test file
|
|
238
|
+
pytest tests/test_app.py
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Code Quality
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Format code
|
|
245
|
+
black src/ tests/
|
|
246
|
+
ruff format src/ tests/
|
|
247
|
+
|
|
248
|
+
# Lint code
|
|
249
|
+
ruff check src/ tests/ --fix
|
|
250
|
+
|
|
251
|
+
# Type checking
|
|
252
|
+
mypy src/
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Building Documentation
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
cd docs
|
|
259
|
+
make html
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## Configuration
|
|
263
|
+
|
|
264
|
+
### Custom Styling
|
|
265
|
+
|
|
266
|
+
The dashboard theme can be customized by modifying `src/pypsa_explorer/config.py`:
|
|
267
|
+
|
|
268
|
+
```python
|
|
269
|
+
COLORS = {
|
|
270
|
+
"primary": "#2c3e50",
|
|
271
|
+
"secondary": "#3498db",
|
|
272
|
+
"accent": "#2ecc71",
|
|
273
|
+
# ... more colors
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Default Settings
|
|
278
|
+
|
|
279
|
+
- **Port**: 8050
|
|
280
|
+
- **Host**: 127.0.0.1 (localhost)
|
|
281
|
+
- **Debug Mode**: True (disable with `--no-debug`)
|
|
282
|
+
- **Default Carriers**: AC, Hydrogen Storage, Low Voltage
|
|
283
|
+
|
|
284
|
+
## Requirements
|
|
285
|
+
|
|
286
|
+
- Python >= 3.12
|
|
287
|
+
- PyPSA (from GitHub master)
|
|
288
|
+
- Dash >= 2.14
|
|
289
|
+
- Plotly >= 5.0
|
|
290
|
+
- Folium >= 0.14
|
|
291
|
+
- dash-bootstrap-components >= 1.5
|
|
292
|
+
|
|
293
|
+
See `pyproject.toml` for complete dependency list.
|
|
294
|
+
|
|
295
|
+
## Contributing
|
|
296
|
+
|
|
297
|
+
Contributions are welcome! Please follow these steps:
|
|
298
|
+
|
|
299
|
+
1. Fork the repository
|
|
300
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
301
|
+
3. Make your changes
|
|
302
|
+
4. Run tests and linting (`pytest && ruff check`)
|
|
303
|
+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
304
|
+
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
305
|
+
7. Open a Pull Request
|
|
306
|
+
|
|
307
|
+
Please ensure:
|
|
308
|
+
- All tests pass
|
|
309
|
+
- Code is properly formatted (black/ruff)
|
|
310
|
+
- Type hints are included
|
|
311
|
+
- Documentation is updated
|
|
312
|
+
|
|
313
|
+
## License
|
|
314
|
+
|
|
315
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
316
|
+
|
|
317
|
+
## Citation
|
|
318
|
+
|
|
319
|
+
If you use PyPSA Explorer in your research, please cite:
|
|
320
|
+
|
|
321
|
+
```bibtex
|
|
322
|
+
@software{pypsa_explorer,
|
|
323
|
+
title = {PyPSA Explorer: Interactive Dashboard for Energy System Analysis},
|
|
324
|
+
author = {Open Energy Transition},
|
|
325
|
+
year = {2024},
|
|
326
|
+
url = {https://github.com/openenergytransition/pypsa-explorer}
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Acknowledgments
|
|
331
|
+
|
|
332
|
+
- Built on [PyPSA](https://pypsa.org) - Python for Power System Analysis
|
|
333
|
+
- Powered by [Dash](https://dash.plotly.com/) and [Plotly](https://plotly.com/)
|
|
334
|
+
- Developed by [Open Energy Transition](https://openenergytransition.org)
|
|
335
|
+
|
|
336
|
+
## Support
|
|
337
|
+
|
|
338
|
+
- **Documentation**: [https://pypsa-explorer.readthedocs.io](https://pypsa-explorer.readthedocs.io)
|
|
339
|
+
- **Issues**: [GitHub Issues](https://github.com/openenergytransition/pypsa-explorer/issues)
|
|
340
|
+
- **Discussions**: [GitHub Discussions](https://github.com/openenergytransition/pypsa-explorer/discussions)
|
|
341
|
+
|
|
342
|
+
## Roadmap
|
|
343
|
+
|
|
344
|
+
- [ ] Export functionality (PNG, PDF, data export)
|
|
345
|
+
- [ ] Advanced comparison mode for multiple networks
|
|
346
|
+
- [ ] Custom calculation and plotting plugins
|
|
347
|
+
- [ ] Real-time data streaming support
|
|
348
|
+
- [ ] Collaborative features and sharing
|
|
349
|
+
- [ ] Integration with cloud storage (S3, GCS)
|
|
350
|
+
|
|
351
|
+
## Related Projects
|
|
352
|
+
|
|
353
|
+
- [PyPSA](https://github.com/PyPSA/PyPSA) - The core power system analysis framework
|
|
354
|
+
- [PyPSA-Eur](https://github.com/PyPSA/pypsa-eur) - Open energy system model for Europe
|
|
355
|
+
- [PyPSA-Earth](https://github.com/pypsa-meets-earth/pypsa-earth) - Global energy system model
|