pandahub 0.3.3__zip → 0.3.4__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 (57) hide show
  1. {pandahub-0.3.3 → pandahub-0.3.4}/PKG-INFO +49 -7
  2. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/internal/settings.py +8 -3
  3. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/main.py +23 -9
  4. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/client/PandaHubClient.py +12 -7
  5. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/lib/PandaHub.py +7 -3
  6. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/lib/database_toolbox.py +2 -3
  7. {pandahub-0.3.3 → pandahub-0.3.4/pandahub}/pandahub.egg-info/PKG-INFO +49 -7
  8. {pandahub-0.3.3 → pandahub-0.3.4/pandahub}/pandahub.egg-info/SOURCES.txt +6 -9
  9. pandahub-0.3.4/pandahub/pandahub.egg-info/requires.txt +39 -0
  10. pandahub-0.3.4/pandahub/pandahub.egg-info/top_level.txt +4 -0
  11. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/test/conftest.py +15 -5
  12. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/test/test_networks.py +5 -4
  13. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/test/test_projects.py +7 -4
  14. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/test/test_timeseries.py +2 -1
  15. pandahub-0.3.4/pyproject.toml +76 -0
  16. pandahub-0.3.4/setup.py +3 -0
  17. pandahub-0.3.3/pandahub/__init__.py +0 -6
  18. pandahub-0.3.3/pandahub.egg-info/entry_points.txt +0 -2
  19. pandahub-0.3.3/pandahub.egg-info/not-zip-safe +0 -1
  20. pandahub-0.3.3/pandahub.egg-info/requires.txt +0 -12
  21. pandahub-0.3.3/pandahub.egg-info/top_level.txt +0 -1
  22. pandahub-0.3.3/requirements.txt +0 -12
  23. pandahub-0.3.3/setup.py +0 -43
  24. {pandahub-0.3.3 → pandahub-0.3.4}/AUTHORS +0 -0
  25. {pandahub-0.3.3 → pandahub-0.3.4}/CHANGELOG.md +1 -1
  26. {pandahub-0.3.3 → pandahub-0.3.4}/CONTRIBUTING.rst +0 -0
  27. {pandahub-0.3.3 → pandahub-0.3.4}/LICENSE +0 -0
  28. {pandahub-0.3.3 → pandahub-0.3.4}/MANIFEST.in +0 -0
  29. {pandahub-0.3.3 → pandahub-0.3.4}/README.md +0 -0
  30. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/__init__.py +0 -0
  31. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/dependencies.py +0 -0
  32. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/internal/__init__.py +0 -0
  33. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/internal/db.py +0 -0
  34. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/internal/schemas.py +0 -0
  35. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/internal/toolbox.py +0 -0
  36. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/internal/users.py +0 -0
  37. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/routers/__init__.py +0 -0
  38. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/routers/auth.py +0 -0
  39. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/routers/net.py +0 -0
  40. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/routers/projects.py +0 -0
  41. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/routers/timeseries.py +0 -0
  42. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/routers/users.py +0 -0
  43. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/api/routers/variants.py +0 -0
  44. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/client/__init__.py +0 -0
  45. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/client/user_management.py +0 -0
  46. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/lib/__init__.py +0 -0
  47. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/lib/datatypes.py +0 -0
  48. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/lib/mongodb_indexes.py +0 -0
  49. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/lib/timeseries/__init__.py +0 -0
  50. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/lib/timeseries/data_sources/__init__.py +0 -0
  51. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/lib/timeseries/data_sources/mongo_data.py +0 -0
  52. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/lib/timeseries/output_writer_mongodb.py +0 -0
  53. {pandahub-0.3.3 → pandahub-0.3.4/pandahub}/pandahub.egg-info/dependency_links.txt +0 -0
  54. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/test/__init__.py +0 -0
  55. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/test/performance_test.py +0 -0
  56. {pandahub-0.3.3 → pandahub-0.3.4}/pandahub/test/test_client.py +0 -0
  57. {pandahub-0.3.3 → pandahub-0.3.4}/setup.cfg +0 -0
