pyconvexity 0.3.8.post6__tar.gz → 0.3.8.post7__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.
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/PKG-INFO +1 -1
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/pyproject.toml +2 -2
- pyconvexity-0.3.8.post7/src/pyconvexity/_version.py +1 -0
- pyconvexity-0.3.8.post7/src/pyconvexity/models/__init__.py +124 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity.egg-info/PKG-INFO +1 -1
- pyconvexity-0.3.8.post6/src/pyconvexity/_version.py +0 -1
- pyconvexity-0.3.8.post6/src/pyconvexity/models/__init__.py +0 -87
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/README.md +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/setup.cfg +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/__init__.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/core/__init__.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/core/database.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/core/errors.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/core/types.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/README.md +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/__init__.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/__pycache__/__init__.cpython-313.pyc +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/loaders/__init__.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/loaders/__pycache__/__init__.cpython-313.pyc +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/loaders/__pycache__/cache.cpython-313.pyc +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/loaders/cache.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/schema/01_core_schema.sql +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/schema/02_data_metadata.sql +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/schema/03_validation_data.sql +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/schema/04_scenario_schema.sql +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/schema/migrate_add_geometries.sql +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/sources/__init__.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/sources/__pycache__/__init__.cpython-313.pyc +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/sources/__pycache__/gem.cpython-313.pyc +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/sources/gem.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/io/__init__.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/io/excel_exporter.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/io/excel_importer.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/io/netcdf_exporter.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/io/netcdf_importer.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/models/attributes.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/models/carriers.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/models/components.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/models/network.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/models/results.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/models/scenarios.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/__init__.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/__init__.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/api.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/batch_loader.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/builder.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/constraints.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/solver.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/storage.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/timeseries.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/validation/__init__.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/validation/rules.py +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity.egg-info/SOURCES.txt +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity.egg-info/dependency_links.txt +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity.egg-info/requires.txt +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity.egg-info/top_level.txt +0 -0
- {pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/tests/test_core_types.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pyconvexity"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.8post7"
|
|
8
8
|
description = "Python library for energy system modeling and optimization with PyPSA"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "MIT"}
|
|
@@ -81,7 +81,7 @@ profile = "black"
|
|
|
81
81
|
line_length = 100
|
|
82
82
|
|
|
83
83
|
[tool.mypy]
|
|
84
|
-
python_version = "0.3.
|
|
84
|
+
python_version = "0.3.8post7"
|
|
85
85
|
warn_return_any = true
|
|
86
86
|
warn_unused_configs = true
|
|
87
87
|
disallow_untyped_defs = true
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.8post7"
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Model management module for PyConvexity.
|
|
3
|
+
|
|
4
|
+
Contains high-level operations for networks, components, and attributes.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pyconvexity.models.components import (
|
|
8
|
+
get_component_type, get_component, list_components_by_type,
|
|
9
|
+
insert_component, create_component, update_component, delete_component,
|
|
10
|
+
list_component_attributes, get_default_carrier_id, get_bus_name_to_id_map,
|
|
11
|
+
get_component_by_name, get_component_id, component_exists, get_component_carrier_map
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from pyconvexity.models.attributes import (
|
|
15
|
+
set_static_attribute, set_timeseries_attribute, get_attribute, delete_attribute,
|
|
16
|
+
get_timeseries, get_timeseries_metadata
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
from pyconvexity.models.network import (
|
|
20
|
+
create_network, get_network_info, get_network_time_periods, list_networks,
|
|
21
|
+
create_carrier, get_network_config, set_network_config,
|
|
22
|
+
get_component_counts, get_master_scenario_id, resolve_scenario_id,
|
|
23
|
+
get_first_network, get_network_by_name
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Import from new modules
|
|
27
|
+
from pyconvexity.models.scenarios import (
|
|
28
|
+
list_scenarios,
|
|
29
|
+
get_scenario_by_name, get_scenario_by_id, get_master_scenario,
|
|
30
|
+
Scenario
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
from pyconvexity.models.results import (
|
|
34
|
+
get_solve_results, get_yearly_results,
|
|
35
|
+
SolveResults, YearlyResults
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
from pyconvexity.models.carriers import (
|
|
39
|
+
list_carriers,
|
|
40
|
+
get_carrier_by_name, get_carrier_by_id, get_carrier_colors,
|
|
41
|
+
Carrier
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
# Backward compatibility aliases
|
|
45
|
+
def get_scenario(conn, scenario_id):
|
|
46
|
+
"""Backward compatible alias for get_scenario_by_id."""
|
|
47
|
+
return get_scenario_by_id(conn, scenario_id)
|
|
48
|
+
|
|
49
|
+
def create_scenario(conn, network_id, name, description=None, is_master=False):
|
|
50
|
+
"""
|
|
51
|
+
Create a new scenario.
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
conn: Database connection
|
|
55
|
+
network_id: Network ID
|
|
56
|
+
name: Scenario name
|
|
57
|
+
description: Optional description
|
|
58
|
+
is_master: Whether this is the master scenario (will demote existing master)
|
|
59
|
+
|
|
60
|
+
Returns:
|
|
61
|
+
Scenario ID
|
|
62
|
+
"""
|
|
63
|
+
cursor = conn.execute("""
|
|
64
|
+
INSERT INTO scenarios (network_id, name, description, is_master)
|
|
65
|
+
VALUES (?, ?, ?, ?)
|
|
66
|
+
""", (network_id, name, description, is_master))
|
|
67
|
+
|
|
68
|
+
scenario_id = cursor.lastrowid
|
|
69
|
+
return scenario_id
|
|
70
|
+
|
|
71
|
+
def delete_scenario(conn, scenario_id):
|
|
72
|
+
"""
|
|
73
|
+
Delete a scenario (cannot delete master scenario).
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
conn: Database connection
|
|
77
|
+
scenario_id: Scenario ID to delete
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
ValidationError: If trying to delete master scenario or scenario doesn't exist
|
|
81
|
+
"""
|
|
82
|
+
from pyconvexity.core.errors import ValidationError
|
|
83
|
+
|
|
84
|
+
# Check if it's a master scenario
|
|
85
|
+
scenario = get_scenario_by_id(conn, scenario_id)
|
|
86
|
+
if scenario.is_master:
|
|
87
|
+
raise ValidationError("Cannot delete master scenario")
|
|
88
|
+
|
|
89
|
+
# Delete the scenario
|
|
90
|
+
cursor = conn.execute("DELETE FROM scenarios WHERE id = ?", (scenario_id,))
|
|
91
|
+
|
|
92
|
+
if cursor.rowcount == 0:
|
|
93
|
+
raise ValidationError(f"Scenario with ID {scenario_id} not found")
|
|
94
|
+
|
|
95
|
+
__all__ = [
|
|
96
|
+
# Component operations
|
|
97
|
+
"get_component_type", "get_component", "list_components_by_type",
|
|
98
|
+
"insert_component", "create_component", "update_component", "delete_component",
|
|
99
|
+
"list_component_attributes", "get_default_carrier_id", "get_bus_name_to_id_map",
|
|
100
|
+
"get_component_by_name", "get_component_id", "component_exists", "get_component_carrier_map",
|
|
101
|
+
|
|
102
|
+
# Attribute operations
|
|
103
|
+
"set_static_attribute", "set_timeseries_attribute", "get_attribute", "delete_attribute",
|
|
104
|
+
"get_timeseries", "get_timeseries_metadata",
|
|
105
|
+
|
|
106
|
+
# Network operations
|
|
107
|
+
"create_network", "get_network_info", "get_network_time_periods", "list_networks",
|
|
108
|
+
"create_carrier", "list_carriers", "get_network_config", "set_network_config",
|
|
109
|
+
"get_component_counts", "get_master_scenario_id", "resolve_scenario_id",
|
|
110
|
+
"get_first_network", "get_network_by_name",
|
|
111
|
+
|
|
112
|
+
# Scenario operations (backward compatible)
|
|
113
|
+
"create_scenario", "list_scenarios", "get_scenario", "delete_scenario",
|
|
114
|
+
"get_scenario_by_name", "get_scenario_by_id", "get_master_scenario",
|
|
115
|
+
"Scenario",
|
|
116
|
+
|
|
117
|
+
# Results operations
|
|
118
|
+
"get_solve_results", "get_yearly_results",
|
|
119
|
+
"SolveResults", "YearlyResults",
|
|
120
|
+
|
|
121
|
+
# Carrier operations
|
|
122
|
+
"get_carrier_by_name", "get_carrier_by_id", "get_carrier_colors",
|
|
123
|
+
"Carrier",
|
|
124
|
+
]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.8post6"
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Model management module for PyConvexity.
|
|
3
|
-
|
|
4
|
-
Contains high-level operations for networks, components, and attributes.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from pyconvexity.models.components import (
|
|
8
|
-
get_component_type, get_component, list_components_by_type,
|
|
9
|
-
insert_component, create_component, update_component, delete_component,
|
|
10
|
-
list_component_attributes, get_default_carrier_id, get_bus_name_to_id_map,
|
|
11
|
-
get_component_by_name, get_component_id, component_exists, get_component_carrier_map
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
from pyconvexity.models.attributes import (
|
|
15
|
-
set_static_attribute, set_timeseries_attribute, get_attribute, delete_attribute
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
from pyconvexity.models.network import (
|
|
19
|
-
create_network, get_network_info, get_network_time_periods, list_networks,
|
|
20
|
-
create_carrier, list_carriers, get_network_config, set_network_config,
|
|
21
|
-
get_component_counts, get_master_scenario_id, resolve_scenario_id,
|
|
22
|
-
get_first_network, get_network_by_name
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
# Import from new modules
|
|
26
|
-
from pyconvexity.models.scenarios import (
|
|
27
|
-
list_scenarios as list_scenarios_new,
|
|
28
|
-
get_scenario_by_name, get_scenario_by_id, get_master_scenario
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
from pyconvexity.models.results import (
|
|
32
|
-
get_solve_results, get_yearly_results
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
from pyconvexity.models.carriers import (
|
|
36
|
-
list_carriers as list_carriers_new,
|
|
37
|
-
get_carrier_by_name, get_carrier_by_id, get_carrier_colors
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
# Try to import old scenarios functions if they exist
|
|
41
|
-
try:
|
|
42
|
-
from pyconvexity.models.scenarios_old import (
|
|
43
|
-
create_scenario, list_scenarios as list_scenarios_old,
|
|
44
|
-
get_scenario, delete_scenario
|
|
45
|
-
)
|
|
46
|
-
# Use old functions as primary for backward compatibility
|
|
47
|
-
list_scenarios_primary = list_scenarios_old
|
|
48
|
-
except ImportError:
|
|
49
|
-
# Old module doesn't exist, use new functions
|
|
50
|
-
list_scenarios_primary = list_scenarios_new
|
|
51
|
-
# Create dummy functions for backward compatibility
|
|
52
|
-
def create_scenario(*args, **kwargs):
|
|
53
|
-
raise NotImplementedError("create_scenario not yet implemented in new API")
|
|
54
|
-
def get_scenario(*args, **kwargs):
|
|
55
|
-
return get_scenario_by_id(*args, **kwargs)
|
|
56
|
-
def delete_scenario(*args, **kwargs):
|
|
57
|
-
raise NotImplementedError("delete_scenario not yet implemented in new API")
|
|
58
|
-
|
|
59
|
-
__all__ = [
|
|
60
|
-
# Component operations
|
|
61
|
-
"get_component_type", "get_component", "list_components_by_type",
|
|
62
|
-
"insert_component", "create_component", "update_component", "delete_component",
|
|
63
|
-
"list_component_attributes", "get_default_carrier_id", "get_bus_name_to_id_map",
|
|
64
|
-
"get_component_by_name", "get_component_id", "component_exists", "get_component_carrier_map",
|
|
65
|
-
|
|
66
|
-
# Attribute operations
|
|
67
|
-
"set_static_attribute", "set_timeseries_attribute", "get_attribute", "delete_attribute",
|
|
68
|
-
|
|
69
|
-
# Network operations
|
|
70
|
-
"create_network", "get_network_info", "get_network_time_periods", "list_networks",
|
|
71
|
-
"create_carrier", "list_carriers", "get_network_config", "set_network_config",
|
|
72
|
-
"get_component_counts", "get_master_scenario_id", "resolve_scenario_id",
|
|
73
|
-
"get_first_network", "get_network_by_name",
|
|
74
|
-
|
|
75
|
-
# Scenario operations (backward compatible)
|
|
76
|
-
"create_scenario", "list_scenarios_primary", "get_scenario", "delete_scenario",
|
|
77
|
-
"list_scenarios_new", "get_scenario_by_name", "get_scenario_by_id", "get_master_scenario",
|
|
78
|
-
|
|
79
|
-
# Results operations
|
|
80
|
-
"get_solve_results", "get_yearly_results",
|
|
81
|
-
|
|
82
|
-
# Carrier operations
|
|
83
|
-
"list_carriers_new", "get_carrier_by_name", "get_carrier_by_id", "get_carrier_colors",
|
|
84
|
-
]
|
|
85
|
-
|
|
86
|
-
# Expose primary list_scenarios for convenience
|
|
87
|
-
list_scenarios = list_scenarios_primary
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/loaders/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/schema/01_core_schema.sql
RENAMED
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/schema/02_data_metadata.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/data/sources/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/batch_loader.py
RENAMED
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/builder.py
RENAMED
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/constraints.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity/solvers/pypsa/storage.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyconvexity-0.3.8.post6 → pyconvexity-0.3.8.post7}/src/pyconvexity.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|