Thanks for your interest in contributing to fiftyone-plugins
!
If you plan to contribute a PR, please check install the pre-commit hooks before committing:
pre-commit install
You can manually lint a file if necessary like so:
# Manually run linting configured in the pre-commit hook
pre-commit run --files <file>
When developing locally, you must make your source install of this repository available to FiftyOne.
A convenient way to do that is to symlink this repository into your FiftyOne plugins directory:
cd /path/to/fiftyone-plugins
ln -s "$(pwd)" "$(fiftyone config plugins_dir)/voxelgpt"
- Follow these instructions to install Fiftyone from source
- Checkout contribution guide for Fiftyone project
- Set the
FIFTYONE_DIR
environment variable to the location where you cloned thefiftyone
repository
- Run
yarn install
- Run
yarn create-plugin <your-plugin-name>
to create a new plugin
- Run
bash install.bash
to install the dev dependencies
- Run
yarn workspace <plugin-name> dev
to compile/watch a plugin
To build a plugin with JavaScript assets (i.e. Panel, Operators, etc.) outside
of this repository, some additional configuration is required. Take a look at
voxelgpt plugin
repository for an example of configurations required for JavaScript build
externally. Mainly, your vite.config.js
will need to be similar to
vite.config.js
of
voxelgpt
plugin. Additionally, you will need to install the dependencies listed in
vite.config.js
(i.e. vite
, @vitejs/plugin-react
,
@rollup/plugin-node-resolve
, vite-plugin-externals
, etc.) as a
dev-dependencies for your JavaScript plugin project.
This project contains multiple plugins, each with its own set of tests. To
simplify the testing process, we've included a script called run_all_tests.sh
that automatically finds and runs tests in all plugin directories.
The run_tests.sh
script:
- Iterates through all subdirectories under the
./plugins
directory. - Checks each plugin for a non-empty
tests
directory. - Runs
pytest
in eachtests
directory found. - Reports test results and indicates whether all tests passed or if any failures occurred.
- Adds the
./plugins
directory to thePYTHONPATH
.
To run tests for all plugins, simply execute the script using the following command:
# ensure pytest is installed
pip install pytest
# run all the tests
bash run_tests.sh
# or run an individual plugins tests
bash run_tests.sh hello_world
You can also use pytest directly by emulating the setup in run_tests.sh
.
- Ensure you have
$FIFTYONE_PLUGINS_DIR/plugins
in yourPYTHONPATH
- Run a test file and use
pytest
as expected - eg
pytest ./plugins/hello_world/test_count_samples.py -v