@@ -1,20 +1,62 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pandahub
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Data hub for pandapower and pandapipes networks based on MongoDB
5
- Home-page: https://github.com/e2nIEE/pandahub
6
- Author: Jan Ulffers, Leon Thurner, Jannis Kupka, Mike Vogt, Joschka Thurner, Alexander Scheidler
7
- Author-email: info@pandapower.de
8
- Keywords: pandahub
9
- Classifier: Development Status :: 2 - Pre-Alpha
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
+ License: Copyright (c) 2022 by University of Kassel, Fraunhofer Institute for Energy Economics
7
+ and Energy System Technology (IEE) Kassel, retoflow GmbH individual contributors (see AUTHORS file for details).
8
+ All rights reserved.
9
+
10
+ Redistribution and use in source and binary forms, with or without modification, are permitted
11
+ provided that the following conditions are met:
12
+
13
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions
14
+ and the following disclaimer.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of
17
+ conditions and the following disclaimer in the documentation and/or other materials provided
18
+ with the distribution.
19
+
20
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to
21
+ endorse or promote products derived from this software without specific prior written permission.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
24
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
25
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
26
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
30
+ WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
32
+ Project-URL: Homepage, https://github.com/e2nIEE/pandahub
33
+ Project-URL: Documentation, https://pandapipes.readthedocs.io
34
+ Project-URL: Source, https://github.com/e2nIEE/pandahub
35
+ Project-URL: Repository, https://github.com/e2nIEE/pandahub.git
36
+ Project-URL: Issues, https://github.com/e2nIEE/pandahub/issues
37
+ Project-URL: Download, https://pypi.org/project/pandahub/#files
38
+ Project-URL: Changelog, https://github.com/e2nIEE/pandahub/blob/develop/CHANGELOG.md
39
+ Keywords: network,analysis,optimization,automation,grid,energy,engineering,simulation
40
+ Classifier: Development Status :: 5 - Production/Stable
41
+ Classifier: Environment :: Console
10
42
  Classifier: Intended Audience :: Developers
43
+ Classifier: Intended Audience :: Education
44
+ Classifier: Intended Audience :: Science/Research
45
+ Classifier: License :: OSI Approved :: BSD License
11
46
  Classifier: Natural Language :: English
47
+ Classifier: Operating System :: OS Independent
48
+ Classifier: Programming Language :: Python
12
49
  Classifier: Programming Language :: Python :: 3
50
+ Classifier: Programming Language :: Python :: 3.8
13
51
  Classifier: Programming Language :: Python :: 3.9
14
52
  Classifier: Programming Language :: Python :: 3.10
15
53
  Classifier: Programming Language :: Python :: 3.11
16
- Requires-Python: >=3.6
54
+ Classifier: Programming Language :: Python :: 3.12
55
+ Requires-Python: >=3.8
17
56
  Description-Content-Type: text/markdown
57
+ Provides-Extra: docs
58
+ Provides-Extra: test
59
+ Provides-Extra: all
18
60
  License-File: LICENSE
19
61
  License-File: AUTHORS
20
62
 
