pyconvexity 0.3.8.post7__tar.gz → 0.4.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.

Potentially problematic release.


This version of pyconvexity might be problematic. Click here for more details.

Files changed (68) hide show
  1. pyconvexity-0.4.1/PKG-INFO +46 -0
  2. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/pyproject.toml +3 -4
  3. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/__init__.py +87 -46
  4. pyconvexity-0.4.1/src/pyconvexity/_version.py +1 -0
  5. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/core/__init__.py +3 -5
  6. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/core/database.py +111 -103
  7. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/core/errors.py +16 -10
  8. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/core/types.py +61 -54
  9. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/data/__init__.py +0 -1
  10. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/data/loaders/cache.py +65 -64
  11. pyconvexity-0.4.1/src/pyconvexity/data/schema/01_core_schema.sql +377 -0
  12. pyconvexity-0.4.1/src/pyconvexity/data/schema/02_data_metadata.sql +120 -0
  13. pyconvexity-0.4.1/src/pyconvexity/data/schema/03_validation_data.sql +506 -0
  14. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/data/sources/gem.py +169 -139
  15. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/io/__init__.py +4 -10
  16. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/io/excel_exporter.py +694 -480
  17. pyconvexity-0.4.1/src/pyconvexity/io/excel_importer.py +1381 -0
  18. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/io/netcdf_exporter.py +66 -61
  19. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/io/netcdf_importer.py +850 -619
  20. pyconvexity-0.4.1/src/pyconvexity/models/__init__.py +174 -0
  21. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/models/attributes.py +197 -178
  22. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/models/carriers.py +70 -67
  23. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/models/components.py +260 -236
  24. pyconvexity-0.4.1/src/pyconvexity/models/network.py +412 -0
  25. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/models/results.py +65 -55
  26. pyconvexity-0.4.1/src/pyconvexity/models/scenarios.py +130 -0
  27. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/solvers/__init__.py +5 -5
  28. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/solvers/pypsa/__init__.py +3 -3
  29. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/solvers/pypsa/api.py +150 -134
  30. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/solvers/pypsa/batch_loader.py +165 -162
  31. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/solvers/pypsa/builder.py +390 -291
  32. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/solvers/pypsa/constraints.py +184 -162
  33. pyconvexity-0.4.1/src/pyconvexity/solvers/pypsa/solver.py +1721 -0
  34. pyconvexity-0.4.1/src/pyconvexity/solvers/pypsa/storage.py +2280 -0
  35. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/timeseries.py +63 -60
  36. pyconvexity-0.4.1/src/pyconvexity/validation/__init__.py +25 -0
  37. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/validation/rules.py +95 -84
  38. pyconvexity-0.4.1/src/pyconvexity.egg-info/PKG-INFO +46 -0
  39. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity.egg-info/SOURCES.txt +0 -8
  40. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/tests/test_core_types.py +23 -21
  41. pyconvexity-0.3.8.post7/PKG-INFO +0 -138
  42. pyconvexity-0.3.8.post7/README.md +0 -91
  43. pyconvexity-0.3.8.post7/src/pyconvexity/_version.py +0 -1
  44. pyconvexity-0.3.8.post7/src/pyconvexity/data/__pycache__/__init__.cpython-313.pyc +0 -0
  45. pyconvexity-0.3.8.post7/src/pyconvexity/data/loaders/__pycache__/__init__.cpython-313.pyc +0 -0
  46. pyconvexity-0.3.8.post7/src/pyconvexity/data/loaders/__pycache__/cache.cpython-313.pyc +0 -0
  47. pyconvexity-0.3.8.post7/src/pyconvexity/data/schema/01_core_schema.sql +0 -477
  48. pyconvexity-0.3.8.post7/src/pyconvexity/data/schema/02_data_metadata.sql +0 -250
  49. pyconvexity-0.3.8.post7/src/pyconvexity/data/schema/03_validation_data.sql +0 -443
  50. pyconvexity-0.3.8.post7/src/pyconvexity/data/schema/04_scenario_schema.sql +0 -122
  51. pyconvexity-0.3.8.post7/src/pyconvexity/data/schema/migrate_add_geometries.sql +0 -73
  52. pyconvexity-0.3.8.post7/src/pyconvexity/data/sources/__pycache__/__init__.cpython-313.pyc +0 -0
  53. pyconvexity-0.3.8.post7/src/pyconvexity/data/sources/__pycache__/gem.cpython-313.pyc +0 -0
  54. pyconvexity-0.3.8.post7/src/pyconvexity/io/excel_importer.py +0 -1109
  55. pyconvexity-0.3.8.post7/src/pyconvexity/models/__init__.py +0 -124
  56. pyconvexity-0.3.8.post7/src/pyconvexity/models/network.py +0 -494
  57. pyconvexity-0.3.8.post7/src/pyconvexity/models/scenarios.py +0 -160
  58. pyconvexity-0.3.8.post7/src/pyconvexity/solvers/pypsa/solver.py +0 -1419
  59. pyconvexity-0.3.8.post7/src/pyconvexity/solvers/pypsa/storage.py +0 -1574
  60. pyconvexity-0.3.8.post7/src/pyconvexity/validation/__init__.py +0 -17
  61. pyconvexity-0.3.8.post7/src/pyconvexity.egg-info/PKG-INFO +0 -138
  62. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/setup.cfg +0 -0
  63. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/data/README.md +0 -0
  64. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/data/loaders/__init__.py +0 -0
  65. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity/data/sources/__init__.py +0 -0
  66. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity.egg-info/dependency_links.txt +0 -0
  67. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity.egg-info/requires.txt +0 -0
  68. {pyconvexity-0.3.8.post7 → pyconvexity-0.4.1}/src/pyconvexity.egg-info/top_level.txt +0 -0
