pyconvexity 0.5.1.post1__py3-none-any.whl → 0.5.1.post2__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/_version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.5.1.post1"
1
+ __version__ = "0.5.1.post2"
@@ -502,7 +502,11 @@ class NetworkSolver:
502
502
  """
503
503
  try:
504
504
  # Extract basic solve information
505
- status = getattr(result, "status", "unknown")
505
+ # PyPSA's result may be a tuple or object, and may not have a status attribute
506
+ raw_status = getattr(result, "status", None)
507
+ if raw_status is None:
508
+ raw_status = "unknown"
509
+
506
510
  objective_value = getattr(network, "objective", None)
507
511
 
508
512
  # Convert PyPSA result to dictionary format
@@ -510,12 +514,34 @@ class NetworkSolver:
510
514
 
511
515
  # Determine success based on multiple criteria
512
516
  success = self._determine_solve_success(
513
- result, network, status, objective_value
517
+ result, network, raw_status, objective_value
514
518
  )
519
+
520
+ # Update status to reflect the determined success
521
+ # This ensures database and API consumers get meaningful status values
522
+ if success:
523
+ # If we determined success, set status to "optimal" unless we have better info
524
+ if raw_status in ["optimal", "feasible"]:
525
+ status = raw_status
526
+ elif hasattr(result, "termination_condition"):
527
+ term_condition = str(result.termination_condition).lower()
528
+ if "optimal" in term_condition:
529
+ status = "optimal"
530
+ else:
531
+ status = "feasible" # Solved successfully but not necessarily optimal
532
+ else:
533
+ status = "optimal" # Default for successful solves
534
+ else:
535
+ # If solve failed, use raw status or "failed"
536
+ if raw_status not in ["unknown", "", None]:
537
+ status = raw_status
538
+ else:
539
+ status = "failed"
515
540
 
516
541
  solve_result = {
517
542
  "success": success,
518
- "status": status,
543
+ "status": status, # Now contains meaningful status instead of "unknown"
544
+ "raw_status": raw_status, # Keep original PyPSA status for debugging
519
545
  "solve_time": solve_time,
520
546
  "solver_name": solver_name,
521
547
  "run_id": run_id,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyconvexity
3
- Version: 0.5.1.post1
3
+ Version: 0.5.1.post2
4
4
  Summary: Python library for energy system modeling and optimization with PyPSA
5
5
  Author-email: Convexity Team <info@convexity.com>
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
1
  pyconvexity/__init__.py,sha256=Prol-EntlU_jWLR3D55ZRYqkLnenLnt5cXVc_NT1cI4,5934
2
- pyconvexity/_version.py,sha256=cOaLNeTwkPXJFU_tSZi-530rXF3qjxypENpk5W_HqGE,28
2
+ pyconvexity/_version.py,sha256=NzwicjWvX-oujWpkElhba_Uhu9tnA3prazJglxgYyRM,28
3
3
  pyconvexity/dashboard.py,sha256=7x04Hr-EwzTAf-YJdHzfV83Gf2etltwtzwh_bCYJ5lk,8579
4
4
  pyconvexity/timeseries.py,sha256=QdKbiqjAlxkJATyKm2Kelx1Ea2PsAnnCYfVLU5VER1Y,11085
5
5
  pyconvexity/core/__init__.py,sha256=gdyyHNqOc4h9Nfe9u6NA936GNzH6coGNCMgBvvvOnGE,1196
@@ -34,14 +34,14 @@ pyconvexity/solvers/pypsa/batch_loader.py,sha256=ZgOcZqMnMS3TOYTq2Ly2O4cuwhNNAic
34
34
  pyconvexity/solvers/pypsa/builder.py,sha256=1ZU68Wtl_jQSXHzspKQDkR6bxAVU1nKvPfnPUl0aO3k,23256
35
35
  pyconvexity/solvers/pypsa/clearing_price.py,sha256=HdAk7GPfJFVI4t6mL0zQGEOMAvuyfpl0yNCnah1ZGH0,29164
36
36
  pyconvexity/solvers/pypsa/constraints.py,sha256=20WliFDhPQGMAsS4VOTU8LZJpsFpLVRHpNsZW49GTcc,16397
37
- pyconvexity/solvers/pypsa/solver.py,sha256=pNI9ch0vO5q-8mWc3RHTscWB_ymj4s2lVJQ_e2nbzHY,44417
37
+ pyconvexity/solvers/pypsa/solver.py,sha256=JcjIv9yU3YhEDUN4kllRe2NP6y56LD_LBlymHGWDflc,45806
38
38
  pyconvexity/solvers/pypsa/storage.py,sha256=nbONOBnunq3tyexa5yDUsT9xdxieUfrqhoM76_2HIGg,94956
39
39
  pyconvexity/transformations/__init__.py,sha256=JfTk0b2O3KM22Dcem2ZnNvDDBmlmqS2X3Q_cO0H3r44,406
40
40
  pyconvexity/transformations/api.py,sha256=t_kAAk9QSF1YTlrTM7BECd_v08jUgXVV6e9iX2M0aAg,3694
41
41
  pyconvexity/transformations/time_axis.py,sha256=Cr_H-FozXLQno4n6jMSZCTj3M4h7tGpsuqGcMW2qghY,29322
42
42
  pyconvexity/validation/__init__.py,sha256=VJNZlFoWABsWwUKktNk2jbtXIepH5omvC0WtsTS7o3o,583
43
43
  pyconvexity/validation/rules.py,sha256=GiNadc8hvbWBr09vUkGiLLTmSdvtNSeGLFwvCjlikYY,9241
44
- pyconvexity-0.5.1.post1.dist-info/METADATA,sha256=uSFWS8R_sFfT9O4BbiRYo3ZcdodG2dIP5natNEIkJGs,4973
45
- pyconvexity-0.5.1.post1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
46
- pyconvexity-0.5.1.post1.dist-info/top_level.txt,sha256=wFPEDXVaebR3JO5Tt3HNse-ws5aROCcxEco15d6j64s,12
47
- pyconvexity-0.5.1.post1.dist-info/RECORD,,
44
+ pyconvexity-0.5.1.post2.dist-info/METADATA,sha256=QhPbcPges-IW8J6QabgcVwvouxNrPwrkDe21sDT3yls,4973
45
+ pyconvexity-0.5.1.post2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
46
+ pyconvexity-0.5.1.post2.dist-info/top_level.txt,sha256=wFPEDXVaebR3JO5Tt3HNse-ws5aROCcxEco15d6j64s,12
47
+ pyconvexity-0.5.1.post2.dist-info/RECORD,,