Skip to content

Commit 16aff0d

Browse files
committed
chore: init
1 parent 1cc3453 commit 16aff0d

File tree

13 files changed

+4707
-18
lines changed

13 files changed

+4707
-18
lines changed

README.md

Lines changed: 234 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,240 @@
1-
# aloha-template
1+
## FiftyOne Plugin Examples 🔌🚀
22

3-
<!-- markdownlint-disable no-inline-html line-length -->
4-
<div align="center">
5-
<p align="center">
3+
FiftyOne provides a powerful
4+
[plugin framework](https://docs.voxel51.com/plugins/index.html) that allows for
5+
extending and customizing the functionality of the tool.
66

7-
<img src="https://user-images.githubusercontent.com/25985824/106288517-2422e000-6216-11eb-871d-26ad2e7b1e59.png" height="55px" alt="Voxel51 logo"> &nbsp;
8-
<img src="https://user-images.githubusercontent.com/25985824/106288518-24bb7680-6216-11eb-8f10-60052c519586.png" height="50px" alt="FiftyOne logo">
7+
With plugins, you can add new functionality to the FiftyOne App, create
8+
integrations with other tools and APIs, render custom panels, and add custom
9+
buttons to menus.
910

10-
</p>
11-
</div>
12-
<!-- markdownlint-enable no-inline-html line-length -->
11+
With
12+
[FiftyOne Teams](https://docs.voxel51.com/teams/teams_plugins.html#delegated-operations),
13+
you can even write plugins that allow users to execute long-running tasks from
14+
within the App that run on a connected compute cluster.
1315

14-
---
16+
This repository contains a comprehensive collection of **FiftyOne Plugin Examples**
17+
designed to inspire and educate you on how to build your own plugins. Each example
18+
demonstrates different aspects of the plugin system and serves as a learning resource
19+
for developers looking to extend FiftyOne's functionality.
1520

16-
Aloha Team Template. Files in this repository include:
21+
For example, here's a taste of what you can build with the plugin framework!
1722

18-
1. .github/CODEOWNERS
19-
1. .github/pull_request_template.md
20-
1. .github/workflows/pre-commit.yml
21-
1. .markdownlint.yaml
22-
1. .pre-commit-config.yaml
23-
1. .tool-versions
24-
1. Makefile
23+
https://github.com/voxel51/fiftyone-plugins/assets/25985824/128d9fbd-9835-49e8-bbb9-93ea5093871f
24+
25+
## Table of Contents
26+
27+
This repository contains a curated collection of
28+
[FiftyOne Plugin Examples](https://docs.voxel51.com/plugins/index.html), organized into
29+
the following categories:
30+
31+
- [Core Examples](#core-examples): fundamental examples that demonstrate essential plugin concepts and patterns
32+
- [Operator Examples](#operator-examples): examples showing how to build custom operators and operations
33+
- [Panel Examples](#panel-examples): examples demonstrating how to create custom panels and visualizations
34+
- [Integration Examples](#integration-examples): examples showing how to integrate with external tools and APIs
35+
- [Advanced Examples](#advanced-examples): complex examples showcasing advanced plugin capabilities
36+
37+
## Core Examples
38+
39+
<table>
40+
<tr>
41+
<th>Name</th>
42+
<th>Description</th>
43+
</tr>
44+
<tr>
45+
<td><b><a href="plugins/skeleton">skeleton</a></b></td>
46+
<td>🦴 A minimal plugin template showing the basic structure and components needed to get started</td>
47+
</tr>
48+
<tr>
49+
<td><b><a href="plugins/hello-world">hello-world</a></b></td>
50+
<td>👋 A simple example that contains both Python and JavaScript components to demonstrate cross-language plugin development</td>
51+
</tr>
52+
<tr>
53+
<td><b><a href="plugins/basic-operator">basic-operator</a></b></td>
54+
<td>⚙️ Learn how to create your first custom operator with input/output schemas and execution logic</td>
55+
</tr>
56+
<tr>
57+
<td><b><a href="plugins/basic-panel">basic-panel</a></b></td>
58+
<td>📊 Create your first custom panel to display data and interact with your FiftyOne datasets</td>
59+
</tr>
60+
</table>
61+
62+
## Operator Examples
63+
64+
<table>
65+
<tr>
66+
<th>Name</th>
67+
<th>Description</th>
68+
</tr>
69+
<tr>
70+
<td><b><a href="plugins/operator-examples">operator-examples</a></b></td>
71+
<td>⚙️ A comprehensive collection of example operators showing how to use the operator type system to build custom FiftyOne operations</td>
72+
</tr>
73+
<tr>
74+
<td><b><a href="plugins/data-transformation">data-transformation</a></b></td>
75+
<td>🔄 Examples of operators that transform and manipulate dataset fields and metadata</td>
76+
</tr>
77+
<tr>
78+
<td><b><a href="plugins/external-api">external-api</a></b></td>
79+
<td>🌐 Learn how to build operators that integrate with external APIs and services</td>
80+
</tr>
81+
<tr>
82+
<td><b><a href="plugins/batch-processing">batch-processing</a></b></td>
83+
<td>📦 Examples of operators that process multiple samples efficiently</td>
84+
</tr>
85+
</table>
86+
87+
## Panel Examples
88+
89+
<table>
90+
<tr>
91+
<th>Name</th>
92+
<th>Description</th>
93+
</tr>
94+
<tr>
95+
<td><b><a href="plugins/panel-examples">panel-examples</a></b></td>
96+
<td>📊 A collection of example panels demonstrating common patterns for building Python panels</td>
97+
</tr>
98+
<tr>
99+
<td><b><a href="plugins/visualization-panels">visualization-panels</a></b></td>
100+
<td>📈 Examples of custom visualization panels using popular charting libraries</td>
101+
</tr>
102+
<tr>
103+
<td><b><a href="plugins/interactive-panels">interactive-panels</a></b></td>
104+
<td>🖱️ Learn how to build interactive panels that respond to user input and selections</td>
105+
</tr>
106+
<tr>
107+
<td><b><a href="plugins/data-exploration">data-exploration</a></b></td>
108+
<td>🔍 Examples of panels designed for exploring and analyzing dataset characteristics</td>
109+
</tr>
110+
</table>
111+
112+
## Integration Examples
113+
114+
<table>
115+
<tr>
116+
<th>Name</th>
117+
<th>Description</th>
118+
</tr>
119+
<tr>
120+
<td><b><a href="plugins/ml-framework-integration">ml-framework-integration</a></b></td>
121+
<td>🤖 Examples showing how to integrate with popular ML frameworks like PyTorch, TensorFlow, and scikit-learn</td>
122+
</tr>
123+
<tr>
124+
<td><b><a href="plugins/cloud-integration">cloud-integration</a></b></td>
125+
<td>☁️ Learn how to build plugins that work with cloud storage and compute services</td>
126+
</tr>
127+
<tr>
128+
<td><b><a href="plugins/database-integration">database-integration</a></b></td>
129+
<td>🗄️ Examples of plugins that integrate with external databases and data sources</td>
130+
</tr>
131+
<tr>
132+
<td><b><a href="plugins/annotation-integration">annotation-integration</a></b></td>
133+
<td>✏️ Learn how to integrate with annotation tools and workflows</td>
134+
</tr>
135+
</table>
136+
137+
## Advanced Examples
138+
139+
<table>
140+
<tr>
141+
<th>Name</th>
142+
<th>Description</th>
143+
</tr>
144+
<tr>
145+
<td><b><a href="plugins/delegated-operations">delegated-operations</a></b></td>
146+
<td>📡 Examples of plugins that use FiftyOne Teams delegated operations for long-running tasks</td>
147+
</tr>
148+
<tr>
149+
<td><b><a href="plugins/custom-workflows">custom-workflows</a></b></td>
150+
<td>🔄 Complex examples showing how to build multi-step workflows and pipelines</td>
151+
</tr>
152+
<tr>
153+
<td><b><a href="plugins/real-time-integration">real-time-integration</a></b></td>
154+
<td>⚡ Examples of plugins that handle real-time data streams and live updates</td>
155+
</tr>
156+
<tr>
157+
<td><b><a href="plugins/performance-optimization">performance-optimization</a></b></td>
158+
<td>🚀 Advanced examples demonstrating techniques for optimizing plugin performance</td>
159+
</tr>
160+
</table>
161+
162+
## Using Examples
163+
164+
### Install FiftyOne
165+
166+
If you haven't already, install
167+
[FiftyOne](https://github.com/voxel51/fiftyone):
168+
169+
```shell
170+
pip install fiftyone
171+
```
172+
173+
### Running examples
174+
175+
To explore these examples, you can clone this repository and run them locally:
176+
177+
```shell
178+
git clone https://github.com/voxel51/fiftyone-plugin-examples
179+
cd fiftyone-plugin-examples
180+
```
181+
182+
Each example directory contains:
183+
- A `README.md` with detailed instructions
184+
- Source code demonstrating the concept
185+
- Any necessary configuration files
186+
- Instructions for testing and running the example
187+
188+
### Example management
189+
190+
You can use the
191+
[CLI commands](https://docs.voxel51.com/cli/index.html#fiftyone-plugins) below
192+
to manage examples you've installed:
193+
194+
```shell
195+
# List all plugins you've downloaded
196+
fiftyone plugins list
197+
198+
# List the available operators and panels
199+
fiftyone operators list
200+
201+
# Disable a particular plugin
202+
fiftyone plugins disable <name>
203+
204+
# Enable a particular plugin
205+
fiftyone plugins enable <name>
206+
```
207+
208+
### Local development
209+
210+
If you plan to develop plugins locally, you can clone the repository and
211+
symlink it into your FiftyOne plugins directory like so:
212+
213+
```shell
214+
cd /path/to/fiftyone-plugin-examples
215+
ln -s "$(pwd)" "$(fiftyone config plugins_dir)/fiftyone-plugin-examples"
216+
```
217+
218+
### Contributing to this repository 🙌
219+
220+
You're also welcome to contribute to the examples that live natively in this
221+
repository. Check out the [contributions guide](CONTRIBUTING.md) for
222+
instructions.
223+
224+
## Join the Community
225+
226+
If you want join a fast-growing community of engineers, researchers, and
227+
practitioners who love computer vision, join the
228+
[FiftyOne Discord community](https://community.voxel51.com/?_gl=1*1ph47fb*_gcl_au*NjI4MTMwMzIxLjE3MzY0NTM0MDc.) 🚀🚀🚀
229+
230+
**💡 Pro tip:** the `#plugins` channel is a great place to discuss plugin development!
231+
232+
## About FiftyOne
233+
234+
If you've made it this far, we'd greatly appreciate if you'd take a moment to
235+
check out [FiftyOne](https://github.com/voxel51/fiftyone) and give us a star!
236+
237+
FiftyOne is an open source library for building high-quality datasets and
238+
computer vision models. It's the engine that powers this project.
239+
240+
Thanks for visiting! 😊

plugins/skeleton/.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Node modules
2+
node_modules/
3+
4+
__pycache__
5+
6+
# Logs
7+
logs/
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
13+
# Dependency directories
14+
jspm_packages/
15+
16+
# Optional npm cache directory
17+
.npm/
18+
.yarn/install-state.gz
19+
20+
# Optional eslint cache
21+
.eslintcache
22+
23+
# Optional REPL history
24+
.node_repl_history
25+
26+
# Output of 'npm pack'
27+
*.tgz
28+
29+
# Yarn Integrity file
30+
.yarn-integrity
31+
32+
# dotenv environment variables file
33+
.env
34+
35+
# Mac system files
36+
.DS_Store

plugins/skeleton/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

plugins/skeleton/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
This is a template for writing and building a Javascript panel plugin in FiftyOne. Once a plugin is built (as a bundled UMD file), it can be loaded into FiftyOne.
2+
3+
The three most important / notable files are described below.
4+
5+
## 1. `fiftyone.yml`
6+
7+
This file is a manifest for the plugin. It contains metadata about the plugin, such as its name, description, operators, and secrets.
8+
9+
## 2. `package.json`
10+
11+
As a Javascript plugin, this file is used to manage the dependencies of the plugin. Some notable entries in this file are:
12+
13+
a. `main`: This is the entry point of the plugin. It is the file that will be loaded when the plugin is initialized. Make sure `@fiftyone/plugins::registerComponent()` is called in this file.
14+
15+
b. `fiftyone::script`: This is a custom field that is used to specify the path to the bundled UMD script that will be loaded in the panel.
16+
17+
c. `dependencies`: If you have any FiftyOne dependencies, you'll want to use a portal to reference them. The portal should point to the path of the dependency in the local FiftyOne repository.
18+
19+
d. `devDependencies`: In addition to dependencies you may introduce, add a dev dependency on `@voxel51/fiftyone-js-plugin-build`. Also make sure to also declare the peer dependencies of the [fiftyone-js-plugin-build](https://github.com/voxel51/fiftyone-js-plugin-build) package.
20+
21+
e. `resolutions`: Also used to resolve dependency conflicts, this is usually used in this context to resolve portal references.
22+
23+
## 3. `vite.config.ts`
24+
25+
This file is used to configure the Vite build tool. It is used to bundle the plugin into a UMD script that can be loaded in the panel. The `defineConfig` function from the `fiftyone-js-plugin-build` package is used to define the Vite configuration. The `defineConfig` function takes two arguments: the directory of the plugin and an optional configuration object. The configuration object can be used to override the default Vite configuration. For example, you can use it to specify whether or not to generate sourcemaps. The `defineConfig` function returns a Vite configuration object that can be used to build the plugin. An example of how to use the `defineConfig` function is shown below:
26+
27+
```js
28+
import { defineConfig } from "@voxel51/fiftyone-js-plugin-build";
29+
import { dirname } from "path";
30+
import { fileURLToPath } from "url";
31+
32+
const __filename = fileURLToPath(import.meta.url);
33+
const __dirname = dirname(__filename);
34+
const dir = __dirname;
35+
36+
const myAdditionalVitePlugins = [
37+
// add any additional Vite plugins here
38+
];
39+
40+
export default defineConfig(dir, {
41+
buildConfigOverride: { sourcemap: true },
42+
plugins: myAdditionalVitePlugins,
43+
});
44+
```
45+
46+
## Important
47+
48+
Before running `yarn build`, make sure you have a local copy of FiftyOne and `FIFTYONE_DIR` is set to the root of the FiftyOne repository.
49+
50+
See also [Fiftyone JS Plugin Build Utils](https://github.com/voxel51/fiftyone-js-plugin-build).
51+
52+
## Troubleshooting
53+
54+
### `yarn` or `yarn install` fails
55+
56+
1. Make sure you have the right version of `yarn` in your `PATH`. You can check the version by running `yarn --version`. If you have `corepack` installed (available by default in node v16+), you'll be auto prompted to install the right version of `yarn` when you run `yarn` or `yarn install` in the plugin directory.

plugins/skeleton/dist/index.umd.js

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/skeleton/dist/index.umd.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/skeleton/fiftyone.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: "@voxel51/hello-world"
2+
description: An example of a simple FiftyOne Javascript plugin
3+
version: 1.0.0
4+
fiftyone:
5+
version: "*"
6+
url: https://github.com/voxel51/hello-world-plugin-js
7+
license: Apache 2.0
8+
operators:
9+
- show_alert

0 commit comments

Comments
 (0)