Skip to content

Commit f11dce1

Browse files
authored
Updated CONTRIBUTING.md (#2471)
1 parent 51f39fa commit f11dce1

File tree

4 files changed

+153
-24
lines changed

4 files changed

+153
-24
lines changed

.github/workflows/ci_plugins.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Plugin Testing
22

33
on:
44
pull_request:

.github/workflows/release_plugins.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release in Pypi/DockerHub
1+
name: Release plugins
22
on:
33
push:
44
branches:

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3636
- Fix the conflict of the same identifier during encoding.
3737
- Fix the issue where MongoDB did not create the output table.
3838
- Fix the bug in the CI where plugins are skipping tests.
39+
- Updated CONTRIBUTING.md
3940

4041
#### New Features & Functionality
4142

CONTRIBUTING.md

+150-22
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,23 @@ Install the dependencies:
4343

4444
```shell
4545
# Install pip-tools and latest version of pip
46-
python3 -m pip install --upgrade pip-tools
46+
pip install --upgrade pip-tools
4747

48-
# Install the superduper project in editable mode along with the developer tools
49-
python3 -m pip install -e '.'
50-
python3 -m pip install -r deploy/installations/testenv_requirements.txt
51-
make install_devkit
48+
# Install the SuperDuper project in editable mode, along with the necessary developer tools.
49+
pip install -e '.[test]'
5250
```
5351

54-
(Optional) build the docker development environment:
55-
52+
Install the required plugins for your development environment.
5653
```shell
57-
make build_sandbox
54+
# The mongodb plugin is required for the tests (nosql)
55+
pip install -e 'plugins/mongodb[test]'
56+
# The ibis and sqlalchemy plugins are required for the tests (sql)
57+
pip install -e 'plugins/ibis[test]'
58+
pip install -e 'plugins/sqlalchemy[test]'
5859
```
5960

61+
You can install any additional plugins needed for your development environment.
62+
6063
## Branch workflow
6164

6265
We follow something called a "fork and pull request" workflow for collaborating on our project. See [here](https://gist.github.com/Chaser324/ce0505fbed06b947d962) for a great overview on what some of these mysterious terms mean!
@@ -74,30 +77,128 @@ make unit_testing
7477

7578
### Extension integration tests
7679

77-
These tests that package integrations, such as `sklearn` or `openai`
78-
work properly.
80+
We use specific use cases to test the entire system.
7981

8082
```shell
81-
make ext_testing
83+
make usecase_testing
8284
```
8385

84-
### Databackend integration tests
86+
### Plugin tests
8587

86-
These tests check that data-backend integrations such as MongoDB or SQLite
87-
work as expected.
88+
We maintain a set of plugins that are tested independently.. If you change the plugin code, you can run the tests for that plugin.
8889

8990
```shell
90-
make databackend_testing
91+
export PYTHONPATH=./
92+
# Install the plugin you want to test
93+
pip install -e 'plugins/<PLUGIN_NAME>[test]'
94+
# Run the tests
95+
pytest plugins/<PLUGIN_NAME>/plugin_test
9196
```
9297

93-
### Smoke tests of cluster mode
9498

95-
These tests check that cluster mode works as expected (`ray`, `vector-search`, `cdc`, `rest`):
99+
## Lint and type-check the code
96100

97-
```shell
98-
make smoke_testing
101+
We use `black` for code formatting, `run` for linting, and `mypy` for type-checking.
102+
103+
You can run the following commands to check the code:
104+
105+
```
106+
make lint-and-type-check
107+
```
108+
109+
If you want to format the code, you can run the following command:
110+
```
111+
make fix-and-check
112+
```
113+
114+
## Contributing to new plugins and templates
115+
116+
The `superduper` project is designed to be extensible and customizable. You can create new plugins and templates to extend the functionality of the project.
117+
118+
### Create a new plugin
119+
120+
Plugins are Python packages that extend the functionality of the SuperDuper project.
121+
More details about the plugins can be found in the documentation:
122+
123+
- [Data plugins](https://docs.superduper.io/docs/data_plugins/intro)
124+
- [AI plugins](https://docs.superduper.io/docs/category/ai-plugins)
125+
126+
If you want to create a new plugin, you can follow the steps below:
127+
128+
1. Copy `plugins/template` to `plugins/<PLUGIN_NAME>`
129+
2. Modify the name of the plugin in the following names:
130+
- Plugin name in `pyproject.toml`
131+
- Package name `superduper_<PLUGIN_NAME>`
132+
3. Write the code for the plugin
133+
4. Create the tests directory `plugin_test/` and write the tests
134+
5. Modify the `__version__` in the `superduper_<PLUGIN_NAME>/__init__.py` file. We use this version for releasing the plugin.
135+
136+
We follow x.y.z versioning for the plugins, where the x.y version matches the superduper x.y version.
137+
138+
We increment the z version for new releases and increment the x.y version for major releases.
139+
140+
### Create a new template
141+
142+
Templates are reusable components that facilitate the quick and easy building of AI applications.
143+
More details about the templates can be found in the documentation:
144+
145+
- [Templates](https://docs.superduper.io/docs/category/templates)
146+
147+
If you want to create a new template, you can follow the steps below:
148+
149+
1. Create a new directory in `templates/<TEMPLATE_NAME>`
150+
2. Create a `build.ipynb` file with the code to build the template
151+
1. Present the build process in a Jupyter notebook
152+
2. Package all the components into the application
153+
3. Build a template from the application
154+
4. Export the template using `template.export('.')`, and then you can get `component.json` in the directory
155+
156+
## Contributing to the documentation
157+
We maintain the documentation in the [superduper-docs](https://github.com/superduper-io/superduper-docs) repository.
158+
159+
160+
Please go to the repository and create a pull request with the changes you want to make.
161+
162+
### Fork and clone the repository
163+
164+
```
165+
git clone [email protected]:<FORKED_NAME>/superduper-docs.git
166+
cd superduper-docs
99167
```
100168

169+
### Updating the documentation
170+
171+
For most document updates and additions, you can directly modify the files under `superduper-docs/content`.
172+
173+
But there are some special cases:
174+
175+
- Plugin documentation
176+
- Template documentation
177+
178+
**Creating of updating documentation for a plugin**
179+
180+
After you create or update a plugin, you need to update the documentation.
181+
182+
1. Update the `README.md` file in the plugin directory.
183+
2. Copy the file to the `superduper-docs/content/plugins` directory and change the file name to `<PLUGIN_NAME>.md`.
184+
185+
**Creating of updating documentation for a template**
186+
187+
After you create or update a template, you need to update the documentation.
188+
189+
We can use the `to_docusaurus_markdown.py` script to convert the Jupyter notebook to the markdown file.
190+
191+
```
192+
python3 to_docusaurus_markdown.py <Your superduper project path>/templates/<TEMPLATE_NAME>/build.ipynb
193+
```
194+
195+
Then a new markdown file `<Your superduper project path>/templates/<TEMPLATE_NAME>/build.md`.
196+
197+
You can copy the file to the `superduper-docs/content/templates` directory and change the file name to `<TEMPLATE_NAME>.md`.
198+
199+
200+
201+
101202
## Create an issue
102203

103204
If you have an unsolvable problem or find a bug with the code, we
@@ -113,10 +214,37 @@ Creating a useful issue, is itself a useful skill. Think about following these p
113214
- To flag the issue to the team, escalate this in the Slack channels
114215
- Tag relevant people who have worked on that issue, or know the feature
115216

217+
## CI workflow
218+
219+
We have two ci workflows that run on the pull requests:
220+
221+
- Code Testing: Unittests, Extension Integration Tests. The code testing is run on every pull request.
222+
- Plugin Testing: Plugin tests. The plugin testing only runs on the pull requests that change the plugin code.
223+
224+
Additionally, we have a plugin release workflow that runs on the main branch. The plugin release workflow will release the plugins to the PyPI.
225+
226+
### Code Testing
227+
228+
1. Lint and type-check
229+
2. Unit Testing, will run the unittests with mongodb and sqlite
230+
3. Usecase Testing, will run the usecases with mongodb and sqlite
231+
232+
### Plugin Testing
233+
234+
The plugin use matrix testing to test the plugins which are changed in the pull request.
235+
236+
1. Lint and type-check
237+
2. Run `plugins/<PLUGIN_NAME>/plugin_test`
238+
3. Run the base testing(Optional): If the config file `plugins/<PLUGIN_NAME>/plugin_test/config.yaml` exists, the unittests and usecases will be run with the plugin.
239+
240+
### Release plugins on PyPI
241+
242+
The workflow detects commit messages like `[PLUGINS] Bump Version [plugin_1 | plugin_2]` and releases the corresponding plugins to PyPI.
243+
116244
## Getting Help 🙋
117245

118-
[![Slack](https://img.shields.io/badge/Slack-superduperdb-8A2BE2?logo=slack)](https://join.slack.com/t/superduper-public/shared_invite/zt-1yodhtx8y-KxzECued5QBtT6JFnsSNrQ)
119-
[![Issues](https://img.shields.io/badge/Issues-superduperdb-8A2BE2?logo=github)](https://github.com/superduper-io/superduper-stealth/issues)
120-
[![Wiki](https://img.shields.io/badge/Project%20Wiki-superduperdb-8A2BE2?logo=github)](https://github.com/superduper-io/superduper-stealth/wiki)
246+
[![Slack](https://img.shields.io/badge/Slack-superduper-8A2BE2?logo=slack)](https://join.slack.com/t/superduper-public/shared_invite/zt-1yodhtx8y-KxzECued5QBtT6JFnsSNrQ)
247+
[![Issues](https://img.shields.io/badge/Issues-superduper-8A2BE2?logo=github)](https://github.com/superduper-io/superduper/issues)
248+
[![Wiki](https://img.shields.io/badge/Project%20Wiki-superduper-8A2BE2?logo=github)](https://github.com/superduper-io/superduper/wiki)
121249

122250
If you have any problems please contact a maintainer or community volunteer. The GitHub issues or the Slack channel are a great place to start. We look forward to seeing you there! :purple_heart:

0 commit comments

Comments
 (0)