pandahub 0.3.7__zip → 0.3.9__zip

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 (49) hide show
  1. {pandahub-0.3.7 → pandahub-0.3.9}/CHANGELOG.md +10 -0
  2. {pandahub-0.3.7 → pandahub-0.3.9}/PKG-INFO +1 -1
  3. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/routers/net.py +3 -2
  4. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/routers/variants.py +4 -7
  5. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/lib/PandaHub.py +248 -185
  6. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub.egg-info/PKG-INFO +1 -1
  7. {pandahub-0.3.7 → pandahub-0.3.9}/pyproject.toml +1 -1
  8. {pandahub-0.3.7 → pandahub-0.3.9}/test/performance_test.py +8 -8
  9. {pandahub-0.3.7 → pandahub-0.3.9}/test/test_networks.py +12 -12
  10. {pandahub-0.3.7 → pandahub-0.3.9}/test/test_projects.py +2 -2
  11. {pandahub-0.3.7 → pandahub-0.3.9}/CONTRIBUTING.rst +0 -0
  12. {pandahub-0.3.7 → pandahub-0.3.9}/LICENSE +0 -0
  13. {pandahub-0.3.7 → pandahub-0.3.9}/MANIFEST.in +0 -0
  14. {pandahub-0.3.7 → pandahub-0.3.9}/README.md +0 -0
  15. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/__init__.py +0 -0
  16. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/__init__.py +0 -0
  17. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/dependencies.py +0 -0
  18. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/internal/__init__.py +0 -0
  19. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/internal/db.py +0 -0
  20. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/internal/schemas.py +0 -0
  21. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/internal/settings.py +0 -0
  22. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/internal/toolbox.py +0 -0
  23. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/internal/users.py +0 -0
  24. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/main.py +0 -0
  25. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/routers/__init__.py +0 -0
  26. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/routers/auth.py +0 -0
  27. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/routers/projects.py +0 -0
  28. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/routers/timeseries.py +0 -0
  29. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/api/routers/users.py +0 -0
  30. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/lib/__init__.py +0 -0
  31. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/lib/database_toolbox.py +0 -0
  32. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/lib/datatypes.py +0 -0
  33. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/lib/mongodb_indexes.py +0 -0
  34. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/lib/timeseries/__init__.py +0 -0
  35. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/lib/timeseries/data_sources/__init__.py +0 -0
  36. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/lib/timeseries/data_sources/mongo_data.py +0 -0
  37. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub/lib/timeseries/output_writer_mongodb.py +0 -0
  38. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub.egg-info/SOURCES.txt +0 -0
  39. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub.egg-info/dependency_links.txt +0 -0
  40. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub.egg-info/requires.txt +0 -0
  41. {pandahub-0.3.7 → pandahub-0.3.9}/pandahub.egg-info/top_level.txt +0 -0
  42. {pandahub-0.3.7 → pandahub-0.3.9}/requirements.txt +0 -0
  43. {pandahub-0.3.7 → pandahub-0.3.9}/setup.cfg +0 -0
  44. {pandahub-0.3.7 → pandahub-0.3.9}/setup.py +0 -0
  45. {pandahub-0.3.7 → pandahub-0.3.9}/test/__init__.py +0 -0
  46. {pandahub-0.3.7 → pandahub-0.3.9}/test/conftest.py +0 -0
  47. {pandahub-0.3.7 → pandahub-0.3.9}/test/test_client.py +0 -0
  48. {pandahub-0.3.7 → pandahub-0.3.9}/test/test_timeseries.py +0 -0
  49. {pandahub-0.3.7 → pandahub-0.3.9}/tutorials/config.py +0 -0
@@ -1,5 +1,15 @@
1
1
  # Change Log
2
2
 
