Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [Workflow Interface] Rename and Refactor WorkspaceExport into NotebookTools #1364

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"##### High Level Overview of Methodology\n",
"1. User annotates the relevant cells of the Jupyter notebook with `#| export` directive\n",
"2. We then Leverage `nbdev` functionality to export these annotated cells of Jupyter notebook into a Python script\n",
"3. Utilize OpenFL experimental workflow module `WorkspaceExport` to convert the Python script into a OpenFL workspace\n",
"3. Utilize OpenFL experimental workflow module `NotebookTools` to convert the Python script into a OpenFL workspace\n",
"4. User can utilize the experimental `fx` commands to deploy and run the federation seamlessly\n",
"\n",
"\n",
Expand Down Expand Up @@ -946,7 +946,7 @@
"The following cells convert the Jupyter notebook into a Python script and create a Template Workspace that can be utilized by Aggregator based Workflow\n",
"> NOTE: Only Notebook cells that were marked with `#| export` directive shall be included in this Python script\n",
"\n",
"We first import `WorkspaceExport` module and execute `WorkspaceExport.export()` that converts the notebook and generates the template workspace. User is required to specify: \n",
"We first import `NotebookTools` module and execute `NotebookTools.export()` that converts the notebook and generates the template workspace. User is required to specify: \n",
"1. `notebook_path`: path of the Jupyter notebook that is required to be converted\n",
"2. `output_workspace`: path where the converted workspace is stored"
]
Expand All @@ -959,9 +959,9 @@
"outputs": [],
"source": [
"import os\n",
"from openfl.experimental.workflow.workspace_export import WorkspaceExport\n",
"from openfl.experimental.workflow.notebooktools import NotebookTools\n",
"\n",
"WorkspaceExport.export(\n",
"NotebookTools.export(\n",
" notebook_path='./1001_Workspace_Creation_from_JupyterNotebook.ipynb',\n",
" output_workspace=f\"/home/{os.environ['USER']}/generated-workspace\"\n",
")"
Expand Down Expand Up @@ -1065,7 +1065,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "fed_run",
"display_name": "dir_workspace_3.10",
"language": "python",
"name": "python3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"##### High Level Overview of Methodology\n",
"1. User annotates the relevant cells of the Jupyter notebook with `#| export` directive\n",
"2. We then Leverage `nbdev` functionality to export these annotated cells of Jupyter notebook into a Python script\n",
"3. Utilize OpenFL experimental workflow module `WorkspaceExport` to convert the Python script into a OpenFL workspace\n",
"3. Utilize OpenFL experimental workflow module `NotebookTools` to convert the Python script into a OpenFL workspace\n",
"4. User can utilize the experimental `fx` commands to deploy and run the federation seamlessly\n",
"\n",
"\n",
Expand Down Expand Up @@ -340,7 +340,7 @@
"The following cells convert the Jupyter notebook into a Python script and create a Template Workspace that can be utilized by Aggregator based Workflow\n",
"> NOTE: Only Notebook cells that were marked with `#| export` directive shall be included in this Python script\n",
"\n",
"We first import `WorkspaceExport` module and execute `WorkspaceExport.export()` that converts the notebook and generates the template workspace. User is required to specify: \n",
"We first import `NotebookTools` module and execute `NotebookTools.export()` that converts the notebook and generates the template workspace. User is required to specify: \n",
"1. `notebook_path`: path of the Jupyter notebook that is required to be converted\n",
"2. `output_workspace`: path where the converted workspace is stored"
]
Expand All @@ -353,9 +353,9 @@
"outputs": [],
"source": [
"import os\n",
"from openfl.experimental.workflow.workspace_export import WorkspaceExport\n",
"from openfl.experimental.workflow.notebooktools import NotebookTools\n",
"\n",
"WorkspaceExport.export(\n",
"NotebookTools.export(\n",
" notebook_path='./TwoPartyWorkspaceCreation.ipynb',\n",
" output_workspace=f\"/home/{os.environ['USER']}/generated-workspace\"\n",
")"
Expand Down
4 changes: 2 additions & 2 deletions openfl/experimental/workflow/interface/cli/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
print_tree,
)
from openfl.experimental.workflow.interface.cli.plan import freeze_plan
from openfl.experimental.workflow.workspace_export import WorkspaceExport
from openfl.experimental.workflow.notebooktools import NotebookTools
from openfl.utilities.path_check import is_directory_traversal
from openfl.utilities.utils import rmtree
from openfl.utilities.workspace import dump_requirements_file
Expand Down Expand Up @@ -138,7 +138,7 @@ def create_(prefix, custom_template, template, notebook, template_output_dir):
+ "save your Jupyter Notebook workspace."
)

WorkspaceExport.export(
NotebookTools.export(
notebook_path=notebook,
output_workspace=template_output_dir,
)
Expand Down
8 changes: 8 additions & 0 deletions openfl/experimental/workflow/notebooktools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0


"""openfl.experimental.workflow.notebooktools package."""

from openfl.experimental.workflow.notebooktools.code_analyzer import CodeAnalyzer
from openfl.experimental.workflow.notebooktools.notebook_tools import NotebookTools
Loading