This file contains repository-specific instructions for GitHub Copilot to ensure consistent and accurate assistance when working with the Infinigen codebase.
Infinigen is a research project for generating infinite photorealistic worlds using procedural generation. It combines computer vision, computer graphics, and machine learning to create realistic 3D environments for various applications.
- Python: 3.11 (strict requirement, see
pyproject.toml) - Blender: 4.5.3+ via bpy (3D modeling and rendering)
- Core Libraries:
- NumPy, SciPy, Pandas for numerical computing
- OpenCV for image processing
- Trimesh for 3D mesh operations
- gin_config for configuration management
- Build System:
uvfor Python dependency managementMakefilefor terrain compilation, docker builds- setuptools for package building
- Testing: pytest with custom markers
- Linting: ruff (configured for E9, F63, F7, F82 checks and copyright statements)
- CI/CD: GitHub Actions (see
.github/workflows/)
The codebase is organized into several key modules:
infinigen/- Main package containing procedural generation codeassets/- Asset generation (plants, objects, creatures)core/- Core utilities and base classesterrain/- Terrain generation (compiled C++ extensions)nodes/- Blender node transpiler for converting node graphs to Python
infinigen_examples/- Example scenes and usage patternsscripts/- Build and installation scriptstests/- Test suite organized by featuredocs/- User documentation (installation, tutorials, configuration)
- Use
uvfor dependency management:uv sync --extra dev - Compile optional components using Makefile targets:
make terrain- Compile terrain generationmake customgt- Compile OpenGL ground truthmake flip_fluids- Compile fluid simulation
- Lint:
uv run ruff check .- Critical errors:
uv run ruff check --select=E9,F63,F7,F82 . - Copyright check:
uv run ruff check --preview --select CPY001 .
- Critical errors:
- Test:
uv run pytest tests- Skip CI tests locally:
uv run pytest tests -k 'not skip_for_ci'
- Skip CI tests locally:
- Run: See
docs/HelloWorld.mdanddocs/HelloRoom.mdfor example commands
# Install dependencies
uv sync --extra dev
# Lint code
uv run ruff check .
# Run tests
uv run pytest tests -k 'not skip_for_ci'
# Generate a nature scene
python -m infinigen.datagen.manage_jobs --output_folder outputs/hello_world --num_scenes 1 --pipeline_configs local_16GB monocular_video singleview --configs simple
# Generate an indoor scene
python -m infinigen.datagen.manage_jobs --output_folder outputs/hello_room --num_scenes 1 --pipeline_configs local_16GB monocular_video singleview --configs simple_indoors- Python Version: Always use Python 3.11 features and syntax
- Type Hints: Use type hints where they improve clarity
- Imports: Follow ruff's import ordering
- Docstrings: Use clear docstrings for public APIs
- Naming: Follow PEP 8 conventions
- snake_case for functions, variables, modules
- PascalCase for classes
- UPPER_CASE for constants
- Keep asset generators in appropriate
infinigen/assets/subdirectories - Use
gin_configfor configuration management - Follow existing patterns for Blender node transpilation
- Place tests in parallel structure under
tests/
- Asset Generation: Inherit from base factory classes
- Blender Nodes: Use
infinigen/nodes/node_transpiler/for node-to-code conversion - Configuration: Use gin config files for scene configuration
- Testing: Mark long-running tests with
@pytest.mark.skip_for_ci
Always use Context7 to retrieve current documentation when working with:
- Blender Python API (bpy)
- NumPy, SciPy, and other scientific libraries
- OpenCV operations
- Any external framework or library
Automatically invoke Context7 tools without being asked when:
- Writing code that uses external libraries
- Answering questions about APIs or library features
- Debugging issues that might relate to API changes
Prefer current documentation from Context7 over model training data if there is a conflict, especially for:
- Blender API (frequently updated)
- Python library versions (we use specific versions)
- Deprecated patterns or functions
Use Serena for advanced codebase analysis when available:
- Finding all call sites of a function across the codebase
- Analyzing dependency graphs and module relationships
- Running project-specific build diagnostics
- Performing structural analysis of procedural generators
If Serena is not available, fall back to standard grep/glob tools.
- Check existing asset implementations in
infinigen/assets/ - Follow the factory pattern used by similar assets
- Add appropriate tests in
tests/assets/ - Document parameters and usage in docstrings
- Consider adding examples in
infinigen_examples/
- Understand dependencies using module imports
- Run full test suite to catch regressions
- Update documentation if behavior changes
- Consider backward compatibility
- Use
infinigen/nodes/node_transpiler/dev_script.pyfor node-to-code conversion - Test node graphs in Blender before transpiling
- Document the original node graph source
- Follow existing transpiled code patterns
- Update relevant docs in
docs/for user-facing changes - Update README.md for major feature additions
- Add code comments for complex procedural algorithms
- Include visual examples where appropriate
- Ensure
uv synchas been run - Check Python version is 3.11
- Verify optional components are compiled if needed
- Ensure bpy is installed:
uv run python -c "import bpy" - Check Blender version compatibility (4.5.3+)
- Some features require X11/display server
- Use
pytest -vfor verbose output - Check for
skip_for_cimarkers - Review test logs in
outputs/MYJOB/MYSEED/logs/
- Issues: Use GitHub Issues with appropriate template
- Documentation: Check
docs/directory - Examples: See
infinigen_examples/anddocs/Hello*.md - Community: Follow @PrincetonVL on Twitter