3
+ ## [0.3.9]
4
+
5
+ - BREAKING: inserting multiple networks with the same name does not represent an error anymore, networks are only unique by their net_id (_id field of the collection)
6
+ - BREAKING: passing net_id as str will not remap to the project name internally but look up on the _id field
7
+ - IMPROVED: fix race condition when calling write_network_to_db without net_id
8
+
9
+ ## [0.3.8]
10
+
11
+ - BREAKING: specifying variant as list will raise an error instead of a deprecation warning
12
+
3
13
  ## [0.3.7]
4
14
 
5
15
  - FIXED: changes introduced in 0.3.6 removed all dependencies from the project
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pandahub
3
- Version: 0.3.7
3
+ Version: 0.3.9
4
4
  Summary: Data hub for pandapower and pandapipes networks based on MongoDB
5
5
  Author-email: Jan Ulffers <jan.ulffers@iee.fraunhofer.de>, Leon Thurner <leon.thurner@retoflow.de>, Jannis Kupka <jannis.kupka@retoflow.de>, Mike Vogt <mike.vogt@iee.fraunhofer.de>, Joschka Thurner <joschka.thurner@retoflow.de>, Alexander Scheidler <alexander.scheidler@iee.fraunhofer.de>
6
6
  License: Copyright (c) 2022 by University of Kassel, Fraunhofer Institute for Energy Economics
@@ -1,6 +1,7 @@
1
1
  from typing import Optional, Any
2
2
 
3
3
  import pandapower as pp
4
+ import pandapipes as pps
4
5
  from fastapi import APIRouter, Depends
5
6
  from pydantic import BaseModel
6
7
 
@@ -25,7 +26,7 @@ class GetNetFromDB(BaseModel):
25
26
 
26
27
  @router.post("/get_net_from_db")
27
28
  def get_net_from_db(data: GetNetFromDB, ph=Depends(pandahub)):
28
- net = ph.get_net_from_db(**data.model_dump())
29
+ net = ph.get_network_by_name(**data.model_dump())
29
30
  return pp.to_json(net)
30
31
 
31
32
 
@@ -49,7 +50,7 @@ def write_network_to_db(data: WriteNetwork, ph=Depends(pandahub)):
49
50
 
50
51
  class BaseCRUDModel(BaseModel):
51
52
  project_id: str
52
- net: str
53
+ net_id: int | str
53
54
  element_type: str
54
55
 
55
56
  class GetNetValueModel(BaseCRUDModel):
@@ -17,7 +17,7 @@ router = APIRouter(
17
17
 
18
18
  class GetVariantsModel(BaseModel):
19
19
  project_id: str
20
- net_id: int
20
+ net_id: int | str
21
21
 
22
22
  @router.post("/get_variants")
23
23
  def get_variants(data: GetVariantsModel, ph=Depends(pandahub)):
@@ -25,10 +25,7 @@ def get_variants(data: GetVariantsModel, ph=Depends(pandahub)):
25
25
  variants_collection = ph.get_project_database("variant")
26
26
 
27
27
  variants = variants_collection.find({"net_id": data.net_id}, projection={"_id": 0})
28
- response = {}
29
- for var in variants:
30
- response[var.pop("index")] = var
31
- return response
28
+ return {variant.pop("index"): variant for variant in variants}
32
29
 
33
30
 
34
31
  class CreateVariantModel(BaseModel):
@@ -43,7 +40,7 @@ def create_variant(data: CreateVariantModel, ph=Depends(pandahub)):
43
40
 
44
41
  class DeleteVariantModel(BaseModel):
45
42
  project_id: str
46
- net_id: int
43
+ net_id: int | str
47
44
  index: int
48
45
 
49
46
  @router.post("/delete_variant")
@@ -54,7 +51,7 @@ def delete_variant(data: DeleteVariantModel, ph=Depends(pandahub)):
54
51
 
55
52
  class UpdateVariantModel(BaseModel):
56
53
  project_id: str
57
- net_id: int
54
+ net_id: int | str
58
55
  index: int
59
56
  data: dict
60
57