syft-flwr 0.1.2__py3-none-any.whl → 0.1.5__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.
Potentially problematic release.
This version of syft-flwr might be problematic. Click here for more details.
- syft_flwr/__init__.py +10 -1
- syft_flwr/mounts.py +62 -0
- {syft_flwr-0.1.2.dist-info → syft_flwr-0.1.5.dist-info}/METADATA +2 -5
- {syft_flwr-0.1.2.dist-info → syft_flwr-0.1.5.dist-info}/RECORD +7 -8
- README.md +0 -8
- pyproject.toml +0 -52
- {syft_flwr-0.1.2.dist-info → syft_flwr-0.1.5.dist-info}/WHEEL +0 -0
- {syft_flwr-0.1.2.dist-info → syft_flwr-0.1.5.dist-info}/entry_points.txt +0 -0
- {syft_flwr-0.1.2.dist-info → syft_flwr-0.1.5.dist-info}/licenses/LICENSE +0 -0
syft_flwr/__init__.py
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.5"
|
|
2
2
|
|
|
3
3
|
from syft_flwr.bootstrap import bootstrap
|
|
4
4
|
from syft_flwr.run import run
|
|
5
5
|
|
|
6
6
|
__all__ = ["bootstrap", "run"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Register the mount provider for syft_rds when syft_flwr is initializedAdd commentMore actions
|
|
10
|
+
from syft_rds.syft_runtime.mounts import register_mount_provider
|
|
11
|
+
|
|
12
|
+
from .mounts import SyftFlwrMountProvider
|
|
13
|
+
|
|
14
|
+
# Register the mount provider
|
|
15
|
+
register_mount_provider("syft_flwr", SyftFlwrMountProvider())
|
syft_flwr/mounts.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import List
|
|
5
|
+
|
|
6
|
+
import tomli
|
|
7
|
+
from loguru import logger
|
|
8
|
+
from syft_core import Client
|
|
9
|
+
from syft_rds.models import DockerMount, JobConfig
|
|
10
|
+
from syft_rds.syft_runtime.mounts import MountProvider
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class SyftFlwrMountProvider(MountProvider):
|
|
14
|
+
def _simplify_config(self, config_path: Path, simplified_config_path: Path) -> None:
|
|
15
|
+
"""
|
|
16
|
+
Simplify the config by removing the refresh_token and setting the data_dir to /app/SyftBox
|
|
17
|
+
in order to mount the config to the container.
|
|
18
|
+
"""
|
|
19
|
+
with open(config_path, "r") as fp:
|
|
20
|
+
config = json.load(fp)
|
|
21
|
+
modified_config = config.copy()
|
|
22
|
+
modified_config["data_dir"] = "/app/SyftBox"
|
|
23
|
+
modified_config.pop("refresh_token", None)
|
|
24
|
+
with open(simplified_config_path, "w") as fp:
|
|
25
|
+
json.dump(modified_config, fp)
|
|
26
|
+
|
|
27
|
+
def get_mounts(self, job_config: JobConfig) -> List[DockerMount]:
|
|
28
|
+
client = Client.load()
|
|
29
|
+
client_email = client.email
|
|
30
|
+
flwr_app_data = client.app_data("flwr")
|
|
31
|
+
|
|
32
|
+
config_path = client.config_path
|
|
33
|
+
simplified_dir = client.config_path.parent / ".simplified_configs"
|
|
34
|
+
simplified_dir.mkdir(parents=True, exist_ok=True)
|
|
35
|
+
simplified_config_path = simplified_dir / f"{client_email}.config.json"
|
|
36
|
+
self._simplify_config(config_path, simplified_config_path)
|
|
37
|
+
|
|
38
|
+
# Read app name from pyproject.toml
|
|
39
|
+
with open(job_config.function_folder / "pyproject.toml", "rb") as fp:
|
|
40
|
+
toml_dict = tomli.load(fp)
|
|
41
|
+
syft_flwr_app_name = toml_dict["tool"]["syft_flwr"]["app_name"]
|
|
42
|
+
|
|
43
|
+
rpc_messages_source = Path(f"{flwr_app_data}/{syft_flwr_app_name}/rpc/messages")
|
|
44
|
+
rpc_messages_source.mkdir(parents=True, exist_ok=True)
|
|
45
|
+
os.chmod(rpc_messages_source, 0o777)
|
|
46
|
+
|
|
47
|
+
mounts = [
|
|
48
|
+
DockerMount(
|
|
49
|
+
source=simplified_config_path,
|
|
50
|
+
target="/app/config.json",
|
|
51
|
+
mode="ro",
|
|
52
|
+
),
|
|
53
|
+
DockerMount(
|
|
54
|
+
source=rpc_messages_source,
|
|
55
|
+
target=f"/app/SyftBox/datasites/{client_email}/app_data/flwr/{syft_flwr_app_name}/rpc/messages",
|
|
56
|
+
mode="rw",
|
|
57
|
+
),
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
logger.debug(f"Mounts: {mounts}")
|
|
61
|
+
|
|
62
|
+
return mounts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: syft-flwr
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: syft_flwr is an open source framework that facilitate federated learning projects using Flower over the SyftBox protocol
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: >=3.9.2
|
|
@@ -8,10 +8,7 @@ Requires-Dist: flwr-datasets[vision]>=0.5.0
|
|
|
8
8
|
Requires-Dist: flwr[simulation]==1.17.0
|
|
9
9
|
Requires-Dist: loguru>=0.7.3
|
|
10
10
|
Requires-Dist: safetensors>=0.5.0
|
|
11
|
-
Requires-Dist: syft-
|
|
12
|
-
Requires-Dist: syft-event==0.2.0
|
|
13
|
-
Requires-Dist: syft-rds==0.1.0
|
|
14
|
-
Requires-Dist: syft-rpc==0.2.0
|
|
11
|
+
Requires-Dist: syft-rds==0.1.4
|
|
15
12
|
Requires-Dist: tomli-w>=1.2.0
|
|
16
13
|
Requires-Dist: tomli>=2.2.1
|
|
17
14
|
Requires-Dist: typing-extensions>=4.13.0
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
pyproject.toml,sha256=9xXaUPNxLw22C4aYYqOAFAyvcUa9wV2wVTxSlUUsX_o,1243
|
|
3
|
-
syft_flwr/__init__.py,sha256=i9rBsTh9ChUYp0phPXT13pGdIj5J5et7efxV3C4RMto,127
|
|
1
|
+
syft_flwr/__init__.py,sha256=n8U8g6H1Gkgy52rSe5dXsW837X6eQ9BkKeLVqAwJ5X8,426
|
|
4
2
|
syft_flwr/bootstrap.py,sha256=-T6SRh_p6u6uWpbTPZ6-URsAfMQAI2jakpjZAh0UUlw,3690
|
|
5
3
|
syft_flwr/cli.py,sha256=imctwdQMxQeGQZaiKSX1Mo2nU_-RmA-cGB3H4huuUeA,3274
|
|
6
4
|
syft_flwr/config.py,sha256=4hwkovGtFOLNULjJwoGYcA0uT4y3vZSrxndXqYXquMY,821
|
|
@@ -8,6 +6,7 @@ syft_flwr/flower_client.py,sha256=jn0oTKf7ChSFd7DP5ZWi0P1BrNX6w2_Gcm4GqTxjIVM,32
|
|
|
8
6
|
syft_flwr/flower_server.py,sha256=sJwSEqePmkmWKGFXm2E44Ugoc6aaz-6tM7UaeWM2-co,1353
|
|
9
7
|
syft_flwr/flwr_compatibility.py,sha256=vURf9rfsZ1uPm04szw6RpGYxtlG3BE4tW3YijptiGyk,3197
|
|
10
8
|
syft_flwr/grid.py,sha256=Me2tivW0v1ApTjdjQffUc9f1UCHh1LtkYcKUjE82iZ8,7735
|
|
9
|
+
syft_flwr/mounts.py,sha256=ry3_3eD4aPkRahk9eibfu88TpQjgp_KQ96G7yj692x4,2319
|
|
11
10
|
syft_flwr/run.py,sha256=OPW9bVt366DT-U-SxMpMLNXASwTZjp7XNNXfDP767f4,2153
|
|
12
11
|
syft_flwr/run_simulation.py,sha256=t3shhfzAWDUlf6iQmwf5sS9APZQE9mkaZ9MLCYs9Ng0,6922
|
|
13
12
|
syft_flwr/serde.py,sha256=5fCI-cRUOh5wE7cXQd4J6jex1grRGnyD1Jx-VlEDOXM,495
|
|
@@ -15,8 +14,8 @@ syft_flwr/utils.py,sha256=3dDYEB7btq9hxZ9UsfQWh3i44OerAhGXc5XaX5wO3-o,955
|
|
|
15
14
|
syft_flwr/strategy/__init__.py,sha256=mpUmExjjFkqU8gg41XsOBKfO3aqCBe7XPJSU-_P7smU,97
|
|
16
15
|
syft_flwr/strategy/fedavg.py,sha256=N8jULUkjvuaBIEVINowyQln8W8yFhkO-J8k0-iPcGMA,1562
|
|
17
16
|
syft_flwr/templates/main.py.tpl,sha256=p0uK97jvLGk3LJdy1_HF1R5BQgIjaTGkYnr-csfh39M,791
|
|
18
|
-
syft_flwr-0.1.
|
|
19
|
-
syft_flwr-0.1.
|
|
20
|
-
syft_flwr-0.1.
|
|
21
|
-
syft_flwr-0.1.
|
|
22
|
-
syft_flwr-0.1.
|
|
17
|
+
syft_flwr-0.1.5.dist-info/METADATA,sha256=czIreQ7KbqGnfuO9WFo84ffPM2uvXNXPQojNZPFYCSg,898
|
|
18
|
+
syft_flwr-0.1.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
19
|
+
syft_flwr-0.1.5.dist-info/entry_points.txt,sha256=o7oT0dCoHn-3WyIwdDw1lBh2q-GvhB_8s0hWeJU4myc,49
|
|
20
|
+
syft_flwr-0.1.5.dist-info/licenses/LICENSE,sha256=0msOUar8uPZTqkAOTBp4rCzd7Jl9eRhfKiNufwrsg7k,11361
|
|
21
|
+
syft_flwr-0.1.5.dist-info/RECORD,,
|
README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# syft_flwr
|
|
2
|
-
|
|
3
|
-
`syft_flwr` is an open source framework that facilitate federated learning projects using [Flower](https://github.com/adap/flower) over the [SyftBox](https://github.com/OpenMined/syftbox) protocol
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
- Install uv: `brew install uv`
|
|
7
|
-
- Create a virtual environment: `uv venv`
|
|
8
|
-
- Install `syft-flwr`: `uv pip install syft-flwr`
|
pyproject.toml
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "syft-flwr"
|
|
3
|
-
version = "0.1.2"
|
|
4
|
-
description = "syft_flwr is an open source framework that facilitate federated learning projects using Flower over the SyftBox protocol"
|
|
5
|
-
readme = "README.md"
|
|
6
|
-
requires-python = ">=3.9.2"
|
|
7
|
-
dependencies = [
|
|
8
|
-
"flwr[simulation]==1.17.0",
|
|
9
|
-
"flwr-datasets[vision]>=0.5.0",
|
|
10
|
-
"loguru>=0.7.3",
|
|
11
|
-
"safetensors>=0.5.0",
|
|
12
|
-
"typing-extensions>=4.13.0",
|
|
13
|
-
"tomli>=2.2.1",
|
|
14
|
-
"tomli-w>=1.2.0",
|
|
15
|
-
"syft-core==0.2.3",
|
|
16
|
-
"syft-event==0.2.0",
|
|
17
|
-
"syft-rpc==0.2.0",
|
|
18
|
-
"syft-rds==0.1.0",
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
[project.scripts]
|
|
22
|
-
syft_flwr = "syft_flwr.cli:main"
|
|
23
|
-
|
|
24
|
-
[tool.uv]
|
|
25
|
-
dev-dependencies = [
|
|
26
|
-
"ipykernel>=6.29.5",
|
|
27
|
-
"ipywidgets>=8.1.6",
|
|
28
|
-
"pytest>=8.3.4",
|
|
29
|
-
"pre-commit>=4.0.1",
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
[build-system]
|
|
33
|
-
requires = ["hatchling"]
|
|
34
|
-
build-backend = "hatchling.build"
|
|
35
|
-
|
|
36
|
-
[tool.hatch.build.targets.wheel]
|
|
37
|
-
packages = ["src/syft_flwr"]
|
|
38
|
-
only-include = ["src", "pyproject.toml", "/README.md"]
|
|
39
|
-
exclude = ["src/**/__pycache__"]
|
|
40
|
-
|
|
41
|
-
[tool.hatch.build.targets.sdist]
|
|
42
|
-
only-include = ["src", "pyproject.toml", "/README.md"]
|
|
43
|
-
exclude = ["src/**/__pycache__", "examples", "notebooks", "justfile"]
|
|
44
|
-
|
|
45
|
-
[tool.ruff]
|
|
46
|
-
exclude = [".archive"]
|
|
47
|
-
|
|
48
|
-
[tool.ruff.lint]
|
|
49
|
-
extend-select = ["I"]
|
|
50
|
-
|
|
51
|
-
[tool.ruff.lint.per-file-ignores]
|
|
52
|
-
"**/__init__.py" = ["F401"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|