pyconvexity 0.3.8.post7__py3-none-any.whl → 0.4.1__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.
Files changed (48) hide show
  1. pyconvexity/__init__.py +87 -46
  2. pyconvexity/_version.py +1 -1
  3. pyconvexity/core/__init__.py +3 -5
  4. pyconvexity/core/database.py +111 -103
  5. pyconvexity/core/errors.py +16 -10
  6. pyconvexity/core/types.py +61 -54
  7. pyconvexity/data/__init__.py +0 -1
  8. pyconvexity/data/loaders/cache.py +65 -64
  9. pyconvexity/data/schema/01_core_schema.sql +134 -234
  10. pyconvexity/data/schema/02_data_metadata.sql +38 -168
  11. pyconvexity/data/schema/03_validation_data.sql +327 -264
  12. pyconvexity/data/sources/gem.py +169 -139
  13. pyconvexity/io/__init__.py +4 -10
  14. pyconvexity/io/excel_exporter.py +694 -480
  15. pyconvexity/io/excel_importer.py +817 -545
  16. pyconvexity/io/netcdf_exporter.py +66 -61
  17. pyconvexity/io/netcdf_importer.py +850 -619
  18. pyconvexity/models/__init__.py +109 -59
  19. pyconvexity/models/attributes.py +197 -178
  20. pyconvexity/models/carriers.py +70 -67
  21. pyconvexity/models/components.py +260 -236
  22. pyconvexity/models/network.py +202 -284
  23. pyconvexity/models/results.py +65 -55
  24. pyconvexity/models/scenarios.py +58 -88
  25. pyconvexity/solvers/__init__.py +5 -5
  26. pyconvexity/solvers/pypsa/__init__.py +3 -3
  27. pyconvexity/solvers/pypsa/api.py +150 -134
  28. pyconvexity/solvers/pypsa/batch_loader.py +165 -162
  29. pyconvexity/solvers/pypsa/builder.py +390 -291
  30. pyconvexity/solvers/pypsa/constraints.py +184 -162
  31. pyconvexity/solvers/pypsa/solver.py +968 -666
  32. pyconvexity/solvers/pypsa/storage.py +1377 -671
  33. pyconvexity/timeseries.py +63 -60
  34. pyconvexity/validation/__init__.py +14 -6
  35. pyconvexity/validation/rules.py +95 -84
  36. pyconvexity-0.4.1.dist-info/METADATA +46 -0
  37. pyconvexity-0.4.1.dist-info/RECORD +42 -0
  38. pyconvexity/data/__pycache__/__init__.cpython-313.pyc +0 -0
  39. pyconvexity/data/loaders/__pycache__/__init__.cpython-313.pyc +0 -0
  40. pyconvexity/data/loaders/__pycache__/cache.cpython-313.pyc +0 -0
  41. pyconvexity/data/schema/04_scenario_schema.sql +0 -122
  42. pyconvexity/data/schema/migrate_add_geometries.sql +0 -73
  43. pyconvexity/data/sources/__pycache__/__init__.cpython-313.pyc +0 -0
  44. pyconvexity/data/sources/__pycache__/gem.cpython-313.pyc +0 -0
  45. pyconvexity-0.3.8.post7.dist-info/METADATA +0 -138
  46. pyconvexity-0.3.8.post7.dist-info/RECORD +0 -49
  47. {pyconvexity-0.3.8.post7.dist-info → pyconvexity-0.4.1.dist-info}/WHEEL +0 -0
  48. {pyconvexity-0.3.8.post7.dist-info → pyconvexity-0.4.1.dist-info}/top_level.txt +0 -0
pyconvexity/__init__.py CHANGED
@@ -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
pyconvexity/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.3.8post7"
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
  ]