Skip to content
Merged
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
6 changes: 6 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Use pixi for environment management
watch_file pixi.lock
eval "$(pixi shell-hook -e dev)"

# Unset ROS environment variables to avoid conflicts
source scripts/unset_ros2_env.sh
41 changes: 41 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test

on:
pull_request: {}
push:
branches: main

jobs:
test:
strategy:
matrix:
python-version: ['3.12']
os: [ubuntu-latest]

name: Python ${{ matrix.os }} ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v5

- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- uses: prefix-dev/setup-pixi@v0.9.1
with:
pixi-version: v0.63.2
cache: true
environments: dev

- name: Download hand landmarker model
run: |
mkdir -p models
curl -L -o models/hand_landmarker.task \
https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task

- run: pixi run fmt
- run: pixi run lint
- run: pixi run types
- name: Run tests
run: pixi run test -m "not slow" -v --tb=short --timeout=60
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so

# Distribution / packaging
build/
dist/
*.egg-info/
*.egg

# Virtual environments
.env
.venv
venv/
ENV/

# Testing
.pytest_cache/
.cache

# Ruff
.ruff_cache/

# Pixi
.pixi

# Models (large files)
models/*.task
!models/.gitkeep

# Data files (large binary files)
# Ignore .jpg images in data subfolders, but allow .zip files
# Allow .npz files (processed features are small and useful for reproducibility)
data/**/*.jpg
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=20000']
exclude: '\.zip$'
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# motionhand
# handmotion

Hand Gesture Classifier

![License](https://img.shields.io/badge/license-Apache%202.0-blue)
[![Powered by: Pixi](https://img.shields.io/badge/Powered_by-Pixi-facc15)](https://pixi.sh)
Binary file added data/processed/rps/data.npz
Binary file not shown.
Binary file added data/raw/rps.zip
Binary file not shown.
61 changes: 61 additions & 0 deletions docs/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Development Guide

## Development Workflow

### Initial Setup

```bash
# Install dependencies
pixi install

# Activate the dev environment (or use direnv for automatic activation)
pixi shell -e dev
```

### Common Tasks

```bash
# pre-commit check
pixi run pre-commit

# Run tests
pixi run test

# Run all checks (format, lint, types, test)
pixi run all
```

### Adding Dependencies

```bash
# Add a conda dependency
pixi add <package-name>

# Add a PyPI dependency
pixi add --pypi <package-name>

# Add a dev dependency
pixi add --dev <package-name>
```
## Environment Setup

The project uses `.envrc` for automatic environment activation via direnv.

### What is `.envrc`?

The `.envrc` file is used by direnv to automatically load environment variables when you enter the project directory.

**Contents:**
- `watch_file pixi.lock` - Tells direnv to reload when `pixi.lock` changes (e.g., after adding dependencies)
- `eval "$(pixi shell-hook -e dev)"` - Activates the pixi dev environment, setting up the Python environment, PATH, and other variables

**How it works:**
- When you `cd` into the project directory, direnv automatically activates the pixi dev environment
- When you leave, it deactivates
- No need to manually run `pixi shell` or activate virtual environments

**Setup required:**
- Install `direnv` and add it to your shell (usually a one-time setup)
- Run `direnv allow` once in the project directory to trust the `.envrc` file

This keeps your development environment activated automatically as you work.
3 changes: 3 additions & 0 deletions handmotion/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Hand gesture classifier package."""

__version__ = "0.0.1"
Loading