-
Notifications
You must be signed in to change notification settings - Fork 57
Setup Feluda Locally for Development
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.
- Python and Git
- Ensure
uvis installed - download uv by following its official installation documentation. Feluda usesuvto manage and develop the python packages. (more information on uv)
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/Note
We merge all our code to the development branch first, so if you are interested in contributing to feluda, please make a copy of the development branch and raise a PR against it.
- Create a virtual environment
uvrecommendeds 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- Install
feludaand otherdevdependencies
uv pip install .
uv pip install ".[dev]"- Install
pre-commithooks
pre-commit install
pre-commit install --hook-type commit-msg
This sets up the feluda package, making it ready for development.
- 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.tomlTo 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.pyMore information about Operators can be found here
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. All integration tests can be found in tests/feluda_integration_tests
- Build the
image_vec_rep_resnetas 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.
- Install the built package
uv pip install dist/<file_name>.whl
- Run the integration test
uv run -m unittest tests/feluda_integration_tests/test_01_feluda_and_image_vec_rep_resnet.pyAll the unit tests can be found in tests/feluda_unit_tests
uv run -m unittest discover -s tests/feluda_unit_tests -p 'test_*.py'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_scriptTo 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