pandahub 0.3.2__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.
- {pandahub-0.3.2 → pandahub-0.3.4}/PKG-INFO +49 -7
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/internal/db.py +2 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/internal/schemas.py +2 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/internal/settings.py +8 -4
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/main.py +23 -9
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/routers/variants.py +3 -4
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/client/PandaHubClient.py +12 -7
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/lib/PandaHub.py +172 -101
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/lib/database_toolbox.py +7 -10
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/lib/datatypes.py +1 -1
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/lib/mongodb_indexes.py +35 -2
- {pandahub-0.3.2 → pandahub-0.3.4/pandahub}/pandahub.egg-info/PKG-INFO +49 -7
- {pandahub-0.3.2 → pandahub-0.3.4/pandahub}/pandahub.egg-info/SOURCES.txt +6 -9
- pandahub-0.3.4/pandahub/pandahub.egg-info/requires.txt +39 -0
- pandahub-0.3.4/pandahub/pandahub.egg-info/top_level.txt +4 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/test/conftest.py +15 -5
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/test/test_networks.py +5 -4
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/test/test_projects.py +7 -4
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/test/test_timeseries.py +2 -1
- pandahub-0.3.4/pyproject.toml +76 -0
- pandahub-0.3.4/setup.py +3 -0
- pandahub-0.3.2/pandahub/__init__.py +0 -6
- pandahub-0.3.2/pandahub.egg-info/entry_points.txt +0 -2
- pandahub-0.3.2/pandahub.egg-info/not-zip-safe +0 -1
- pandahub-0.3.2/pandahub.egg-info/requires.txt +0 -12
- pandahub-0.3.2/pandahub.egg-info/top_level.txt +0 -1
- pandahub-0.3.2/requirements.txt +0 -12
- pandahub-0.3.2/setup.py +0 -43
- {pandahub-0.3.2 → pandahub-0.3.4}/AUTHORS +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/CHANGELOG.md +1 -1
- {pandahub-0.3.2 → pandahub-0.3.4}/CONTRIBUTING.rst +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/LICENSE +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/MANIFEST.in +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/README.md +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/__init__.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/dependencies.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/internal/__init__.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/internal/toolbox.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/internal/users.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/routers/__init__.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/routers/auth.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/routers/net.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/routers/projects.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/routers/timeseries.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/api/routers/users.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/client/__init__.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/client/user_management.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/lib/__init__.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/lib/timeseries/__init__.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/lib/timeseries/data_sources/__init__.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/lib/timeseries/data_sources/mongo_data.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/lib/timeseries/output_writer_mongodb.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4/pandahub}/pandahub.egg-info/dependency_links.txt +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/test/__init__.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/test/performance_test.py +0 -0
- {pandahub-0.3.2 → pandahub-0.3.4}/pandahub/test/test_client.py +0 -0
- {pandahub-0.3.2 → 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
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Data hub for pandapower and pandapipes networks based on MongoDB
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -9,6 +9,7 @@ from fastapi_users_db_beanie.access_token import (
|
|
|
9
9
|
BeanieBaseAccessToken,
|
|
10
10
|
)
|
|
11
11
|
|
|
12
|
+
from pandahub.api.internal.settings import REGISTRATION_ADMIN_APPROVAL
|
|
12
13
|
from pandahub.api.internal import settings
|
|
13
14
|
from pydantic import Field
|
|
14
15
|
|
|
@@ -22,6 +23,7 @@ db = client["user_management"]
|
|
|
22
23
|
|
|
23
24
|
class User(BeanieBaseUser, Document):
|
|
24
25
|
id: uuid.UUID = Field(default_factory=uuid.uuid4)
|
|
26
|
+
is_active: bool = not REGISTRATION_ADMIN_APPROVAL
|
|
25
27
|
class Settings(BeanieBaseUser.Settings):
|
|
26
28
|
name = "users"
|
|
27
29
|
|
|
@@ -7,8 +7,10 @@ from pandahub.api.internal.settings import REGISTRATION_ADMIN_APPROVAL
|
|
|
7
7
|
class UserRead(schemas.BaseUser[uuid.UUID]):
|
|
8
8
|
pass
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
class UserCreate(schemas.BaseUserCreate):
|
|
11
12
|
is_active: bool = not REGISTRATION_ADMIN_APPROVAL
|
|
12
13
|
|
|
14
|
+
|
|
13
15
|
class UserUpdate(schemas.BaseUserUpdate):
|
|
14
16
|
pass
|
|
@@ -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 =
|
|
41
|
-
MAIL_SSL_TLS =
|
|
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 ""
|
|
@@ -47,5 +47,9 @@ SECRET = get_secret("SECRET") or None
|
|
|
47
47
|
REGISTRATION_ENABLED = settings_bool("REGISTRATION_ENABLED", default=True)
|
|
48
48
|
REGISTRATION_ADMIN_APPROVAL = settings_bool("REGISTRATION_ADMIN_APPROVAL", default=False)
|
|
49
49
|
|
|
50
|
-
DATATYPES_MODULE = os.getenv("DATATYPES_MODULE") or "pandahub.lib.datatypes"
|
|
51
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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(
|
|
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",
|
|
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)
|
|
@@ -21,11 +21,10 @@ class GetVariantsModel(BaseModel):
|
|
|
21
21
|
|
|
22
22
|
@router.post("/get_variants")
|
|
23
23
|
def get_variants(data: GetVariantsModel, ph=Depends(pandahub)):
|
|
24
|
-
|
|
25
|
-
ph.
|
|
26
|
-
db = ph._get_project_database()
|
|
24
|
+
ph.set_active_project_by_id(data.project_id)
|
|
25
|
+
variants_collection = ph.get_project_database("variant")
|
|
27
26
|
|
|
28
|
-
variants =
|
|
27
|
+
variants = variants_collection.find({"net_id": data.net_id}, projection={"_id": 0})
|
|
29
28
|
response = {}
|
|
30
29
|
for var in variants:
|
|
31
30
|
response[var.pop("index")] = var
|
|
@@ -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
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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
|