Thank you for your interest in contributing to Neurevo. This document covers everything you need to get started, whether you are fixing a bug, adding a new organism, or building new analysis tools.
- Fork the repository and clone your fork:
git clone https://github.com/<your-username>/creatures.git
cd creatures- Set up the development environment:
make setup # Creates Python venv, installs dependencies, compiles Cython, runs npm install- Run the full test suite to verify everything works:
make test # 291 tests across creatures-core and creatures-web- Create a feature branch from
main:
git checkout -b feature/your-feature-name-
Make your changes, following the coding standards below.
-
Run tests and ensure they pass:
# Full Python test suite (291 tests)
PYTHONPATH="creatures-core:creatures-api" .venv/bin/python -m pytest creatures-core/tests/ -v
# Frontend type check and tests
cd creatures-web && npx tsc --noEmit && npm test- Commit your changes with a clear message:
git commit -m "Add description of what changed and why"- Push to your fork and open a pull request against
main.
| Directory | Language | Purpose |
|---|---|---|
creatures-core/ |
Python | Core library: connectome loaders (OpenWorm, FlyWire), Brian2 neural engine, MuJoCo bodies (WormBody, NeuroMechFly), NEAT evolution, pharmacology, ecosystem, circuit analysis, God Agent |
creatures-api/ |
Python | FastAPI server with 122+ REST + WebSocket endpoints across 12 router modules |
creatures-web/ |
TypeScript | React 18 + Three.js frontend: 3D bodies, spike particles, neuron detail panel, dose-response charts, narrative feed, ecosystem view |
scripts/ |
Python | CLI tools for evolution, validation, and reporting |
notebooks/ |
Jupyter | Interactive demos and exploration |
| Organism | Neurons | Source | Body Model |
|---|---|---|---|
| C. elegans | 299 | OpenWorm / Cook et al. 2019 | WormBody (12-segment MuJoCo) |
| Drosophila | 500 | FlyWire v783 / Dorkenwald et al. 2024 | NeuroMechFly (tripod gait MuJoCo) |
- Python 3.13+
- Follow PEP 8 style guidelines;
ruffis used for linting (all checks must pass) - Use type hints for all function signatures
- Write docstrings for public functions and classes
- Keep functions focused -- one function, one responsibility
- Add unit tests in
creatures-core/tests/for new functionality - Use
PYTHONPATH="creatures-core:creatures-api"when running tests
- TypeScript strict mode
- Use functional components with hooks
- Keep components small and composable
- Use Zustand for shared state, not prop drilling
- Run
npx tsc --noEmitbefore committing
- No committed secrets, API keys, or credentials
- Keep dependencies minimal -- justify new additions
- Write clear commit messages that explain why, not just what
To add a new organism (e.g., zebrafish), you need four things:
Create creatures-core/creatures/connectome/your_organism.py:
def load(format: str = "edge_list") -> dict:
"""Load the connectome for your organism.
Returns:
Dictionary with keys: neurons, synapses, neuron_types, metadata
"""
...Follow the patterns in openworm.py (C. elegans) and flywire.py (Drosophila). Your loader must return a dictionary with neurons (list of neuron IDs), synapses (list of (pre, post, weight) tuples), and neuron_types (mapping of neuron ID to type string).
Create creatures-core/creatures/body/your_body.py:
from creatures.body.base import BodyBase
class YourBody(BodyBase):
def __init__(self):
super().__init__(organism="your_organism")
# Load or generate MuJoCo XML
def apply_motor_output(self, motor_signals: dict) -> dict:
"""Map neural motor output to body actuators."""
...Follow the patterns in worm_body.py and neuromechfly.py.
Add your organism to the experiment runner and API so it can be selected when creating simulations. Update the organism registry in creatures-core/creatures/experiment/runner.py.
Add test files:
creatures-core/tests/test_your_connectome.py-- loader testscreatures-core/tests/test_your_body.py-- body model testscreatures-core/tests/test_your_pipeline.py-- end-to-end brain-body tests
Drugs are defined in creatures-core/creatures/neural/pharmacology.py in the DRUG_LIBRARY dictionary.
DRUG_LIBRARY["your_drug"] = DrugEffect(
name="Your Drug",
target_nt="ACh", # Target neurotransmitter: ACh, GABA, DA, 5-HT, Glu
target_type=None, # Optional receptor subtype filter
weight_scale=0.5, # Multiplier on synaptic weights (0.0 = block, 2.0 = double)
ec50=1.0, # Half-maximal effective concentration
hill_coefficient=1.5, # Hill equation steepness
description="Description of mechanism and biological effect.",
)The Hill equation response = dose^n / (EC50^n + dose^n) governs dose-response. Choose ec50 and hill_coefficient based on published pharmacological data.
Add test cases in creatures-core/tests/test_pharmacology.py:
- Verify the drug appears in the library
- Test dose-response curve shape at key doses (0, EC50, 2x EC50)
- Test that it affects the correct synapses
The frontend drug selector in creatures-web/ picks up drugs dynamically from the API, so no frontend changes should be needed.
Circuit analysis lives in creatures-core/creatures/analysis/. The API exposes analysis through creatures-api/app/routers/analysis.py.
# creatures-core/creatures/analysis/your_analysis.py
def your_analysis(connectome: dict, **kwargs) -> dict:
"""Describe what this analysis computes.
Args:
connectome: Connectome dictionary with neurons and synapses.
Returns:
Dictionary with analysis results.
"""
...Existing analyses include: shortest paths, hub neurons, community detection, and network motifs.
Add a route in creatures-api/app/routers/analysis.py:
@router.get("/analysis/your-analysis")
async def get_your_analysis(experiment_id: str):
...Add test cases in creatures-core/tests/test_analysis.py.
All contributions should include tests. The test suite currently has 291 tests across 14 test files.
# Full Python test suite
PYTHONPATH="creatures-core:creatures-api" .venv/bin/python -m pytest creatures-core/tests/ -v
# Run a specific test file
.venv/bin/python -m pytest creatures-core/tests/test_pharmacology.py -v
# Run with coverage
.venv/bin/python -m pytest creatures-core/tests/ --cov=creatures --cov-report=term-missing
# Frontend type check
cd creatures-web && npx tsc --noEmit
# Frontend tests
cd creatures-web && npm test
# Frontend production build verification
cd creatures-web && npm run build
# Python linting
ruff check creatures-core/ creatures-api/
# Deployment preflight (checks endpoints, test count, build, etc.)
python scripts/preflight.pyFor the full list of API endpoints, see API.md.
- Consciousness metrics: the integrated information (Phi) partition search is currently greedy; a proper MIP (minimum information partition) solver would improve accuracy
- Distributed fitness evaluation: evolving larger populations would benefit from parallel/distributed fitness evaluation
- Additional connectomes: a zebrafish brain loader is partially implemented and needs completion
- Frontend code-splitting: the main App chunk is ~675KB and should be split for faster initial load
- Keep PRs focused on a single change
- Include a clear description of what changed and why
- Reference any related issues
- Ensure CI passes before requesting review (Python tests + TypeScript type check)
- Add tests for new functionality
- Update documentation if the public API changes
Open a GitHub issue with:
- A clear title describing the bug
- Steps to reproduce
- Expected behavior vs. actual behavior
- Your environment (OS, Python version, relevant package versions)
Open a GitHub issue with the enhancement label. Include:
- The problem you are trying to solve
- Your proposed solution
- Any alternatives you considered
Be respectful and constructive. We are building tools to advance neuroscience and reduce animal testing. Treat fellow contributors with the same care we bring to the science.
By contributing, you agree that your contributions will be licensed under the MIT License.