Developer Guide¶
Home > Developer Guide
Documentation Status
The documentation in this guide needs to be reviewed and updated.
Welcome to the Developer Guide for the Ingenious Fabric Accelerator! This section is designed for developers who want to understand the architecture, extend functionality, or contribute to the project.
Architecture Overview¶
The Ingenious Fabric Accelerator is built with a modular architecture that separates concerns and enables extensibility:
graph TD
A[CLI Interface] --> B[Command Modules]
B --> C[Core Libraries]
C --> D[Python Libraries]
C --> E[PySpark Libraries]
C --> F[Template Engine]
D --> G[Fabric Runtime]
E --> G
F --> H[Generated Notebooks]
H --> G Core Components¶
Python Libraries¶
Reusable Python and PySpark libraries that provide common functionality for Fabric workspaces.
DDL Scripts¶
Template system for generating DDL notebooks from SQL and Python scripts.
Notebook Utils¶
Environment-agnostic utilities that work in both local development and Fabric runtime.
SQL Templates¶
Jinja-based SQL template system supporting multiple database dialects.
Variable Replacement System¶
Environment-specific configuration management through placeholder replacement and code injection.
Packages¶
Extension package system for adding custom functionality and reusable components.
DBT Profile Manager¶
Automatic dbt profile management and lakehouse integration.
Pip Install Testing¶
Testing the package installation and dependencies in various environments.
Development Setup¶
Prerequisites¶
- Python 3.12+
- Git
- IDE with Python support (VS Code, PyCharm, etc.)
- Docker (optional, for containerized development)
Clone and Setup¶
# Clone the repository
git clone https://github.com/Insight-Services-APAC/Insight_Ingenious_For_Fabric.git
cd ingen_fab
# Set up development environment with uv (recommended)
uv sync --all-extras
# Or use pip with virtual environment
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev,docs,dbt]
# Install pre-commit hooks
pre-commit install
# Verify installation
ingen_fab --help
# Clone the repository
git clone https://github.com/Insight-Services-APAC/Insight_Ingenious_For_Fabric.git
cd ingen_fab
# Set up development environment with uv (recommended)
uv sync --all-extras
# Or use pip with virtual environment
python -m venv .venv
.venv\Scripts\activate
pip install -e .[dev,docs,dbt]
# Install pre-commit hooks
pre-commit install
# Verify installation
ingen_fab --help
Development Dependencies¶
The project uses several development tools:
- Testing: pytest, pytest-cov, pytest-asyncio
- Linting: ruff, vulture
- Type checking: mypy (optional)
- Documentation: mkdocs, mkdocs-material
- Pre-commit: pre-commit hooks for code quality
Container Development Setup¶
For a consistent development environment with Apache Spark and SQL Server, use the provided dev container:
-
Open in Dev Container: Use VS Code's "Dev Containers" extension and select "Reopen in Container"
-
Install PowerShell:
- Start PowerShell and install development tools:
-
Restart PowerShell session:
-
Install SQL Server (optional):
bash ./scripts/dev_container_scripts/spark_minimal/sql_install_4_linux.sh
bash /opt/mssql/bin/mssql-conf setup
Note: You'll need to provide an SA password and select "Enterprise (2)" and "English" when prompted.
Once the setup is complete, you can start SQL Server with. (Press Enter after the command completes and sql server will be started in the background. Note you will need to run this command every time you start the container):
Next set the environment variables for SQL Server connection:
or
You now have a minimal setup with Apache Spark, SQL Server, and PowerShell support for local development.
Project Structure¶
ingen_fab/
├── cli_utils/ # CLI command implementations
│ ├── __init__.py
│ ├── deploy_commands.py # Deployment commands
│ ├── init_commands.py # Project initialization
│ ├── notebook_commands.py # Notebook management
│ └── workspace_commands.py # Workspace operations
├── ddl_scripts/ # DDL template system
│ ├── _templates/ # Jinja templates
│ ├── notebook_generator.py # Template processor
│ └── README.md
├── notebook_utils/ # Notebook utilities
│ ├── fabric_cli_notebook.py
│ ├── simple_notebook.py
│ └── templates/
├── python_libs/ # Core Python libraries
│ ├── common/ # Shared utilities
│ ├── interfaces/ # Abstract interfaces
│ ├── python/ # CPython implementations
│ └── pyspark/ # PySpark implementations
├── python_libs_tests/ # Test suites
├── cli.py # Main CLI entry point
└── project_config.py # Project configuration
API Documentation¶
API Reference¶
Comprehensive API documentation for Python libraries and utilities.
Python APIs¶
Detailed documentation of Python API interfaces and implementations.
Development Workflow¶
1. Feature Development¶
# Create feature branch
git checkout -b feature/new-feature
# Make changes
# ... develop your feature ...
# Run tests
pytest ./tests/ -v
pytest ./ingen_fab/python_libs_tests/ -v
# Check code quality
ruff check .
ruff format .
# Commit changes
git add .
git commit -m "Add new feature: description"
2. Testing¶
# Run all tests
pytest
# Run specific test modules
pytest ./tests/test_cli.py -v
pytest ./ingen_fab/python_libs_tests/python/test_warehouse_utils_pytest.py -v
# Run with coverage
pytest --cov=ingen_fab --cov-report=html
# Test Python libraries locally (requires FABRIC_ENVIRONMENT=local)
export FABRIC_ENVIRONMENT=local
ingen_fab test local python
ingen_fab test local pyspark
3. Documentation¶
# Serve documentation locally
mkdocs serve
# Build documentation
mkdocs build
# Deploy documentation
mkdocs gh-deploy
Adding New Features¶
Adding a New CLI Command¶
-
Create command module:
-
Register command in CLI:
-
Add tests:
Adding a New Python Library¶
-
Create the library:
-
Create tests:
-
Add to template injection:
Adding a New DDL Template¶
-
Create templates:
-
Update notebook generator:
Code Standards¶
Python Style¶
- Follow PEP 8 style guidelines
- Use type hints where appropriate
- Write docstrings for all public functions
- Use meaningful variable and function names
Testing¶
- Write tests for all new functionality
- Aim for >80% code coverage
- Use descriptive test names
- Test both success and failure cases
Documentation¶
- Update documentation for new features
- Include code examples
- Write clear, concise explanations
- Update CLI help text
Debugging¶
Local Development¶
# Run with verbose output
ingen_fab --help
# Debug specific commands - use VS Code launch configuration
See .vscode/launch.json for pre-configured debug setups
# Use logging
import logging
logging.basicConfig(level=logging.DEBUG)
Testing Issues¶
# Run specific test
pytest ./tests/test_cli.py::test_specific_function -v -s
# Debug test failures
pytest ./tests/test_cli.py::test_specific_function --pdb
# Check test coverage
pytest --cov=ingen_fab --cov-report=term-missing
Contributing¶
Pull Request Process¶
- Fork the repository
- Create feature branch
- Make changes with tests
- Update documentation
- Submit pull request
Code Review Checklist¶
- Code follows style guidelines
- Tests are included and passing
- Documentation is updated
- No breaking changes (or properly documented)
- Performance impact is considered
Advanced Topics¶
Custom Template Development¶
Learn how to create custom templates for specific use cases.
Plugin Architecture¶
Understand how to extend the CLI with plugins.
Performance Optimization¶
Best practices for optimizing generation and deployment performance.
Integration Testing¶
Setting up comprehensive integration tests with Fabric.
Resources¶
Internal Documentation¶
- Python Libraries - Detailed library documentation
- DDL Scripts - Template system guide
- Notebook Utils - Utility abstractions
- SQL Templates - SQL template reference
- Variable Replacement System - Configuration management guide
External Resources¶
Getting Help¶
- Documentation: This site covers most development topics
- CLI Help: Use
ingen_fab --helpandingen_fab COMMAND --helpfor command assistance - Code Examples: Check the sample_project/ directory for working examples
- Testing: Run
pytestto verify your development environment
Ready to contribute? Start with the Python Libraries guide to understand the core architecture!