Skip to content

Setup Feluda Locally for Development

Aatman Vaidya edited this page Jan 12, 2025 · 21 revisions

With the release of Feluda v0.0.9, it is now available as a Python package, and some operators have been separated into standalone Python packages. This update simplifies Feluda's use for developers and researchers. This documentation provides instructions on setting up Feluda for contributing to the python packages.

Important

If you are looking to setup an older version of Feluda i.e. v0.0.8 and before, follow this page for the detailed documentation.

Step 0 - Prerequisites

Step 1 - Cloning the Repository

First step is to clone the repo. You can also fork and clone the repo

git clone https://github.com/tattle-made/feluda.git
cd feluda/

Step 2 - Installing Feluda Package and Other Development Dependencies

  1. Create a virtual environment uv recommendeds that all python packages be installed in a virtual environment. Generally, it is considered a good practice not to modify a Python system installation's environment.
uv venv
source .venv/bin/activate
  1. Install feluda and other dev dependencies
# install core feluda dependencies
uv pip install .
# install dev dependencies
uv pip install ".[dev]"
  1. Install pre-commit hooks
pre-commit install
pre-commit install --hook-type commit-msg

This sets up the feluda package, making it ready for development.

Step 3 - Installing Dependencies for Operator's

  • To use the python packages of the operators install the required dependencies for them.
  • You will need to install the dependencies separately for each operator you wish to use/develop.

Below is an example of installing dependencies for a single operator. Let's say we wish to install dependencies for the image-vec-rep-resnet operator. Each operator folder has its own pyproject.toml files. (Make sure that virtual environment is actiavted)

uv pip install -r operators/image_vec_rep_resnet/pyproject.toml

Running the Test for the Operator

To properly check if the operator has been installed and working properly, you can run the test for the operator.

uv run -m unittest operators/image_vec_rep_resnet/test.py

More information about Operators can be found here


💻 Feluda and its Operators are now successfully setup locally for development.


Step 4 - Running Integration Tests

This is an optional test, but if you wish to see feluda and its operators in action, then an integration test is an ideal way to do that. Below is an example on running the integration test for feluda and the image_vec_rep_resnet operator

  1. Build the image_vec_rep_resnet as a binary distribution
uv build --wheel operators/image_vec_rep_resnet/

This will create a build .whl file in the dist/ folder in root of the codebase.

  1. Install the built package
uv pip install dist/<file_name>.whl
  1. Run the integration test
uv run -m unittest tests/feluda_integration_tests/test_01_feluda_and_image_vec_rep_resnet.py

Updating Dependencies for Feluda and its Operators

To update the dependencies we have written a custom script that automatically updates each dependency version for all python packages.

# update lock file
uv lock --upgrade
# run the script from root
uv run -m scripts.toml_dependencies_update_script

To upgrade a single package to the latest version, while retaining the locked versions of all other packages:

uv lock --upgrade-package <package>
# OR
uv lock --upgrade-package <package>==<version>

# then run the script from root
uv run -m scripts.toml_dependencies_update_script