@@ -31,14 +31,14 @@ MONGODB_GLOBAL_DATABASE_PASSWORD = get_secret("MONGODB_GLOBAL_DATABASE_PASSWORD"
31
31
  if not MONGODB_GLOBAL_DATABASE_URL:
32
32
  MONGODB_GLOBAL_DATABASE_URL = os.getenv("MONGODB_URL_GLOBAL_DATABASE") or None
33
33
 
34
- EMAIL_VERIFICATION_REQUIRED = settings_bool("EMAIL_VERIFICATION_REQUIRED")
34
+ EMAIL_VERIFICATION_REQUIRED = settings_bool("EMAIL_VERIFICATION_REQUIRED", default=False)
35
35
 
36
36
  MAIL_USERNAME = os.getenv("MAIL_USERNAME") or "dummy@mail.de"
37
37
  MAIL_PASSWORD = os.getenv("MAIL_PASSWORD") or ""
38
38
  MAIL_PORT = os.getenv("MAIL_PORT") or 587
39
39
  MAIL_SMTP_SERVER = os.getenv("MAIL_SMTP_SERVER") or ""
40
- MAIL_STARTTLS = os.getenv("MAIL_STARTTLS") or True
41
- MAIL_SSL_TLS = os.getenv("MAIL_SSL_TLS") or False
40
+ MAIL_STARTTLS = settings_bool("MAIL_STARTTLS", default=True)
41
+ MAIL_SSL_TLS = settings_bool("MAIL_SSL_TLS", default=False)
42
42
 
43
43
  PASSWORD_RESET_URL = os.getenv("PASSWORD_RESET_URL") or ""
44
44
  EMAIL_VERIFY_URL = os.getenv("EMAIL_VERIFY_URL") or ""
@@ -48,3 +48,8 @@ REGISTRATION_ENABLED = settings_bool("REGISTRATION_ENABLED", default=True)
48
48
  REGISTRATION_ADMIN_APPROVAL = settings_bool("REGISTRATION_ADMIN_APPROVAL", default=False)
49
49
 
50
50
  CREATE_INDEXES_WITH_PROJECT = settings_bool("CREATE_INDEXES_WITH_PROJECT", default=True)
51
+
52
+ DEBUG = settings_bool("DEBUG", default=False)
53
+ PANDAHUB_SERVER_URL = os.getenv("PANDAHUB_SERVER_URL", "0.0.0.0")
54
+ PANDAHUB_SERVER_PORT = int(os.getenv('PANDAHUB_SERVER_PORT', 8002))
55
+ WORKERS = int(os.getenv('WORKER', 2))
@@ -8,6 +8,7 @@ from fastapi.responses import JSONResponse
8
8
  from pandahub.lib.PandaHub import PandaHubError
9
9
  from pandahub.api.routers import net, projects, timeseries, users, auth, variants
10
10
  from pandahub.api.internal.db import User, db, AccessToken
11
+ from pandahub.api.internal import settings
11
12
  from beanie import init_beanie
12
13
 
13
14
  @asynccontextmanager
@@ -27,18 +28,19 @@ origins = [
27
28
  "http://localhost:8080",
28
29
  ]
29
30
 
30
- app.add_middleware(
31
- CORSMiddleware,
32
- allow_origins=origins,
33
- allow_credentials=True,
34
- allow_methods=["*"],
35
- allow_headers=["*"],
36
- )
31
+ if settings.DEBUG:
32
+ app.add_middleware(
33
+ CORSMiddleware,
34
+ allow_origins=origins,
35
+ allow_credentials=True,
36
+ allow_methods=["*"],
37
+ allow_headers=["*"],
38
+ )
37
39
 
38
40
  app.include_router(net.router)
39
41
  app.include_router(projects.router)
40
42
  app.include_router(timeseries.router)
41
- app.include_router(User.router)
43
+ app.include_router(users.router)
42
44
  app.include_router(auth.router)
43
45
  app.include_router(variants.router)
44
46
 
@@ -50,6 +52,18 @@ async def pandahub_exception_handler(request: Request, exc: PandaHubError):
50
52
  content=str(exc),
51
53
  )
52
54
 
55
+ @app.get("/")
56
+ async def ready():
57
+ if settings.DEBUG:
58
+ import os
59
+ return os.environ
60
+ return "Hello World!"
61
+
53
62
 
54
63
  if __name__ == "__main__":
55
- uvicorn.run("main:app", host="127.0.0.1", port=8002, log_level="info", reload=True)
64
+ uvicorn.run("main:app",
65
+ host=settings.PANDAHUB_SERVER_URL,
66
+ port=settings.PANDAHUB_SERVER_PORT,
67
+ log_level="info",
68
+ reload=True,
69
+ workers=settings.WORKERS)
@@ -1,22 +1,27 @@
1
- import warnings
2
-
3
1
  import requests
4
2
  import pandapower as pp
5
3
  import pandas as pd
6
- import numpy as np
7
4
  from pathlib import Path
8
5
  import os
9
6
  import json
10
7
  from fastapi.encoders import jsonable_encoder
11
8
 
9
+
12
10
  class PandaHubClient:
13
- def __init__(self):
14
- config = os.path.join(Path.home(), "pandahub.config")
11
+ def __init__(self, config=None):
12
+ d = None
13
+ if config is None:
14
+ config = os.path.join(Path.home(), "pandahub.config")
15
+ elif type(config) == dict:
16
+ d = config
17
+
15
18
  try:
16
- with open(config, "r") as f:
17
- d = json.load(f)
19
+ if d is None:
20
+ with open(config, "r") as f:
21
+ d = json.load(f)
18
22
  except FileNotFoundError:
19
23
  raise UserWarning("No pandahub configuration file found - log in first")
24
+
20
25
  self.url = d["url"]
21
26
  self.token = d["token"]
22
27
  self.cert = None
@@ -234,11 +234,14 @@ class PandaHub:
234
234
  project_data["_id"] = project_id
235
235
  if self.user_id is not None:
236
236
  project_data["users"] = {self.user_id: "owner"}
237
- self.mongo_client["user_management"]["projects"].insert_one(project_data)
237
+ id = self.mongo_client["user_management"]["projects"].insert_one(project_data).inserted_id
238
238
  if CREATE_INDEXES_WITH_PROJECT:
