FedModelKit 0.6.7__tar.gz → 0.7.0__tar.gz

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 (79) hide show
  1. fedmodelkit-0.7.0/.python-version +1 -0
  2. fedmodelkit-0.7.0/PKG-INFO +93 -0
  3. fedmodelkit-0.7.0/README.md +79 -0
  4. fedmodelkit-0.7.0/pyproject.toml +26 -0
  5. fedmodelkit-0.7.0/src/FedModelKit/README.md +19 -0
  6. fedmodelkit-0.7.0/src/FedModelKit/__init__.py +10 -0
  7. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/aggregator.py +0 -10
  8. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/cli.py +20 -20
  9. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/local_learner.py +0 -10
  10. fedmodelkit-0.7.0/src/FedModelKit/mlflow_service/__init__.py +33 -0
  11. fedmodelkit-0.7.0/src/FedModelKit/mlflow_service/client.py +591 -0
  12. fedmodelkit-0.7.0/src/FedModelKit/mlflow_service/messages.py +246 -0
  13. fedmodelkit-0.7.0/src/FedModelKit/mlflow_service/server.py +443 -0
  14. fedmodelkit-0.6.7/src/FedModelKit/templates/client_app_template.py → fedmodelkit-0.7.0/src/FedModelKit/templates/client_app.py +64 -14
  15. fedmodelkit-0.7.0/src/FedModelKit/templates/do1.ipynb +269 -0
  16. fedmodelkit-0.7.0/src/FedModelKit/templates/do2.ipynb +268 -0
  17. fedmodelkit-0.7.0/src/FedModelKit/templates/ds.ipynb +502 -0
  18. fedmodelkit-0.6.7/src/FedModelKit/templates/extern_pyproject_template.toml → fedmodelkit-0.7.0/src/FedModelKit/templates/extern_pyproject.toml +2 -5
  19. fedmodelkit-0.7.0/src/FedModelKit/templates/images/datasetPartition0.png +0 -0
  20. fedmodelkit-0.7.0/src/FedModelKit/templates/images/datasetPartition1.png +0 -0
  21. fedmodelkit-0.7.0/src/FedModelKit/templates/images/do1CreatesSyftDataset.png +0 -0
  22. fedmodelkit-0.7.0/src/FedModelKit/templates/images/do1LogsInDatasite.png +0 -0
  23. fedmodelkit-0.7.0/src/FedModelKit/templates/images/do1LogsInSyftBoxDatasite.png +0 -0
  24. fedmodelkit-0.7.0/src/FedModelKit/templates/images/do1ReviewsJob.png +0 -0
  25. fedmodelkit-0.7.0/src/FedModelKit/templates/images/do2CreatesSyftADataset.png +0 -0
  26. fedmodelkit-0.7.0/src/FedModelKit/templates/images/do2LogsInDatasite.png +0 -0
  27. fedmodelkit-0.7.0/src/FedModelKit/templates/images/do2LogsInSyftBoxDatasite.png +0 -0
  28. fedmodelkit-0.7.0/src/FedModelKit/templates/images/do2ReviewsJob.png +0 -0
  29. fedmodelkit-0.7.0/src/FedModelKit/templates/images/doWaitsForJobs.png +0 -0
  30. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsAggregatedWeights.png +0 -0
  31. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsBootstrapping.png +0 -0
  32. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsExploresDOsDatasets.png +0 -0
  33. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsLogsInAsGuests.png +0 -0
  34. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsPreparesSyftFlwrProject.png +0 -0
  35. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsRunsSyftFLWRSimulation.png +0 -0
  36. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsSimulationLogs.png +0 -0
  37. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsSubmitsJobs.png +0 -0
  38. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsSyftFlwrProjectArch.png +0 -0
  39. fedmodelkit-0.7.0/src/FedModelKit/templates/images/dsWaitsForJobsToBeApproved.png +0 -0
  40. fedmodelkit-0.7.0/src/FedModelKit/templates/images/fltraining.gif +0 -0
  41. fedmodelkit-0.7.0/src/FedModelKit/templates/images/fltraining.mp4 +0 -0
  42. fedmodelkit-0.7.0/src/FedModelKit/templates/images/localSyftBoxNetwork.png +0 -0
  43. fedmodelkit-0.6.7/src/FedModelKit/templates/pyproject_template.toml → fedmodelkit-0.7.0/src/FedModelKit/templates/pyproject.toml +6 -8
  44. fedmodelkit-0.7.0/src/FedModelKit/templates/readme.md +153 -0
  45. fedmodelkit-0.6.7/src/FedModelKit/templates/server_app_template.py → fedmodelkit-0.7.0/src/FedModelKit/templates/server_app.py +41 -5
  46. fedmodelkit-0.6.7/src/FedModelKit/templates/task_template.py → fedmodelkit-0.7.0/src/FedModelKit/templates/task.py +4 -4
  47. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/templates.py +26 -27
  48. fedmodelkit-0.7.0/uv.lock +2923 -0
  49. fedmodelkit-0.6.7/.python-version +0 -1
  50. fedmodelkit-0.6.7/PKG-INFO +0 -283
  51. fedmodelkit-0.6.7/README.md +0 -263
  52. fedmodelkit-0.6.7/examples/simulation-scikit-model/.gitignore +0 -6
  53. fedmodelkit-0.6.7/examples/simulation-scikit-model/AML_preprocessed_dataset.xlsx +0 -0
  54. fedmodelkit-0.6.7/examples/simulation-scikit-model/README.md +0 -29
  55. fedmodelkit-0.6.7/examples/simulation-scikit-model/simulation_example.ipynb +0 -666
  56. fedmodelkit-0.6.7/pyproject.toml +0 -32
  57. fedmodelkit-0.6.7/src/FedModelKit/README.md +0 -25
  58. fedmodelkit-0.6.7/src/FedModelKit/__init__.py +0 -17
  59. fedmodelkit-0.6.7/src/FedModelKit/default_create_functions.py +0 -114
  60. fedmodelkit-0.6.7/src/FedModelKit/interface.py +0 -130
  61. fedmodelkit-0.6.7/src/FedModelKit/src/utils.py +0 -65
  62. fedmodelkit-0.6.7/src/FedModelKit/templates/ds_template.ipynb +0 -332
  63. fedmodelkit-0.6.7/src/FedModelKit/templates/images/doWaitsForJobs.png +0 -0
  64. fedmodelkit-0.6.7/src/FedModelKit/templates/main_template.py +0 -27
  65. fedmodelkit-0.6.7/src/FedModelKit/templates/readme_template.md +0 -48
  66. fedmodelkit-0.6.7/src/FedModelKit/templates/uv_template.lock +0 -2812
  67. fedmodelkit-0.6.7/uv.lock +0 -2817
  68. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/.gitignore +0 -0
  69. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/LICENSE +0 -0
  70. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/images/aggregator.png +0 -0
  71. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/images/federated_learning_model.png +0 -0
  72. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/images/local_learner.png +0 -0
  73. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/py.typed +0 -0
  74. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/templates/images/doSendModels.png +0 -0
  75. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/templates/images/dsAggregateModels.png +0 -0
  76. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/templates/images/dsDoneSubmittingJobs.png +0 -0
  77. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/templates/images/dsSendsJobs.png +0 -0
  78. {fedmodelkit-0.6.7 → fedmodelkit-0.7.0}/src/FedModelKit/templates/images/overview.png +0 -0
  79. /fedmodelkit-0.6.7/src/FedModelKit/templates/__init__template.py → /fedmodelkit-0.7.0/src/FedModelKit/templates/init.py +0 -0
