flwr-nightly 1.5.0.dev20230720__py3-none-any.whl → 1.5.0.dev20230730__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
flwr/server/app.py CHANGED
@@ -282,8 +282,7 @@ def run_fleet_api() -> None:
282
282
  # Start Fleet API
283
283
  if args.fleet_api_type == TRANSPORT_TYPE_REST:
284
284
  if (
285
- importlib.util.find_spec("fastapi")
286
- and importlib.util.find_spec("requests")
285
+ importlib.util.find_spec("requests")
287
286
  and importlib.util.find_spec("starlette")
288
287
  and importlib.util.find_spec("uvicorn")
289
288
  ) is None:
@@ -376,8 +375,7 @@ def run_server() -> None:
376
375
  # Start Fleet API
377
376
  if args.fleet_api_type == TRANSPORT_TYPE_REST:
378
377
  if (
379
- importlib.util.find_spec("fastapi")
380
- and importlib.util.find_spec("requests")
378
+ importlib.util.find_spec("requests")
381
379
  and importlib.util.find_spec("starlette")
382
380
  and importlib.util.find_spec("uvicorn")
383
381
  ) is None:
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- """REST API server."""
15
+ """Experimental REST API server."""
16
16
 
17
17
 
18
18
  import sys
@@ -23,16 +23,16 @@ from flwr.server.fleet.message_handler import message_handler
23
23
  from flwr.server.state import State
24
24
 
25
25
  try:
26
- from fastapi import FastAPI, HTTPException, Request, Response
26
+ from starlette.applications import Starlette
27
27
  from starlette.datastructures import Headers
28
+ from starlette.exceptions import HTTPException
29
+ from starlette.requests import Request
30
+ from starlette.responses import Response
31
+ from starlette.routing import Route
28
32
  except ModuleNotFoundError:
29
33
  sys.exit(MISSING_EXTRA_REST)
30
34
 
31
35
 
32
- app: FastAPI = FastAPI()
33
-
34
-
35
- @app.post("/api/v0/fleet/pull-task-ins", response_class=Response)
36
36
  async def pull_task_ins(request: Request) -> Response:
37
37
  """Pull TaskIns."""
38
38
  _check_headers(request.headers)
@@ -62,7 +62,6 @@ async def pull_task_ins(request: Request) -> Response:
62
62
  )
63
63
 
64
64
 
65
- @app.post("/api/v0/fleet/push-task-res", response_class=Response)
66
65
  async def push_task_res(request: Request) -> Response: # Check if token is needed here
67
66
  """Push TaskRes."""
68
67
  _check_headers(request.headers)
@@ -92,6 +91,17 @@ async def push_task_res(request: Request) -> Response: # Check if token is need
92
91
  )
93
92
 
94
93
 
94
+ routes = [
95
+ Route("/api/v0/fleet/pull-task-ins", pull_task_ins, methods=["POST"]),
96
+ Route("/api/v0/fleet/push-task-res", push_task_res, methods=["POST"]),
97
+ ]
98
+
99
+ app: Starlette = Starlette(
100
+ debug=False,
101
+ routes=routes,
102
+ )
103
+
104
+
95
105
  def _check_headers(headers: Headers) -> None:
96
106
  """Check if expected headers are set."""
97
107
  if "content-type" not in headers:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flwr-nightly
3
- Version: 1.5.0.dev20230720
3
+ Version: 1.5.0.dev20230730
4
4
  Summary: Flower: A Friendly Federated Learning Framework
5
5
  Home-page: https://flower.dev
6
6
  License: Apache-2.0
@@ -33,7 +33,6 @@ Classifier: Typing :: Typed
33
33
  Provides-Extra: rest
34
34
  Provides-Extra: simulation
35
35
  Requires-Dist: cryptography (>=41.0.2,<42.0.0)
36
- Requires-Dist: fastapi (>=0.95.0,<0.96.0) ; extra == "rest"
37
36
  Requires-Dist: grpcio (>=1.48.2,<2.0.0,!=1.52.0)
38
37
  Requires-Dist: importlib-metadata (>=4.0.0,<5.0.0) ; python_version < "3.8"
39
38
  Requires-Dist: iterators (>=0.0.2,<0.0.3)
@@ -42,9 +41,9 @@ Requires-Dist: protobuf (>=3.19.0,<4.0.0)
42
41
  Requires-Dist: pycryptodome (>=3.18.0,<4.0.0)
43
42
  Requires-Dist: pydantic (<2.0.0) ; extra == "simulation"
44
43
  Requires-Dist: ray[default] (==2.5.1) ; extra == "simulation"
45
- Requires-Dist: requests (>=2.28.2,<3.0.0) ; extra == "rest"
46
- Requires-Dist: starlette (>=0.27.0,<0.28.0) ; extra == "rest"
47
- Requires-Dist: uvicorn[standard] (>=0.21.1,<0.22.0) ; extra == "rest"
44
+ Requires-Dist: requests (>=2.31.0,<3.0.0) ; extra == "rest"
45
+ Requires-Dist: starlette (>=0.29.0,<0.30.0) ; extra == "rest"
46
+ Requires-Dist: uvicorn[standard] (>=0.22.0,<0.23.0) ; extra == "rest"
48
47
  Project-URL: Documentation, https://flower.dev
