libentry 1.16__py3-none-any.whl → 1.17__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.
libentry/service/flask.py CHANGED
@@ -13,7 +13,6 @@ from types import GeneratorType
13
13
  from typing import Any, Callable, Iterable, Optional, Type, Union
14
14
 
15
15
  from flask import Flask, request
16
- from gunicorn.app.base import BaseApplication
17
16
  from pydantic import BaseModel, Field, create_model
18
17
 
19
18
  from libentry import api, json
@@ -21,6 +20,26 @@ from libentry.api import APIInfo, list_api_info
21
20
  from libentry.logging import logger
22
21
  from libentry.schema import query_api
23
22
 
23
+ try:
24
+ from gunicorn.app.base import BaseApplication
25
+ except ImportError:
26
+ class BaseApplication:
27
+
28
+ def load(self) -> Flask:
29
+ pass
30
+
31
+ def run(self):
32
+ flask_server = self.load()
33
+ assert hasattr(self, "options")
34
+ bind = getattr(self, "options")["bind"]
35
+ pos = bind.rfind(":")
36
+ host = bind[:pos]
37
+ port = int(bind[pos + 1:])
38
+ logger.warn("Your system doesn't support gunicorn.")
39
+ logger.warn("Use Flask directly.")
40
+ logger.warn("Options like \"num_threads\", \"num_workers\" are ignored.")
41
+ return flask_server.run(host=host, port=port)
42
+
24
43
 
25
44
  class JSONDumper:
26
45
 
@@ -373,3 +392,4 @@ def run_service(
373
392
  for name, value in options.items():
374
393
  logger.info(f"Option {name}: {value}")
375
394
  GunicornApplication(service_type, service_config, options).run()
395
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: libentry
3
- Version: 1.16
3
+ Version: 1.17
4
4
  Summary: Entries for experimental utilities.
5
5
  Home-page: https://github.com/XoriieInpottn/libentry
6
6
  Author: xi
@@ -10,14 +10,14 @@ libentry/schema.py,sha256=BO7EE7i43Cb4xn_OLsBM-HDwWOT6V5fPs91Am3QqnNQ,8178
10
10
  libentry/server.py,sha256=gYPoZXd0umlDYZf-6ZV0_vJadg3YQvnLDc6JFDJh9jc,1503
11
11
  libentry/service/__init__.py,sha256=1oLL20yLB1GL9IbFiZD8OReDqiCpFr-yetIR6x1cNkI,23
12
12
  libentry/service/common.py,sha256=OVaW2afgKA6YqstJmtnprBCqQEUZEWotZ6tHavmJJeU,42
13
- libentry/service/flask.py,sha256=obFIfm7WVNr_wQsUDO9zFMH2RbfqPHAeqQq9vCpiyWg,12722
13
+ libentry/service/flask.py,sha256=Alpsix01ROqI28k-dabD8wJlWAWs-ObNc1nJ-LxOXn4,13349
14
14
  libentry/service/list.py,sha256=ElHWhTgShGOhaxMUEwVbMXos0NQKjHsODboiQ-3AMwE,1397
15
15
  libentry/service/running.py,sha256=FrPJoJX6wYxcHIysoatAxhW3LajCCm0Gx6l7__6sULQ,5105
16
16
  libentry/service/start.py,sha256=mZT7b9rVULvzy9GTZwxWnciCHgv9dbGN2JbxM60OMn4,1270
17
17
  libentry/service/stop.py,sha256=wOpwZgrEJ7QirntfvibGq-XsTC6b3ELhzRW2zezh-0s,1187
18
- libentry-1.16.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
- libentry-1.16.dist-info/METADATA,sha256=5EyO2Vs582BzElenZhG1qs7ccPV4-4GRoR7OS9Ctnxk,791
20
- libentry-1.16.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
21
- libentry-1.16.dist-info/top_level.txt,sha256=u2uF6-X5fn2Erf9PYXOg_6tntPqTpyT-yzUZrltEd6I,9
22
- libentry-1.16.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
23
- libentry-1.16.dist-info/RECORD,,
18
+ libentry-1.17.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
19
+ libentry-1.17.dist-info/METADATA,sha256=6kVrTOffjfB4RzkedsLggG0DVy8la9fIx2c3iP7cuAw,791
20
+ libentry-1.17.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
21
+ libentry-1.17.dist-info/top_level.txt,sha256=u2uF6-X5fn2Erf9PYXOg_6tntPqTpyT-yzUZrltEd6I,9
22
+ libentry-1.17.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
23
+ libentry-1.17.dist-info/RECORD,,