This guide explains how to set up a development environment, install dependencies, and get started with contributing to the NDIF project.
- Python 3.10
- Docker
- Docker Compose
If you don’t have Conda installed, download and install Anaconda or Miniconda from the official Conda website.
Fork the NDIF repository (or clone it directly) to your local machine. Then create a new Conda virtual environment:
conda create -n ndif-dev python=3.10
conda activate ndif-devChoose one of the following methods:
a. Via pip (simple)
pip install nnsight
b. From repository (recommended for specific branches)
git clone https://github.com/nnsight/nnsight.git
cd nnsight
git checkout <branch-name> # e.g., 0.3
pip install -e .For first-time setup, use:
make buildIf you’ve made changes to the codebase but did not modify the environment.yml files, you can quickly rebuild the services using:
make taThis method is faster than running make build again.
After building the NDIF containers, you can check the docker logs to verify the services are running correctly.
docker logs dev-api-1You should expect to see a message like Application startup complete. in the api service log.
python scripts/test.pyFor more comprehensive testing, install pytest
Navigate to the service you wish to test
cd src/services/api
pytestThis will send a test NNsight request to the API service running in the local container.
- To start the deployment environment without rebuilding:
make up- To stop the development environment:
make down- To rebuild services and restart the environment (useful during development):
make taNote: Modifying any of the environment.yml files will require you to rebuild from scratch.
The project uses separate .env files for development and production environments:
- Development:
compose/dev/.env - Production:
compose/prod/.env
For most users, only the development environment is necessary. The production environment is configured separately and is not required for local development.
The Makefile includes configurations for both development and production environments. As an end user or developer, you'll primarily interact with the development environment. The production environment settings are managed separately and are not typically needed for local development work.