pyconvexity 0.4.8__py3-none-any.whl
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.
Potentially problematic release.
This version of pyconvexity might be problematic. Click here for more details.
- pyconvexity/__init__.py +241 -0
- pyconvexity/_version.py +1 -0
- pyconvexity/core/__init__.py +60 -0
- pyconvexity/core/database.py +485 -0
- pyconvexity/core/errors.py +106 -0
- pyconvexity/core/types.py +400 -0
- pyconvexity/dashboard.py +265 -0
- pyconvexity/data/README.md +101 -0
- pyconvexity/data/__init__.py +17 -0
- pyconvexity/data/loaders/__init__.py +3 -0
- pyconvexity/data/loaders/cache.py +213 -0
- pyconvexity/data/schema/01_core_schema.sql +420 -0
- pyconvexity/data/schema/02_data_metadata.sql +120 -0
- pyconvexity/data/schema/03_validation_data.sql +507 -0
- pyconvexity/data/sources/__init__.py +5 -0
- pyconvexity/data/sources/gem.py +442 -0
- pyconvexity/io/__init__.py +26 -0
- pyconvexity/io/excel_exporter.py +1226 -0
- pyconvexity/io/excel_importer.py +1381 -0
- pyconvexity/io/netcdf_exporter.py +191 -0
- pyconvexity/io/netcdf_importer.py +1802 -0
- pyconvexity/models/__init__.py +195 -0
- pyconvexity/models/attributes.py +730 -0
- pyconvexity/models/carriers.py +159 -0
- pyconvexity/models/components.py +611 -0
- pyconvexity/models/network.py +503 -0
- pyconvexity/models/results.py +148 -0
- pyconvexity/models/scenarios.py +234 -0
- pyconvexity/solvers/__init__.py +29 -0
- pyconvexity/solvers/pypsa/__init__.py +30 -0
- pyconvexity/solvers/pypsa/api.py +446 -0
- pyconvexity/solvers/pypsa/batch_loader.py +296 -0
- pyconvexity/solvers/pypsa/builder.py +655 -0
- pyconvexity/solvers/pypsa/clearing_price.py +678 -0
- pyconvexity/solvers/pypsa/constraints.py +405 -0
- pyconvexity/solvers/pypsa/solver.py +1442 -0
- pyconvexity/solvers/pypsa/storage.py +2096 -0
- pyconvexity/timeseries.py +330 -0
- pyconvexity/validation/__init__.py +25 -0
- pyconvexity/validation/rules.py +312 -0
- pyconvexity-0.4.8.dist-info/METADATA +148 -0
- pyconvexity-0.4.8.dist-info/RECORD +44 -0
- pyconvexity-0.4.8.dist-info/WHEEL +5 -0
- pyconvexity-0.4.8.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyconvexity
|
|
3
|
+
Version: 0.4.8
|
|
4
|
+
Summary: Python library for energy system modeling and optimization with PyPSA
|
|
5
|
+
Author-email: Convexity Team <info@convexity.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/bayesian-energy/pyconvexity
|
|
8
|
+
Project-URL: Repository, https://github.com/bayesian-energy/pyconvexity
|
|
9
|
+
Project-URL: Issues, https://github.com/bayesian-energy/pyconvexity/issues
|
|
10
|
+
Project-URL: Documentation, https://pyconvexity.readthedocs.io
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Requires-Dist: pandas>=1.5.0
|
|
23
|
+
Requires-Dist: numpy>=1.21.0
|
|
24
|
+
Requires-Dist: pyarrow>=10.0.0
|
|
25
|
+
Provides-Extra: pypsa
|
|
26
|
+
Requires-Dist: pypsa>=0.25.0; extra == "pypsa"
|
|
27
|
+
Requires-Dist: networkx; extra == "pypsa"
|
|
28
|
+
Requires-Dist: scipy; extra == "pypsa"
|
|
29
|
+
Requires-Dist: xarray; extra == "pypsa"
|
|
30
|
+
Provides-Extra: excel
|
|
31
|
+
Requires-Dist: openpyxl>=3.0.0; extra == "excel"
|
|
32
|
+
Requires-Dist: xlsxwriter>=3.0.0; extra == "excel"
|
|
33
|
+
Provides-Extra: netcdf
|
|
34
|
+
Requires-Dist: netcdf4>=1.6.0; extra == "netcdf"
|
|
35
|
+
Requires-Dist: xarray>=2022.3.0; extra == "netcdf"
|
|
36
|
+
Provides-Extra: data
|
|
37
|
+
Requires-Dist: country-converter>=1.0.0; extra == "data"
|
|
38
|
+
Requires-Dist: pyyaml>=6.0.0; extra == "data"
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
42
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
43
|
+
Requires-Dist: isort>=5.10.0; extra == "dev"
|
|
44
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
45
|
+
Requires-Dist: pre-commit>=2.20.0; extra == "dev"
|
|
46
|
+
Provides-Extra: all
|
|
47
|
+
Requires-Dist: pyconvexity[data,excel,netcdf,pypsa]; extra == "all"
|
|
48
|
+
|
|
49
|
+
# pyconvexity
|
|
50
|
+
|
|
51
|
+
Python library for energy system modeling and optimization with PyPSA.
|
|
52
|
+
|
|
53
|
+
[](https://badge.fury.io/py/pyconvexity)
|
|
54
|
+
[](https://www.python.org/downloads/)
|
|
55
|
+
[](https://opensource.org/licenses/MIT)
|
|
56
|
+
|
|
57
|
+
## Overview
|
|
58
|
+
|
|
59
|
+
pyconvexity is the Python library that powers [Convexity](https://bayesian.energy/convexity), providing programmatic access to energy system modeling and optimization. It stores models in SQLite databases and integrates with PyPSA for solving.
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install pyconvexity
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
With optional dependencies:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install pyconvexity[pypsa] # PyPSA solver integration
|
|
71
|
+
pip install pyconvexity[excel] # Excel import/export
|
|
72
|
+
pip install pyconvexity[all] # All optional dependencies
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Quick Start
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
import pyconvexity as px
|
|
79
|
+
|
|
80
|
+
# Create a new model database
|
|
81
|
+
px.create_database_with_schema("my_model.db")
|
|
82
|
+
|
|
83
|
+
# Create a network
|
|
84
|
+
with px.database_context("my_model.db") as conn:
|
|
85
|
+
network_req = px.CreateNetworkRequest(
|
|
86
|
+
name="My Network",
|
|
87
|
+
start_time="2024-01-01 00:00:00",
|
|
88
|
+
end_time="2024-01-01 23:00:00",
|
|
89
|
+
time_resolution="PT1H",
|
|
90
|
+
)
|
|
91
|
+
px.create_network(conn, network_req)
|
|
92
|
+
|
|
93
|
+
# Create components
|
|
94
|
+
carrier_id = px.create_carrier(conn, name="AC")
|
|
95
|
+
bus_id = px.create_component(conn, "BUS", "Main Bus", carrier_id=carrier_id)
|
|
96
|
+
|
|
97
|
+
conn.commit()
|
|
98
|
+
|
|
99
|
+
# Solve the network
|
|
100
|
+
result = px.solve_network("my_model.db", solver_name="highs")
|
|
101
|
+
print(f"Success: {result['success']}, Objective: {result['objective_value']}")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Documentation
|
|
105
|
+
|
|
106
|
+
Full documentation is available at: **[docs.bayesian.energy](https://docs.bayesian.energy/convexity/user-guide/advanced-features/pyconvexity/)**
|
|
107
|
+
|
|
108
|
+
- [API Reference](https://docs.bayesian.energy/convexity/user-guide/advanced-features/pyconvexity/api/api-reference)
|
|
109
|
+
- [Examples & Tutorials](https://docs.bayesian.energy/convexity/user-guide/advanced-features/pyconvexity/examples/example-1/)
|
|
110
|
+
|
|
111
|
+
## Development
|
|
112
|
+
|
|
113
|
+
### Setup
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/bayesian-energy/pyconvexity.git
|
|
117
|
+
cd pyconvexity
|
|
118
|
+
pip install -e ".[dev,all]"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Running Tests
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pytest
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Documentation Deployment
|
|
128
|
+
|
|
129
|
+
API documentation is auto-generated and synced to [bayesian-docs](https://github.com/bayesian-energy/bayesian-docs).
|
|
130
|
+
|
|
131
|
+
**Generate API docs locally:**
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
python scripts/generate_api_docs.py --output-dir api-docs
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**How it works:**
|
|
138
|
+
1. On push to `main` or release, the `sync-docs.yml` workflow runs
|
|
139
|
+
2. It generates API markdown from Python docstrings
|
|
140
|
+
3. Commits the generated docs to the `bayesian-docs` repository
|
|
141
|
+
|
|
142
|
+
**Setup for maintainers:**
|
|
143
|
+
- Add `DOCS_DEPLOY_TOKEN` secret to the repo (personal access token with `repo` scope for bayesian-docs)
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
148
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
pyconvexity/__init__.py,sha256=P67QJ8npf-QWmBX12im__eICLoRz8cByQ5OJXiyIBmA,5706
|
|
2
|
+
pyconvexity/_version.py,sha256=40-PUZPRIakJU2yYWQcwTYvSJA6iewqiG8XylhxuAQk,22
|
|
3
|
+
pyconvexity/dashboard.py,sha256=7x04Hr-EwzTAf-YJdHzfV83Gf2etltwtzwh_bCYJ5lk,8579
|
|
4
|
+
pyconvexity/timeseries.py,sha256=QdKbiqjAlxkJATyKm2Kelx1Ea2PsAnnCYfVLU5VER1Y,11085
|
|
5
|
+
pyconvexity/core/__init__.py,sha256=gdyyHNqOc4h9Nfe9u6NA936GNzH6coGNCMgBvvvOnGE,1196
|
|
6
|
+
pyconvexity/core/database.py,sha256=vwCmuN0B0xwImh6L0bFR4vNWHw_wVfYSG1KwsUjK4iY,14831
|
|
7
|
+
pyconvexity/core/errors.py,sha256=5ZUpqtQVROxizfZeLvOI-fDXYq6ZISqykJrD5oaLfTo,2808
|
|
8
|
+
pyconvexity/core/types.py,sha256=VOg_VMxK3OY_aa5ASzG2KIBEodZ48iepQgNlotQsesA,11171
|
|
9
|
+
pyconvexity/data/README.md,sha256=-tyDHVjqzfWbVvgM4yYYx8cysmgvFXI6plVQNxSHBmo,3156
|
|
10
|
+
pyconvexity/data/__init__.py,sha256=CFFwuIKS0qBk0HVLSByOK-oA5qm4krstJTUGFwUZyjo,509
|
|
11
|
+
pyconvexity/data/loaders/__init__.py,sha256=6xPtOmH2n1mNby7ZjA-2Mk9F48Q246RNsyMnCnJ6gwA,60
|
|
12
|
+
pyconvexity/data/loaders/cache.py,sha256=R-DUIiFpphjyi5EitcUZwzwUdZeqN6poYVyuNpKzB4g,7040
|
|
13
|
+
pyconvexity/data/schema/01_core_schema.sql,sha256=8uz5_adp5IdW9kqrpK9pAlaWpeyHQFIej5GhhElSYu4,16902
|
|
14
|
+
pyconvexity/data/schema/02_data_metadata.sql,sha256=BbpTkH1s7IbZQkDBRF2kL_UR9tzMEWDBYS3VBkwDRu0,4323
|
|
15
|
+
pyconvexity/data/schema/03_validation_data.sql,sha256=fepFx1n-Gvls-MbGmVOEhxp82xFZXfNitpNw5k6R_IM,89083
|
|
16
|
+
pyconvexity/data/sources/__init__.py,sha256=Dn6_oS7wB-vLjMj2YeXlmIl6hNjACbicimSabKxIWnc,108
|
|
17
|
+
pyconvexity/data/sources/gem.py,sha256=v8OYCMsb2t-8u-YmK8vzMsgI9ArUAOAXMZZQOFpJ-nI,14923
|
|
18
|
+
pyconvexity/io/__init__.py,sha256=FCyvRDfBUrrNei-y5JVod6MMN1bkPMSSfE0fpKi1aKQ,751
|
|
19
|
+
pyconvexity/io/excel_exporter.py,sha256=9MkZAVnHvsJSmfZ12w29GhDTsYI89fCGphjdo7s_ABs,50506
|
|
20
|
+
pyconvexity/io/excel_importer.py,sha256=Q5petB0WXjbw0TIR4ofG3EkjdT8lBh21yJMbEgdtXfU,59347
|
|
21
|
+
pyconvexity/io/netcdf_exporter.py,sha256=ndbYa_b34LZQ-70Y7KXh3oLpATnARLciQHXKNpcjNoY,6828
|
|
22
|
+
pyconvexity/io/netcdf_importer.py,sha256=JtdfIp48F_fQIlRgWJ3XaeeqtvQRa_FeE4hjVaA623I,67189
|
|
23
|
+
pyconvexity/models/__init__.py,sha256=WqDSq1Mst7iJsFytausruoM562FKlOKV0Egmnpm2900,4695
|
|
24
|
+
pyconvexity/models/attributes.py,sha256=RpH3rBoHD33xBSXUEfaD-CvRj3JruolCwexo6HPMGC8,23388
|
|
25
|
+
pyconvexity/models/carriers.py,sha256=L_WuDMW13k8aaA-obsDPxjmpZgZELiIAZuNtxq7YLpg,3447
|
|
26
|
+
pyconvexity/models/components.py,sha256=vxznTAvAzF99ILcc1DdLtj4K6k8aqclwlH1VhLcFAMM,17570
|
|
27
|
+
pyconvexity/models/network.py,sha256=P2Cuxv2lX9gWDwIBDDFqLs1sznhAXYquYNYstaMPjfU,14352
|
|
28
|
+
pyconvexity/models/results.py,sha256=6j1H4AwVmp94L97gl_sGnE8izMxkU5o89guKIU8JdtE,4169
|
|
29
|
+
pyconvexity/models/scenarios.py,sha256=-0UPUDXf6r9mFriA-z2fD5KKMARm2PUBjLba49S9mCI,5867
|
|
30
|
+
pyconvexity/solvers/__init__.py,sha256=t1gOUTqbYDCtIvKPqGVY1fjKwqJi2Od9bGeIO7bPvJE,667
|
|
31
|
+
pyconvexity/solvers/pypsa/__init__.py,sha256=W3kmb8a5M0t9ktyf-1NIBcCGLN723RnNk12N2uFAjBM,881
|
|
32
|
+
pyconvexity/solvers/pypsa/api.py,sha256=CWKslptTlZrSbuHy916_PHhCG8nO9SCfjTXkJZylLM8,17512
|
|
33
|
+
pyconvexity/solvers/pypsa/batch_loader.py,sha256=ZgOcZqMnMS3TOYTq2Ly2O4cuwhNNAicu3EDq1Fj38OI,11929
|
|
34
|
+
pyconvexity/solvers/pypsa/builder.py,sha256=1ZU68Wtl_jQSXHzspKQDkR6bxAVU1nKvPfnPUl0aO3k,23256
|
|
35
|
+
pyconvexity/solvers/pypsa/clearing_price.py,sha256=HdAk7GPfJFVI4t6mL0zQGEOMAvuyfpl0yNCnah1ZGH0,29164
|
|
36
|
+
pyconvexity/solvers/pypsa/constraints.py,sha256=20WliFDhPQGMAsS4VOTU8LZJpsFpLVRHpNsZW49GTcc,16397
|
|
37
|
+
pyconvexity/solvers/pypsa/solver.py,sha256=M-s-VUCnRD8Jdh22PCUA-gWgYp1eH6_sgpoSzcv6kNQ,59762
|
|
38
|
+
pyconvexity/solvers/pypsa/storage.py,sha256=-plXsEWDAxdDESryNTLxE7gmKqhH0lvoiQTFPVBlUY4,96046
|
|
39
|
+
pyconvexity/validation/__init__.py,sha256=VJNZlFoWABsWwUKktNk2jbtXIepH5omvC0WtsTS7o3o,583
|
|
40
|
+
pyconvexity/validation/rules.py,sha256=GiNadc8hvbWBr09vUkGiLLTmSdvtNSeGLFwvCjlikYY,9241
|
|
41
|
+
pyconvexity-0.4.8.dist-info/METADATA,sha256=1XoACQku7fC6MNJ0oeGm59kRAabONcs5oyrFE5WCOnU,4967
|
|
42
|
+
pyconvexity-0.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
43
|
+
pyconvexity-0.4.8.dist-info/top_level.txt,sha256=wFPEDXVaebR3JO5Tt3HNse-ws5aROCcxEco15d6j64s,12
|
|
44
|
+
pyconvexity-0.4.8.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pyconvexity
|