@@ -0,0 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyconvexity
3
+ Version: 0.4.1
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/convexity-js
8
+ Project-URL: Repository, https://github.com/bayesian-energy/convexity-js
9
+ Project-URL: Issues, https://github.com/bayesian-energy/convexity-js/issues
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Requires-Python: >=3.9
20
+ Description-Content-Type: text/markdown
21
+ Requires-Dist: pandas>=1.5.0
22
+ Requires-Dist: numpy>=1.21.0
23
+ Requires-Dist: pyarrow>=10.0.0
24
+ Provides-Extra: pypsa
25
+ Requires-Dist: pypsa>=0.25.0; extra == "pypsa"
26
+ Requires-Dist: networkx; extra == "pypsa"
27
+ Requires-Dist: scipy; extra == "pypsa"
28
+ Requires-Dist: xarray; extra == "pypsa"
29
+ Provides-Extra: excel
30
+ Requires-Dist: openpyxl>=3.0.0; extra == "excel"
31
+ Requires-Dist: xlsxwriter>=3.0.0; extra == "excel"
32
+ Provides-Extra: netcdf
33
+ Requires-Dist: netcdf4>=1.6.0; extra == "netcdf"
34
+ Requires-Dist: xarray>=2022.3.0; extra == "netcdf"
35
+ Provides-Extra: data
36
+ Requires-Dist: country-converter>=1.0.0; extra == "data"
37
+ Requires-Dist: pyyaml>=6.0.0; extra == "data"
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
40
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
41
+ Requires-Dist: black>=22.0.0; extra == "dev"
42
+ Requires-Dist: isort>=5.10.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
44
+ Requires-Dist: pre-commit>=2.20.0; extra == "dev"
45
+ Provides-Extra: all
46
+ Requires-Dist: pyconvexity[data,excel,netcdf,pypsa]; extra == "all"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyconvexity"
7
- version = "0.3.8post7"
7
+ version = "0.4.1"
8
8
  description = "Python library for energy system modeling and optimization with PyPSA"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -73,15 +73,14 @@ where = ["src"]
73
73
  pyconvexity = ["data/**/*"]
74
74
 
75
75
  [tool.black]
76
- line-length = 100
77
76
  target-version = ['py39']
78
77
 
79
78
  [tool.isort]
80
79
  profile = "black"
81
- line_length = 100
80
+ line_length = 88
82
81
 
83
82
  [tool.mypy]
84
- python_version = "0.3.8post7"
83
+ python_version = "0.4.1"
85
84
  warn_return_any = true
86
85
  warn_unused_configs = true
87
86
  disallow_untyped_defs = true