49
48
  Project-URL: Repository, https://github.com/adap/flower
50
49
  Description-Content-Type: text/markdown
@@ -53,7 +53,7 @@ flwr/proto/transport_pb2_grpc.py,sha256=vLN3EHtx2aEEMCO4f1Upu-l27BPzd3-5pV-u8wPc
53
53
  flwr/proto/transport_pb2_grpc.pyi,sha256=AGXf8RiIiW2J5IKMlm_3qT3AzcDa4F3P5IqUjve_esA,766
54
54
  flwr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
55
55
  flwr/server/__init__.py,sha256=fDk0_Aa1UkPBnhgAteeQv42KQyxSgU4JsF7le9gvVyY,1370
56
- flwr/server/app.py,sha256=qb-8DZzxrlB30FNd6a22IU7uPKrGEMZcc98l0tKWm_Y,26333
56
+ flwr/server/app.py,sha256=Np5EmHqcGDNSBEmBD_b_vuwvTvZWhecw11y08fEiViY,26229
57
57
  flwr/server/client_manager.py,sha256=x9QYmwFkN4BMqZ-I2GBQgRB2HbPVwjHhMS0eBudwbJ4,6120
58
58
  flwr/server/client_proxy.py,sha256=02so_31pp7U5nX9zD79L9rWbB2bhRFvELeG12LdxOaM,2227
59
59
  flwr/server/criterion.py,sha256=VgR9xvn0YZMMrEZOwH9hdSeLHybLKlK2Ymoor3RlWv4,1054
@@ -72,7 +72,7 @@ flwr/server/fleet/grpc_rere/fleet_servicer.py,sha256=hLIxV7NhG9eG0QQAhNWEZc-KbtO
72
72
  flwr/server/fleet/message_handler/__init__.py,sha256=P1NBR3HKEcyOjELw1XaCSjNc94WYnIUGjAn9YcgW6k4,724
73
73
  flwr/server/fleet/message_handler/message_handler.py,sha256=6eY3tGE4kMruKobKW8irjJyyQbTTOJezwlvZDeiBBA4,2876
74
74
  flwr/server/fleet/rest_rere/__init__.py,sha256=2rG5KG7xojkD8jgwUrJPrW4Nsdm_HhwZaQ1poy9x3KQ,728
75
- flwr/server/fleet/rest_rere/rest_api.py,sha256=Q3wbofJyjyefVCJKWGlUH_I_BZfrOaBMDwN7bdVFozk,3686
75
+ flwr/server/fleet/rest_rere/rest_api.py,sha256=R_UZUjPTFKKe1XIq5NbSFNdn5yd-gXizUNIHiKSN_Hc,3934
76
76
  flwr/server/history.py,sha256=xI7LfjV67VQZkKoHRpzILG1zKb_a0pMyL2vpn15BsxM,4897
77
77
  flwr/server/server.py,sha256=amrh_Xpfkq8EQdnDubDn3NPyIuv8-SIm6wZ8bhdb9mE,15958
78
78
  flwr/server/state/__init__.py,sha256=jcTV_f7T8w72NWkAY9kNPFis-FOd3Zm5jLE3CRmvOkE,996
@@ -106,8 +106,8 @@ flwr/simulation/__init__.py,sha256=ZtAt5bMbbp9IJp1QQOhACN6_qhSPDtGmHF8gypUOZ9s,1
106
106
  flwr/simulation/app.py,sha256=uScSm6ep7ngJno1eDAgG9ReGYyYcez4GhhwpRQzjLGA,7762
107
107
  flwr/simulation/ray_transport/__init__.py,sha256=eJ3pijYkI7XhbX2rLu6FBGTo8hZkFL8RSj4twhApOGw,727
108
108
  flwr/simulation/ray_transport/ray_client_proxy.py,sha256=TClE-Y9udGCUWi-mfwv83VLBV55eOXosc2HxyLHYZi0,5471
109
- flwr_nightly-1.5.0.dev20230720.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
110
- flwr_nightly-1.5.0.dev20230720.dist-info/METADATA,sha256=8s7hwPb2fo8XNx3ykXgd-2oUS7tPsLNj-gl4Q9dhjw4,13223
111
- flwr_nightly-1.5.0.dev20230720.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
112
- flwr_nightly-1.5.0.dev20230720.dist-info/entry_points.txt,sha256=1uLlD5tIunkzALMfMWnqjdE_D5hRUX_I1iMmOMv6tZI,181
113
- flwr_nightly-1.5.0.dev20230720.dist-info/RECORD,,
109
+ flwr_nightly-1.5.0.dev20230730.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
110
+ flwr_nightly-1.5.0.dev20230730.dist-info/METADATA,sha256=fzIAT9TuFV8pZ8iQDLnXF-rLypWTrK2K9J6eTIvUTtQ,13163
111
+ flwr_nightly-1.5.0.dev20230730.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
112
+ flwr_nightly-1.5.0.dev20230730.dist-info/entry_points.txt,sha256=1uLlD5tIunkzALMfMWnqjdE_D5hRUX_I1iMmOMv6tZI,181
113
+ flwr_nightly-1.5.0.dev20230730.dist-info/RECORD,,