@@ -0,0 +1 @@
1
+ 3.12.7
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: FedModelKit
3
+ Version: 0.7.0
4
+ Summary: Tools to scaffold and run privacy-preserving federated learning experiments across distributed data sites.
5
+ Author-email: ceresale <alessandro.ceresi@upm.es>
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: flwr-datasets>=0.5.0
9
+ Requires-Dist: flwr[simulation]>=1.17.0
10
+ Requires-Dist: mlflow>=3.1.1
11
+ Requires-Dist: pandas>=2.3.0
12
+ Provides-Extra: edge
13
+ Description-Content-Type: text/markdown
14
+
15
+ # 🌐 FedModelKit (fmk)
16
+
17
+ **FedModelKit** is a Python library designed to streamline the execution of **federated learning tasks** within a network of collaborating partners.
18
+ It provides a guided workflow that helps users quickly set up experiments, manage dependencies, and follow step-by-step instructions through generated resources.
19
+
20
+ ---
21
+
22
+ ## 📑 Table of Contents
23
+ - [Overview](#-overview)
24
+ - [Features](#-features)
25
+ - [Dependencies](#-Dependencies)
26
+ - [Installation](#-installation)
27
+ - [Quick Start](#-quick-start)
28
+ - [Next Steps](#-next-steps)
29
+
30
+ ---
31
+
32
+ ## 🔎 Overview
33
+
34
+ Federated learning enables multiple partners to train machine learning models collaboratively **without sharing raw data**.
35
+ The **FedModelKit** library simplifies this process by:
36
+
37
+ - Automating project initialization
38
+ - Creating a reproducible experiment directory with all required dependencies
39
+ - Offering a clear, step-by-step workflow to run experiments in a federated network
40
+
41
+ ---
42
+
43
+ ## 🧩 Dependencies
44
+
45
+ These are the dependencies of the packages, including the required Python version:
46
+
47
+ | Dependency | Version | Description |
48
+ |-------------------|------------|--------------------------------------------------|
49
+ | **Python** | >=3.13 | Required Python interpreter version |
50
+ | `flwr[simulations]` | ==1.17.0 | Federated learning framework and simulations with Flower |
51
+ | `flwr_datasets` | >=0.5.0 | Datasets compatible with Flower |
52
+ | `mlflow` | >=3.1.1 | For experiment tracking and logging |
53
+ | `pandas` | >=2.3.0 | Data manipulation and analysis |
54
+
55
+
56
+ ---
57
+
58
+ ## ⚙️ Installation
59
+
60
+ It is recommended to install `FedModelKit` inside a virtual environment.
61
+ We suggest using [uv](https://github.com/astral-sh/uv) for fast and reproducible setups:
62
+
63
+
64
+ 1. Create and activate a virtual environment
65
+ ```bash
66
+ uv venv
67
+ source .venv/bin/activate
68
+ ```
69
+ or in case of Windows OS
70
+ ```bash
71
+ uv venv
72
+ .venv\Scripts\activate
73
+ ```
74
+
75
+ 2. Install `FedModelKit`
76
+ ```bash
77
+ uv pip install FedModelKit
78
+
79
+ ```
80
+
81
+ ## 🚀 Quick Start
82
+
83
+ Initialize a new federated learning experiment with:
84
+
85
+ ```bash
86
+ fmk init -n my_experiment
87
+
88
+ ```
89
+ This will generate in the present directory the project for a new FL experiment.
90
+
91
+ ## 📖 Next Steps
92
+
93
+ 👉 Once the experiment directory has been created, open the file `README.md` that has been generated in your directory and follow the guided workflow to set up and run your federated learning tasks.
@@ -0,0 +1,79 @@
1
+ # 🌐 FedModelKit (fmk)
2
+
3
+ **FedModelKit** is a Python library designed to streamline the execution of **federated learning tasks** within a network of collaborating partners.
4
+ It provides a guided workflow that helps users quickly set up experiments, manage dependencies, and follow step-by-step instructions through generated resources.
5
+
6
+ ---
7
+
8
+ ## 📑 Table of Contents
9
+ - [Overview](#-overview)
10
+ - [Features](#-features)
11
+ - [Dependencies](#-Dependencies)
12
+ - [Installation](#-installation)
13
+ - [Quick Start](#-quick-start)
14
+ - [Next Steps](#-next-steps)
15
+
16
+ ---
17
+
18
+ ## 🔎 Overview
19
+
20
+ Federated learning enables multiple partners to train machine learning models collaboratively **without sharing raw data**.
21
+ The **FedModelKit** library simplifies this process by:
22
+
23
+ - Automating project initialization
24
+ - Creating a reproducible experiment directory with all required dependencies
25
+ - Offering a clear, step-by-step workflow to run experiments in a federated network
26
+
27
+ ---
28
+
29
+ ## 🧩 Dependencies
30
+
31
+ These are the dependencies of the packages, including the required Python version:
32
+
33
+ | Dependency | Version | Description |
34
+ |-------------------|------------|--------------------------------------------------|
35
+ | **Python** | >=3.13 | Required Python interpreter version |
36
+ | `flwr[simulations]` | ==1.17.0 | Federated learning framework and simulations with Flower |
37
+ | `flwr_datasets` | >=0.5.0 | Datasets compatible with Flower |
38
+ | `mlflow` | >=3.1.1 | For experiment tracking and logging |
39
+ | `pandas` | >=2.3.0 | Data manipulation and analysis |
40
+
41
+
42
+ ---
43
+
44
+ ## ⚙️ Installation
45
+
46
+ It is recommended to install `FedModelKit` inside a virtual environment.
47
+ We suggest using [uv](https://github.com/astral-sh/uv) for fast and reproducible setups:
48
+
49
+
50
+ 1. Create and activate a virtual environment
51
+ ```bash
52
+ uv venv
53
+ source .venv/bin/activate
54
+ ```
55
+ or in case of Windows OS
56
+ ```bash
57
+ uv venv
58
+ .venv\Scripts\activate
59
+ ```
60
+
61
+ 2. Install `FedModelKit`
62
+ ```bash
63
+ uv pip install FedModelKit
64
+
65
+ ```
66
+
67
+ ## 🚀 Quick Start
68
+
69
+ Initialize a new federated learning experiment with:
70
+
71
+ ```bash
72
+ fmk init -n my_experiment
73
+
74
+ ```
75
+ This will generate in the present directory the project for a new FL experiment.
76
+
77
+ ## 📖 Next Steps
78
+
79
+ 👉 Once the experiment directory has been created, open the file `README.md` that has been generated in your directory and follow the guided workflow to set up and run your federated learning tasks.
@@ -0,0 +1,26 @@
1
+ [project]
2
+ name = "FedModelKit"
3
+ version = "0.7.0"
4
+ description = "Tools to scaffold and run privacy-preserving federated learning experiments across distributed data sites."
5
+ readme = "README.md"
6
+ authors = [
7
+ { name = "ceresale", email = "alessandro.ceresi@upm.es" }
8
+ ]
9
+ requires-python = ">=3.12"
10
+ dependencies = [
11
+ "flwr-datasets>=0.5.0",
12
+ "flwr[simulation]>=1.17.0",
13
+ "pandas>=2.3.0",
14
+ "mlflow>=3.1.1",
15
+ ]
16
+
17
+ [build-system]
18
+ requires = ["hatchling"]
19
+ build-backend = "hatchling.build"
20
+
21
+ [project.scripts]
22
+ fmk = "FedModelKit.cli:main"
23
+
24
+ [project.optional-dependencies]
25
+ edge = [
26
+ ]
@@ -0,0 +1,19 @@
1
+ ### **Interface Directory**
2
+
3
+ 1. **`aggregator.py`**
4
+ - This file defines the `AggProtocol` protocols. The `AggProtocol` defines the methods and attributes that an aggregator must implement.
5
+
6
+ 2. **`local_learner.py`**
7
+ - This file defines the `LLProtocol` protocols. The `LLProtocol` defines the methods and attributes that a local learner must implement. This file provides the structure for implementing custom local learners.
8
+
9
+ 3. **`cli.py`**
10
+ - This file contains the `create_structure` function, which sets up the project structure for launching a FL task. It creates necessary directories and files for the workflow.
11
+
12
+ 4. **`__init__.py`**
13
+ - This script exposes the main components of the FedModelKit package for easy import.
14
+
15
+ 5. **`templates/`**
16
+ - This folder contains template scripts for generating the content of the generated directory.
17
+
18
+ 6. **`mlflow_service/`**
19
+ - This folder contains scripts that define services for model and training registry in a Mlflow server.
@@ -0,0 +1,10 @@
1
+ '''from .interface import FederatedModel, submit_fl_model'''
2
+ from .local_learner import LLProtocol
3
+ from .aggregator import AggProtocol
4
+ from .cli import create_structure
5
+ import flwr
6
+
7
+ __all__ = ["LLProtocol",
8
+ "AggProtocol",
9
+ "create_structure",
10
+ "flwr"]
@@ -29,13 +29,3 @@ class AggProtocol(Protocol):
29
29
  """
30
30
  ...
31
31
 
32
- @runtime_checkable
33
- class AggFactoryProtocol(Protocol):
34
- '''
35
- Protocol for the function creating the aggregator instance
36
- '''
37
- def __call__(self) -> AggProtocol:
38
- """
39
- Creates and returns an instance of a class conforming to AggProtocol.
40
- """
41
- ...
@@ -2,16 +2,16 @@ import os
2
2
  import sys
3
3
  import argparse
4
4
  from .templates import (
5
- get_main_template,
6
- get_task_template,
7
- get_readme_template,
8
- get_server_template,
9
- get_client_template,
10
- get_pyproject_template,
11
- get_extern_pyproject_template,
12
- get_uv_template,
13
- get_init_template,
14
- get_ds_template,
5
+ get_task,
6
+ get_readme,
7
+ get_server,
8
+ get_client,
9
+ get_pyproject,
10
+ get_extern_pyproject,
11
+ get_init,
12
+ get_ds,
13
+ get_do1,
14
+ get_do2,
15
15
  get_images,
16
16
  )
17
17
 
@@ -20,19 +20,19 @@ def create_structure(exp_name: str = "new_experiment") -> None:
20
20
 
21
21
  structure = {
22
22
  f"{exp_name}": {
23
- "main.py": get_main_template(),
24
- "pyproject.toml": get_pyproject_template(exp_name),
23
+ "pyproject.toml": get_pyproject(exp_name),
25
24
  f"{exp_name}": {
26
- "__init__.py": get_init_template(),
27
- "task.py": get_task_template(),
28
- "server_app.py": get_server_template(exp_name),
29
- "client_app.py": get_client_template(exp_name),
25
+ "__init__.py": get_init(),
26
+ "task.py": get_task(),
27
+ "server_app.py": get_server(exp_name),
28
+ "client_app.py": get_client(exp_name),
30
29
  },
31
30
  },
32
- "pyproject.toml": get_extern_pyproject_template(exp_name),
33
- "uv.lock": get_uv_template(),
34
- "README.md": get_readme_template(),
35
- "ds.ipynb": get_ds_template(exp_name),
31
+ "pyproject.toml": get_extern_pyproject(exp_name),
32
+ "README.md": get_readme(),
33
+ "ds.ipynb": get_ds(exp_name),
34
+ "do1.ipynb": get_do1(exp_name),
35
+ "do2.ipynb": get_do2(exp_name),
36
36
  }
37
37
 
38
38
 
@@ -49,13 +49,3 @@ class LLProtocol(Protocol):
49
49
  """
50
50
  ...
51
51
 
52
- @runtime_checkable
53
- class LLFactoryProtocol(Protocol):
54
- '''
55
- Protocol for the function creating the local learner instance
56
- '''
57
- def __call__(self) -> LLProtocol:
58
- """
59
- Creates and returns an instance of a class conforming to LLProtocol.
60
- """
61
- ...
@@ -0,0 +1,33 @@
1
+ """
2
+ MLflow Coordination Utilities for Federated Learning
3
+
4
+ This package provides clean, consolidated MLflow coordination utilities for federated learning
5
+ with Flower, enabling distributed logging, coordination, and monitoring that can
6
+ be easily integrated into any federated learning project.
7
+ """
8
+
9
+ from .messages import MLflowMessageType, MLflowCoordinationConfig, MLflowMetricsData, MLflowParamsData, MLflowRoundCompleteData, create_mlflow_coordination_message, extract_mlflow_coordination_config
10
+ from .server import MLflowServerCoordinator, create_coordinator_from_environment
11
+ from .client import MLflowClientLogger, MLflowClientIntegration, create_mlflow_client_integration, handle_mlflow_coordination_query, track_in_mlflow
12
+
13
+ __all__ = [
14
+ # Message types and data structures
15
+ "MLflowMessageType",
16
+ "MLflowCoordinationConfig",
17
+ "MLflowMetricsData",
18
+ "MLflowParamsData",
19
+ "MLflowRoundCompleteData",
20
+ "create_mlflow_coordination_message",
21
+ "extract_mlflow_coordination_config",
22
+
23
+ # Server-side coordination
24
+ "MLflowServerCoordinator",
25
+ "create_coordinator_from_environment",
26
+
27
+ # Client-side logging
28
+ "MLflowClientLogger",
29
+ "MLflowClientIntegration",
30
+ "create_mlflow_client_integration",
31
+ "handle_mlflow_coordination_query",
32
+ "track_in_mlflow",
33
+ ]