@@ -45,29 +45,47 @@ from pyconvexity.core.database import (
45
45
  # Import main API functions
46
46
  from pyconvexity.models import (
47
47
  # Component operations
48
- get_component, create_component, update_component, delete_component,
49
- list_components_by_type, list_component_attributes,
50
-
51
- # Attribute operations
52
- set_static_attribute, set_timeseries_attribute, get_attribute, delete_attribute,
53
-
48
+ get_component,
49
+ create_component,
50
+ update_component,
51
+ delete_component,
52
+ list_components_by_type,
53
+ list_component_attributes,
54
+ # Attribute operations
55
+ set_static_attribute,
56
+ set_timeseries_attribute,
57
+ get_attribute,
58
+ delete_attribute,
54
59
  # Network operations
55
- create_network, get_network_info, get_network_time_periods, list_networks,
56
- create_carrier, list_carriers, get_network_config, set_network_config,
57
- get_master_scenario_id, resolve_scenario_id,
58
-
60
+ create_network,
61
+ get_network_info,
62
+ get_network_time_periods,
63
+ list_networks,
64
+ create_carrier,
65
+ list_carriers,
66
+ get_network_config,
67
+ set_network_config,
59
68
  # Scenario operations
60
- create_scenario, list_scenarios, get_scenario, delete_scenario,
69
+ create_scenario,
70
+ list_scenarios,
71
+ get_scenario,
72
+ delete_scenario,
61
73
  )
62
74
 
63
75
  from pyconvexity.validation import (
64
- get_validation_rule, list_validation_rules, validate_timeseries_alignment
76
+ get_validation_rule,
77
+ list_validation_rules,
78
+ validate_timeseries_alignment,
65
79
  )
66
80
 
67
81
  # High-level timeseries API - recommended for new code
68
82
  from pyconvexity.timeseries import (
69
- get_timeseries, set_timeseries, get_timeseries_metadata,
70
- get_multiple_timeseries, timeseries_to_numpy, numpy_to_timeseries
83
+ get_timeseries,
84
+ set_timeseries,
85
+ get_timeseries_metadata,
86
+ get_multiple_timeseries,
87
+ timeseries_to_numpy,
88
+ numpy_to_timeseries,
71
89
  )
72
90
 
73
91
  # High-level API functions
@@ -75,62 +93,74 @@ __all__ = [
75
93
  # Version info
76
94
  "__version__",
77
95
  "__author__",
78
-
79
96
  # Core types
80
97
  "StaticValue",
81
98
  "Timeseries",
82
- "TimeseriesMetadata",
99
+ "TimeseriesMetadata",
83
100
  "Component",
84
101
  "Network",
85
102
  "CreateNetworkRequest",
86
103
  "CreateComponentRequest",
87
-
88
104
  # Database operations
89
105
  "create_database_with_schema",
90
- "database_context",
106
+ "database_context",
91
107
  "open_connection",
92
108
  "validate_database",
93
-
94
109
  # Database maintenance
95
110
  "vacuum_database",
96
- "analyze_database",
111
+ "analyze_database",
97
112
  "optimize_database",
98
113
  "get_database_size_info",
99
114
  "should_optimize_database",
100
-
101
115
  # Exceptions
102
116
  "PyConvexityError",
103
117
  "DatabaseError",
104
118
  "ValidationError",
105
119
  "ComponentNotFound",
106
120
  "AttributeNotFound",
107
-
108
121
  # Component operations
109
- "get_component", "create_component", "update_component", "delete_component",
110
- "list_components_by_type", "list_component_attributes",
111
-
122
+ "get_component",
123
+ "create_component",
124
+ "update_component",
125
+ "delete_component",
126
+ "list_components_by_type",
127
+ "list_component_attributes",
112
128
  # Attribute operations
113
- "set_static_attribute", "set_timeseries_attribute", "get_attribute", "delete_attribute",
114
-
129
+ "set_static_attribute",
130
+ "set_timeseries_attribute",
131
+ "get_attribute",
132
+ "delete_attribute",
115
133
  # Network operations
116
- "create_network", "get_network_info", "get_network_time_periods", "list_networks",
117
- "create_carrier", "list_carriers", "get_network_config", "set_network_config",
118
- "get_master_scenario_id", "resolve_scenario_id",
119
-
134
+ "create_network",
135
+ "get_network_info",
136
+ "get_network_time_periods",
137
+ "list_networks",
138
+ "create_carrier",
139
+ "list_carriers",
140
+ "get_network_config",
141
+ "set_network_config",
120
142
  # Scenario operations
121
- "create_scenario", "list_scenarios", "get_scenario", "delete_scenario",
122
-
143
+ "create_scenario",
144
+ "list_scenarios",
145
+ "get_scenario",
146
+ "delete_scenario",
123
147
  # Validation
124
- "get_validation_rule", "list_validation_rules", "validate_timeseries_alignment",
125
-
148
+ "get_validation_rule",
149
+ "list_validation_rules",
150
+ "validate_timeseries_alignment",
126
151
  # High-level timeseries API
127
- "get_timeseries", "set_timeseries", "get_timeseries_metadata",
128
- "get_multiple_timeseries", "timeseries_to_numpy", "numpy_to_timeseries",
152
+ "get_timeseries",
153
+ "set_timeseries",
154
+ "get_timeseries_metadata",
155
+ "get_multiple_timeseries",
156
+ "timeseries_to_numpy",
157
+ "numpy_to_timeseries",
129
158
  ]
130
159
 
131
160
  # Data module imports
132
161
  try:
133
162
  from pyconvexity import data
163
+
134
164
  __all__.append("data")
135
165
  except ImportError:
136
166
  # Data dependencies not available
@@ -139,13 +169,24 @@ except ImportError:
139
169
  # Optional imports with graceful fallbacks
140
170
  try:
141
171
  from pyconvexity.solvers.pypsa import (
142
- solve_network, build_pypsa_network, solve_pypsa_network,
143
- load_network_components, apply_constraints, store_solve_results
172
+ solve_network,
173
+ build_pypsa_network,
174
+ solve_pypsa_network,
175
+ load_network_components,
176
+ apply_constraints,
177
+ store_solve_results,
178
+ )
179
+
180
+ __all__.extend(
181
+ [
182
+ "solve_network",
183
+ "build_pypsa_network",
184
+ "solve_pypsa_network",
185
+ "load_network_components",
186
+ "apply_constraints",
187
+ "store_solve_results",
188
+ ]
144
189
  )
145
- __all__.extend([
146
- "solve_network", "build_pypsa_network", "solve_pypsa_network",
147
- "load_network_components", "apply_constraints", "store_solve_results"
148
- ])
149
190
  except ImportError:
150
191
  # PyPSA not available
151
192
  pass
@@ -153,9 +194,8 @@ except ImportError:
153
194
  # Excel I/O functionality
154
195
  try:
155
196
  from pyconvexity.io import ExcelModelExporter, ExcelModelImporter
156
- __all__.extend([
157
- "ExcelModelExporter", "ExcelModelImporter"
158
- ])
197
+
198
+ __all__.extend(["ExcelModelExporter", "ExcelModelImporter"])
159
199
  except ImportError:
160
200
  # Excel dependencies not available
161
201
  pass
@@ -163,6 +203,7 @@ except ImportError:
163
203
 
164
204
  try:
165
205
  from pyconvexity.io import NetCDFModelExporter, NetCDFModelImporter
206
+
166
207
  __all__.extend(["NetCDFModelExporter", "NetCDFModelImporter"])
167
208
  except ImportError:
168
209
  # NetCDF dependencies not available
@@ -0,0 +1 @@
1
+ __version__ = "0.4.1"
@@ -36,16 +36,15 @@ from pyconvexity.core.database import (
36
36
  __all__ = [
37
37
  # Errors
38
38
  "PyConvexityError",
39
- "DatabaseError",
39
+ "DatabaseError",
40
40
  "ValidationError",
41
41
  "ComponentNotFound",
42
42
  "AttributeNotFound",
43
43
  "InvalidDataType",
44
44
  "TimeseriesError",
45
-
46
45
  # Types
47
46
  "StaticValue",
48
- "AttributeValue",
47
+ "AttributeValue",
49
48
  "ValidationRule",
50
49
  "Component",
51
50
  "Network",
@@ -53,10 +52,9 @@ __all__ = [
53
52
  "TimeseriesValidationResult",
54
53
  "CreateComponentRequest",
55
54
  "CreateNetworkRequest",
56
-
57
55
  # Database
58
56
  "DatabaseContext",
59
57
  "open_connection",
60
- "validate_database",
58
+ "validate_database",
61
59
  "create_database_with_schema",
62
60
  ]