Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Docker ignore file
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
env/
ENV/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/

# Documentation
docs/_build/

# Git
.git/
.gitignore

# Docker
Dockerfile
docker-compose*.yaml
.dockerignore

# Test data (will be mounted as volume)
test_videos/

# Local config (will be mounted as volume)
dj_local_conf.json

# OS
.DS_Store
Thumbs.db


41 changes: 41 additions & 0 deletions CONDA_ENV_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Conda Environment Setup Guide

## Quick Start

```bash
# Create environment (Python 3.10+ required for DeepLabCut 3.x)
conda create -n element-deeplabcut python=3.10
conda activate element-deeplabcut

# Install system dependencies
conda install -c conda-forge graphviz

# Install package
pip install -e ".[elements,tests]"
```

## With DeepLabCut

```bash
# Full setup with DeepLabCut
pip install -e ".[elements,dlc_default,tests]"
```

## Verify Installation

```bash
python -c "import element_deeplabcut; print('✅ Package installed')"
python -c "import datajoint as dj; print('✅ DataJoint available')"
```

## Troubleshooting

| Issue | Solution |
|-------|----------|
| Package conflicts | `conda env remove -n element-deeplabcut` and recreate |
| Graphviz not found | `conda install -c conda-forge graphviz` |

## Next Steps

1. Configure database: See `tests/ENVIRONMENT_SETUP.md`
2. Run tests: `pytest tests/ -v`
49 changes: 49 additions & 0 deletions DOCKER_TEST_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Docker Testing

## Quick Start

```bash
# Start database and container
docker compose up -d

# Run tests
docker compose run --rm client python test_trained_inference.py
docker compose run --rm client python test_video_inference.py superanimal_quadruped

# Or use Makefile
make test-trained
make test-pretrained
```

## Configuration

Create `.env` file (optional):

```env
DJ_PASS=simple
DB_PORT=3306
DATABASE_PREFIX=test_
```

## Volumes

| Mount | Container Path | Description |
|-------|----------------|-------------|
| `./test_videos` | `/app/data` | Test videos |
| `.` | `/app` | Project directory |
| `./dj_local_conf.json` | `/app/dj_local_conf.json` | Database config |

## Troubleshooting

| Issue | Solution |
|-------|----------|
| Database connection | `docker compose ps` to check health |
| Permission issues | `sudo chown -R $USER:$USER test_videos/` |
| Code changes | `docker compose build` |
| Clean up | `docker compose down -v` |

## Development

```bash
make shell # Interactive shell
```
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Dockerfile for element-deeplabcut client environment
# Uses DeepLabCut's official Docker image as base
# Pinned to specific version for reproducibility
FROM deeplabcut/deeplabcut:3.0.0rc13-jupyter

# Set working directory
WORKDIR /app

# Install additional system dependencies if needed
RUN apt-get update && apt-get install -y \
git \
graphviz \
&& rm -rf /var/lib/apt/lists/*

# Copy the entire project
COPY . .

# Install element-deeplabcut and its dependencies
# The DLC image already has DeepLabCut installed, so we just need element-deeplabcut
# Note: We explicitly constrain dlclibrary version to avoid ModelZoo download bug
# (rename_mapping being a string instead of dict - fixed with runtime monkey patch)
RUN pip install -e .[dlc_default,elements,tests] && \
pip install "dlclibrary>=0.1.0,<0.2.0" || true

# Set environment variables
ENV PYTHONUNBUFFERED=1

# Set entrypoint to bash
ENTRYPOINT ["/bin/bash"]

# Default command - interactive bash shell
# Users can override with: docker compose run client -c "python your_script.py"
CMD ["-i"]

Loading