239
239
  self._create_mongodb_indexes(project_data["_id"])
240
240
  if activate:
241
- self.set_active_project_by_id(project_data["_id"])
241
+ if "_id" in project_data.keys():
242
+ id = project_data["_id"]
243
+
244
+ self.set_active_project_by_id(id)
242
245
  return project_data
243
246
 
244
247
  def delete_project(self, i_know_this_action_is_final=False, project_id=None):
@@ -706,6 +709,7 @@ class PandaHub:
706
709
  project_id=None,
707
710
  geo_mode="string",
708
711
  variants=None,
712
+ convert=True,
709
713
  ):
710
714
  if project_id:
711
715
  self.set_active_project_by_id(project_id)
@@ -715,7 +719,7 @@ class PandaHub:
715
719
  if _id is None:
716
720
  return None
717
721
  return self.get_net_from_db_by_id(
718
- _id, include_results, only_tables, geo_mode=geo_mode, variants=variants
722
+ _id, include_results, only_tables, geo_mode=geo_mode, variants=variants, convert=convert
719
723
  )
720
724
 
721
725
  def get_net_from_db_by_id(
@@ -9,6 +9,7 @@ import hashlib
9
9
  import logging
10
10
  import json
11
11
  import importlib
12
+ import blosc
12
13
  logger = logging.getLogger(__name__)
13
14
  from pandapower.io_utils import PPJSONEncoder
14
15
  from packaging import version
@@ -112,7 +113,6 @@ def convert_timeseries_to_subdocuments(timeseries):
112
113
 
113
114
 
114
115
  def compress_timeseries_data(timeseries_data, ts_format):
115
- import blosc
116
116
  if ts_format == "timestamp_value":
117
117
  timeseries_data = np.array([timeseries_data.index.astype("int64"),
118
118
  timeseries_data.values])
@@ -126,7 +126,6 @@ def compress_timeseries_data(timeseries_data, ts_format):
126
126
 
127
127
 
128
128
  def decompress_timeseries_data(timeseries_data, ts_format, num_timestamps):
129
- import blosc
130
129
  if ts_format == "timestamp_value":
131
130
  data = np.frombuffer(blosc.decompress(timeseries_data),
132
131
  dtype=np.float64).reshape((num_timestamps, 2),
@@ -244,7 +243,7 @@ def convert_dataframes_to_dicts(net, net_id, version_, datatypes=DATATYPES):
244
243
  if isinstance(data, pd.core.frame.DataFrame):
245
244
  # ------------
246
245
  # create type lookup
247
- types[key] = get_dtypes(key, data, datatypes.get(key))
246
+ types[key] = get_dtypes(data, datatypes.get(key))
248
247
  if data.empty:
249
248
  continue
250
249
  # ------------
@@ -1,20 +1,62 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pandahub
3
- Version: 0.3.3
3
+ Version: 0.3.4
4
4
  Summary: Data hub for pandapower and pandapipes networks based on MongoDB
5
- Home-page: https://github.com/e2nIEE/pandahub
6
- Author: Jan Ulffers, Leon Thurner, Jannis Kupka, Mike Vogt, Joschka Thurner, Alexander Scheidler
7
- Author-email: info@pandapower.de
8
- Keywords: pandahub
9
- Classifier: Development Status :: 2 - Pre-Alpha
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
+ License: Copyright (c) 2022 by University of Kassel, Fraunhofer Institute for Energy Economics
7
+ and Energy System Technology (IEE) Kassel, retoflow GmbH individual contributors (see AUTHORS file for details).
8
+ All rights reserved.
9
+
10
+ Redistribution and use in source and binary forms, with or without modification, are permitted
11
+ provided that the following conditions are met:
12
+
13
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions
14
+ and the following disclaimer.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of
17
+ conditions and the following disclaimer in the documentation and/or other materials provided
18
+ with the distribution.
19
+
20
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to
21
+ endorse or promote products derived from this software without specific prior written permission.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
24
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
25
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
26
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
30
+ WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
+
32
+ Project-URL: Homepage, https://github.com/e2nIEE/pandahub
33
+ Project-URL: Documentation, https://pandapipes.readthedocs.io
34
+ Project-URL: Source, https://github.com/e2nIEE/pandahub
35
+ Project-URL: Repository, https://github.com/e2nIEE/pandahub.git
36
+ Project-URL: Issues, https://github.com/e2nIEE/pandahub/issues
37
+ Project-URL: Download, https://pypi.org/project/pandahub/#files
38
+ Project-URL: Changelog, https://github.com/e2nIEE/pandahub/blob/develop/CHANGELOG.md
39
+ Keywords: network,analysis,optimization,automation,grid,energy,engineering,simulation
40
+ Classifier: Development Status :: 5 - Production/Stable
41
+ Classifier: Environment :: Console
10
42
  Classifier: Intended Audience :: Developers
43
+ Classifier: Intended Audience :: Education
44
+ Classifier: Intended Audience :: Science/Research
45
+ Classifier: License :: OSI Approved :: BSD License
11
46
  Classifier: Natural Language :: English
47
+ Classifier: Operating System :: OS Independent
48
+ Classifier: Programming Language :: Python
12
49
  Classifier: Programming Language :: Python :: 3
50
+ Classifier: Programming Language :: Python :: 3.8
13
51
  Classifier: Programming Language :: Python :: 3.9
14
52
  Classifier: Programming Language :: Python :: 3.10
15
53
  Classifier: Programming Language :: Python :: 3.11
16
- Requires-Python: >=3.6
54
+ Classifier: Programming Language :: Python :: 3.12
55
+ Requires-Python: >=3.8
17
56
  Description-Content-Type: text/markdown
57
+ Provides-Extra: docs
58
+ Provides-Extra: test
59
+ Provides-Extra: all
18
60
  License-File: LICENSE
19
61
  License-File: AUTHORS
20
62
 
@@ -4,16 +4,8 @@ CONTRIBUTING.rst
4
4
  LICENSE
5
5
  MANIFEST.in
6
6
  README.md
7
- requirements.txt
7
+ pyproject.toml
8
8
  setup.py
9
- pandahub/__init__.py
10
- pandahub.egg-info/PKG-INFO
11
- pandahub.egg-info/SOURCES.txt
12
- pandahub.egg-info/dependency_links.txt
13
- pandahub.egg-info/entry_points.txt
14
- pandahub.egg-info/not-zip-safe
15
- pandahub.egg-info/requires.txt
16
- pandahub.egg-info/top_level.txt
17
9
  pandahub/api/__init__.py
18
10
  pandahub/api/dependencies.py
19
11
  pandahub/api/main.py
@@ -42,6 +34,11 @@ pandahub/lib/timeseries/__init__.py
42
34
  pandahub/lib/timeseries/output_writer_mongodb.py
43
35
  pandahub/lib/timeseries/data_sources/__init__.py
44
36
  pandahub/lib/timeseries/data_sources/mongo_data.py
37
+ pandahub/pandahub.egg-info/PKG-INFO
38
+ pandahub/pandahub.egg-info/SOURCES.txt
39
+ pandahub/pandahub.egg-info/dependency_links.txt
40
+ pandahub/pandahub.egg-info/requires.txt
41
+ pandahub/pandahub.egg-info/top_level.txt
45
42
  pandahub/test/__init__.py
46
43
  pandahub/test/conftest.py
47
44
  pandahub/test/performance_test.py
@@ -0,0 +1,39 @@
1
+ uvicorn>=0.24.0
2
+ fastapi-users[beanie]>=12.0
3
+ fastapi>=0.104.0
4
+ fastapi-mail>=1.4.1
5
+ pandapower~=2.14
6
+ pandapipes>=0.7.0
7
+ pymongo
8
+ pydantic
9
+ simplejson
10
+ requests
11
+ python-dotenv
12
+ pymongoarrow
13
+ blosc
14
+
15
+ [all]
16
+ numpydoc
17
+ sphinx
18
+ sphinx_rtd_theme
19
+ sphinxcontrib.bibtex
20
+ sphinx-pyproject
21
+ pytest
22
+ pytest-xdist
23
+ nbmake
24
+ simbench
25
+ line_profiler
26
+
27
+ [docs]
28
+ numpydoc
29
+ sphinx
30
+ sphinx_rtd_theme
31
+ sphinxcontrib.bibtex
32
+ sphinx-pyproject
33
+
34
+ [test]
35
+ pytest
36
+ pytest-xdist
37
+ nbmake
38
+ simbench
39
+ line_profiler
@@ -0,0 +1,4 @@
1
+ api
2
+ client
3
+ lib
4
+ test
@@ -1,11 +1,11 @@
1
1
  import pytest
2
2
  from pandahub import PandaHub
3
3
  from pandahub import PandaHubClient
4
- from pandahub.client.user_management import _login
4
+ from pandahub.api.internal import settings
5
5
 
6
6
  @pytest.fixture(scope="session")
7
7
  def ph():
8
- ph = PandaHub(connection_url="mongodb://localhost:27017")
8
+ ph = PandaHub(connection_url=settings.MONGODB_URL)
9
9
 
10
10
  project_name = "pytest"
11
11
 
@@ -13,7 +13,7 @@ def ph():
13
13
  ph.set_active_project(project_name)
14
14
  ph.delete_project(i_know_this_action_is_final=True)
15
15
 
16
- ph.create_project(project_name)
16
+ ph.create_project(name=project_name, activate=False)
17
17
  ph.set_active_project(project_name)
18
18
 
19
19
  yield ph
@@ -23,7 +23,17 @@ def ph():
23
23
 
24
24
  @pytest.fixture(scope="session")
25
25
  def phc():
26
- phc = PandaHubClient()
26
+ url = settings.PANDAHUB_SERVER_URL
27
+
28
+ if url == "0.0.0.0":
29
+ url = "127.0.0.1"
30
+
31
+ phc = PandaHubClient(
32
+ config={
33
+ "url": f"http://{url}:{settings.PANDAHUB_SERVER_PORT}",
34
+ "token": settings.SECRET
35
+ }
36
+ )
27
37
 
28
38
  project_name = "pandahubclienttest"
29
39
 
@@ -31,7 +41,7 @@ def phc():
31
41
  # phc.set_active_project(project_name)
32
42
  # phc.delete_project(i_know_this_action_is_final=True)
33
43
 
34
- phc.create_project(project_name)
44
+ phc.create_project(name=project_name)
35
45
  phc.set_active_project(project_name)
36
46
 
37
47
  yield phc
@@ -6,6 +6,7 @@ import pandapower as pp
6
6
  import pandapower.networks as nw_pp
7
7
  from pandahub import PandaHubError
8
8
  from pandapipes.toolbox import nets_equal
9
+ from pandahub.api.internal import settings
9
10
 
10
11
 
11
12
  def test_additional_res_tables(ph):
@@ -139,10 +140,10 @@ def test_access_and_set_single_values(ph):
139
140
 
140
141
 
141
142
  def test_pandapipes(ph):
142
- ph.set_active_project('Awesome')
143
+ ph.set_active_project('pytest')
143
144
  net = nw_pps.gas_versatility()
144
145
  ph.write_network_to_db(net, 'versatility')
145
- net2 = ph.get_net_from_db('versatility')
146
+ net2 = ph.get_net_from_db('versatility', convert=False)
146
147
  pps.pipeflow(net)
147
148
  pps.pipeflow(net2)
148
149
  assert nets_equal(net, net2, check_only_results=True)
@@ -162,8 +163,8 @@ def test_get_set_single_value(ph):
162
163
  if __name__ == '__main__':
163
164
  from pandahub import PandaHub
164
165
 
165
- ph = PandaHub(connection_url="mongodb://localhost:27017")
166
- ph.create_project('Awesome')
166
+ ph = PandaHub(connection_url=settings.MONGODB_URL)
167
+ ph.create_project('pytest')
167
168
  net = nw_pps.gas_versatility()
168
169
  ph.write_network_to_db(net, 'versatility')
169
170
  net2 = ph.get_net_from_db('versatility')
@@ -1,11 +1,12 @@
1
1
  import pandapower.networks as nw
2
2
  import pandahub
3
3
  import pandapower as pp
4
- import pytest
4
+ from pandahub.api.internal import settings
5
5
  from pandahub.lib.database_toolbox import convert_dataframes_to_dicts
6
6
  from pymongo import DESCENDING
7
7
  from packaging import version
8
8
 
9
+
9
10
  def test_project_management(ph):
10
11
  project = "pytest2"
11
12
  if not ph.project_exists(project):
@@ -74,7 +75,7 @@ def test_upgrade_project():
74
75
  except:
75
76
  print("FAILED TO WRITE TABLE", key)
76
77
  # we use the implemetation of 0.2.2 to write a net
77
- oldph = PandaHubV0_2_2(connection_url="mongodb://localhost:27017")
78
+ oldph = PandaHubV0_2_2(connection_url=settings.MONGODB_URL)
78
79
 
79
80
  if oldph.project_exists("pytest"):
80
81
  oldph.set_active_project("pytest")
@@ -83,14 +84,16 @@ def test_upgrade_project():
83
84
  oldph.create_project("pytest")
84
85
  oldph.set_active_project("pytest")
85
86
  net = nw.simple_four_bus_system()
87
+ net.bus.zone = "1"
88
+ net.ext_grid.name = "Slack"
86
89
  oldph.write_network_to_db(net, "simple_network")
87
90
  # convert the db to latest version
88
- ph = pandahub.PandaHub(connection_url="mongodb://localhost:27017")
91
+ ph = pandahub.PandaHub(connection_url=settings.MONGODB_URL)
89
92
  ph.set_active_project("pytest")
90
93
  ph.upgrade_project_to_latest_version()
91
94
  # and test if everything went fine
92
95
  net2 = ph.get_net_from_db("simple_network")
93
- assert pp.nets_equal(net, net2)
96
+ assert pp.nets_equal(net, net2, check_dtype=False)
94
97
 
95
98
 
96
99
  def reset_project(db):
@@ -6,6 +6,7 @@ import pytest
6
6
  import datetime
7
7
  import pandapower.networks as nw
8
8
  import simbench as sb
9
+ from pandahub.api.internal import settings
9
10
 
10
11
  code = "1-HV-urban--0--sw"
11
12
  project = "pytest"
@@ -258,7 +259,7 @@ def test_bulk_write_with_meta(ph):
258
259
  if __name__ == '__main__':
259
260
  from pandahub import PandaHub
260
261
 
261
- ph = PandaHub(connection_url="mongodb://localhost:27017")
262
+ ph = PandaHub(connection_url=settings.MONGODB_URL)
262
263
 
263
264
  project_name = "pytest"
264
265
 
@@ -0,0 +1,76 @@
1
+ [build-system]
2
+ requires = ["build", "wheel", "setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pandahub"
7
+ version = "0.3.4" # File format version '__format_version__' is tracked in __init__.py
8
+ authors=[
9
+ { name = "Jan Ulffers", email = "jan.ulffers@iee.fraunhofer.de" },
10
+ { name = "Leon Thurner", email = "leon.thurner@retoflow.de" },
11
+ { name = "Jannis Kupka", email = "jannis.kupka@retoflow.de" },
12
+ { name = "Mike Vogt", email = "mike.vogt@iee.fraunhofer.de" },
13
+ { name = "Joschka Thurner", email = "joschka.thurner@retoflow.de" },
14
+ { name = "Alexander Scheidler", email = "alexander.scheidler@iee.fraunhofer.de" },
15
+ ]
16
+ description = "Data hub for pandapower and pandapipes networks based on MongoDB"
17
+ readme = "README.md"
18
+ license = { file = "LICENSE" }
19
+ requires-python = ">=3.8"
20
+ classifiers = [
21
+ "Development Status :: 5 - Production/Stable",
22
+ "Environment :: Console",
23
+ "Intended Audience :: Developers",
24
+ "Intended Audience :: Education",
25
+ "Intended Audience :: Science/Research",
26
+ "License :: OSI Approved :: BSD License",
27
+ "Natural Language :: English",
28
+ "Operating System :: OS Independent",
29
+ "Programming Language :: Python",
30
+ "Programming Language :: Python :: 3",
31
+ # Add the specific Python versions supported here, e.g.:
32
+ "Programming Language :: Python :: 3.8",
33
+ "Programming Language :: Python :: 3.9",
34
+ "Programming Language :: Python :: 3.10",
35
+ "Programming Language :: Python :: 3.11",
36
+ "Programming Language :: Python :: 3.12"
37
+ ]
38
+ dependencies = [
39
+ "uvicorn>=0.24.0",
40
+ "fastapi-users[beanie]>=12.0",
41
+ "fastapi>=0.104.0",
42
+ "fastapi-mail>=1.4.1",
43
+ "pandapower~=2.14",
44
+ "pandapipes>=0.7.0",
45
+ "pymongo",
46
+ "pydantic",
47
+ "simplejson",
48
+ "requests",
49
+ "python-dotenv",
50
+ "pymongoarrow",
51
+ "blosc"
52
+ ]
53
+ keywords = [
54
+ "network", "analysis", "optimization", "automation", "grid", "energy", "engineering", "simulation",
55
+ ]
56
+
57
+ [project.urls]
58
+ Homepage = "https://github.com/e2nIEE/pandahub"
59
+ Documentation = "https://pandapipes.readthedocs.io"
60
+ Source = "https://github.com/e2nIEE/pandahub"
61
+ Repository = "https://github.com/e2nIEE/pandahub.git"
62
+ Issues = "https://github.com/e2nIEE/pandahub/issues"
63
+ Download = "https://pypi.org/project/pandahub/#files"
64
+ Changelog = "https://github.com/e2nIEE/pandahub/blob/develop/CHANGELOG.md"
65
+
66
+ [project.optional-dependencies]
67
+ docs = ["numpydoc", "sphinx", "sphinx_rtd_theme", "sphinxcontrib.bibtex", "sphinx-pyproject"]
68
+ test = ["pytest", "pytest-xdist", "nbmake", "simbench", "line_profiler"]
69
+ all = [
70
+ "numpydoc", "sphinx", "sphinx_rtd_theme", "sphinxcontrib.bibtex", "sphinx-pyproject",
71
+ "pytest", "pytest-xdist", "nbmake", "simbench", "line_profiler",
72
+ ]
73
+
74
+ [tool.setuptools.packages.find]
75
+ where = ["pandahub"]
76
+ include = ["*"]
@@ -0,0 +1,3 @@
1
+ from setuptools import setup
2
+
3
+ setup()
@@ -1,6 +0,0 @@
1
- __version__ = "0.3.3"
2
-
3
- from pandahub.lib.PandaHub import PandaHub, PandaHubError
4
- from pandahub.client.PandaHubClient import PandaHubClient
5
-
6
-
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- pandahub-login = pandahub.client.user_management:login
@@ -1 +0,0 @@
1
-
@@ -1,12 +0,0 @@
1
- uvicorn>=0.24.0
2
- fastapi-users[beanie]>=12.0
3
- fastapi>=0.104.0
4
- fastapi-mail>=1.4.1
5
- pandapower>=2.10.1
6
- pandapipes>=0.7.0
7
- pymongo
8
- pydantic
9
- simplejson
10
- requests
11
- python-dotenv
12
- pymongoarrow
@@ -1 +0,0 @@
1
- pandahub
@@ -1,12 +0,0 @@
1
- uvicorn>=0.24.0
2
- fastapi-users[beanie]>=12.0
3
- fastapi>=0.104.0
4
- fastapi-mail>=1.4.1
5
- pandapower>=2.10.1
6
- pandapipes>=0.7.0
7
- pymongo
8
- pydantic
9
- simplejson
10
- requests
11
- python-dotenv
12
- pymongoarrow
pandahub-0.3.3/setup.py DELETED
@@ -1,43 +0,0 @@
1
- from setuptools import setup, find_packages
2
-
3
- with open('README.md') as readme_file:
4
- readme = readme_file.read()
5
-
6
- with open('CHANGELOG.md') as change_file:
7
- changelog = change_file.read()
8
-
9
- with open('requirements.txt') as req_file:
10
- requirements = req_file.read()
11
-
12
- long_description = '\n\n'.join((readme, changelog))
13
-
14
- test_requirements = ['pytest>=3', ]
15
-
16
- setup(
17
- author="Jan Ulffers, Leon Thurner, Jannis Kupka, Mike Vogt, Joschka Thurner, Alexander Scheidler",
18
- author_email='info@pandapower.de',
19
- python_requires='>=3.6',
20
- classifiers=[
21
- 'Development Status :: 2 - Pre-Alpha',
22
- 'Intended Audience :: Developers',
23
- 'Natural Language :: English',
24
- 'Programming Language :: Python :: 3',
25
- 'Programming Language :: Python :: 3.9',
26
- 'Programming Language :: Python :: 3.10',
27
- 'Programming Language :: Python :: 3.11',
28
- ],
29
- description="Data hub for pandapower and pandapipes networks based on MongoDB",
30
- install_requires=requirements,
31
- long_description=readme,
32
- entry_points = {
33
- 'console_scripts': ['pandahub-login=pandahub.client.user_management:login'],
34
- },
35
- keywords='pandahub',
36
- name='pandahub',
37
- packages=find_packages(),
38
- url='https://github.com/e2nIEE/pandahub',
39
- version='0.3.3',
40
- include_package_data=True,
41
- long_description_content_type='text/markdown',
42
- zip_safe=False,
43
- )
File without changes
@@ -1,8 +1,8 @@
1
1
  # Change Log
2
2
 
3
3
  ## [0.2.4]
4
- - BREAKING drops index argument from create_variant() function
5
4
 
5
+ - BREAKING drops index argument from create_variant() function
6
6
 
7
7
  ## [0.2.3]- 2022-08-04
8
8
 
File without changes
File without changes
File without changes
File without changes
File without changes