-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: new md file for how to contribute to the project
- Loading branch information
Showing
1 changed file
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
# Integrating New Workflows into the Application | ||
|
||
Users can extend the application by creating frontend components (tabs), developing backend callback functions, and writing tests. These contributions can be incorporated into the main application via GitHub. Comprehensive documentation and user guides are available on GitHub ([LINK](https://github.com/hiyama341/streptocad/tree/main/docs)), making it easier for users to contribute and enhance the platform. | ||
|
||
--- | ||
|
||
## Table of Contents | ||
|
||
- [Prerequisites](#prerequisites) | ||
- [Step-by-Step Guide](#step-by-step-guide) | ||
- [1. Create a New Callback Module](#1-create-a-new-callback-module) | ||
- [2. Create a New Tab Component](#2-create-a-new-tab-component) | ||
- [3. Update the Main Layout](#3-update-the-main-layout) | ||
- [4. Add a New Error Dialog](#4-add-a-new-error-dialog) | ||
- [5. Update the Tab Content Renderer](#5-update-the-tab-content-renderer) | ||
- [6. Register Your Callback Functions](#6-register-your-callback-functions) | ||
- [7. Write Tests](#7-write-tests) | ||
- [8. Submit Your Changes via GitHub](#8-submit-your-changes-via-github) | ||
- [Additional Resources](#additional-resources) | ||
|
||
--- | ||
|
||
## Prerequisites | ||
|
||
- **Knowledge Requirements:** | ||
- Strong coffee. | ||
- Basic understanding of Python and the Dash framework. | ||
- Familiarity with the application's structure: | ||
- `application.py` | ||
- `callbacks/` | ||
- `tabs/` directories. | ||
- **Access Requirements:** | ||
- Access to the application's GitHub repository. | ||
|
||
--- | ||
|
||
## Step-by-Step Guide | ||
|
||
### 1. Create a New Callback Module | ||
|
||
Develop the backend logic for your new workflow by creating a callback module. | ||
|
||
- **File:** `callbacks/workflow_6.py` | ||
- **Content:** | ||
|
||
```python | ||
def your_callback_function(...): # Your callback implementation here | ||
``` | ||
|
||
- **Import the Callback in `application.py`:** | ||
|
||
```python | ||
from callbacks.workflow_6 import register_workflow_6_callbacks | ||
``` | ||
|
||
### 2. Create a New Tab Component | ||
|
||
Design the frontend layout for your workflow by creating a new tab component. | ||
|
||
- **File:** `tabs/workflow_6_tab.py` | ||
- **Content:** | ||
|
||
```python | ||
import dash_core_components as dcc | ||
import dash_html_components as html | ||
|
||
workflow_6_tab = html.Div([ | ||
|
||
# Your tab layout goes here | ||
|
||
]) | ||
``` | ||
|
||
- **Import the Tab in `application.py`:** | ||
|
||
```python | ||
from tabs.workflow_6_tab import workflow_6_tab | ||
``` | ||
|
||
### 3. Update the Main Layout | ||
|
||
Add your new tab to the application's main layout. | ||
|
||
- **File:** `application.py` | ||
- **Modification:** | ||
|
||
```python | ||
main_layout = html.Div([ | ||
dcc.Tabs(id='tabs', value='workflow_1', children=[ | ||
|
||
# Existing tabs... | ||
|
||
dcc.Tab(label='Workflow 6', value='workflow_6'), | ||
]), | ||
html.Div(id='tab-content') | ||
]) | ||
``` | ||
|
||
### 4. Add a New Error Dialog | ||
|
||
Include an error dialog specific to your workflow to handle exceptions gracefully. | ||
|
||
- **File:** `application.py` | ||
- **Addition:** | ||
|
||
```python | ||
dcc.ConfirmDialog( | ||
id='error-dialog_6', | ||
message="" | ||
), | ||
``` | ||
|
||
### 5. Update the Tab Content Renderer | ||
|
||
Modify the callback that renders the content of each tab to include your new workflow. | ||
|
||
- **File:** `application.py` | ||
- **Modification:** | ||
|
||
```python | ||
@app.callback(Output('tab-content', 'children'), [Input('tabs', 'value')]) | ||
def render_tab_content(tab): | ||
if tab == "workflow_1": | ||
return workflow_1_tab # ... other workflows ... | ||
elif tab == "workflow_6": | ||
return workflow_6_tab | ||
``` | ||
|
||
### 6. Register Your Callback Functions | ||
|
||
Ensure that your callback functions are registered with the app. | ||
|
||
- **File:** `application.py` | ||
- **Addition at the End of the File:** | ||
|
||
```python | ||
register_workflow_6_callbacks(app) | ||
``` | ||
|
||
### 7. Write Tests | ||
|
||
Develop tests for your new workflow to validate functionality and prevent future regressions. | ||
|
||
- **Suggested Location:** `tests/test_workflow_6.py` | ||
- **Content:** | ||
|
||
```python | ||
import unittest | ||
|
||
class TestWorkflow6(unittest.TestCase): | ||
def test_something(self): # Your test cases here | ||
``` | ||
|
||
### 8. Submit Your Changes via GitHub | ||
|
||
- **Commit Changes:** | ||
- Commit your changes to a new branch in your forked repository. | ||
- **Open a Pull Request:** | ||
- Submit a pull request to the main repository for review. | ||
|
||
--- | ||
|
||
## Additional Resources | ||
|
||
- **Documentation and User Guides:** Available on GitHub at [LINK](https://github.com/hiyama341/streptocad/tree/main/docs). | ||
- **Support:** | ||
- If you encounter issues, please open an issue on GitHub. | ||
- Contact the development team for further assistance. | ||
|
||
--- | ||
|
||
By following these steps, you contribute to enhancing the platform, making it more versatile for all users. Thank you for your valuable contribution! |