Thank you for your interest in contributing to Ember! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Contribution Workflow
- Development Guidelines
- Release Process
- Community
We are committed to providing a friendly, safe, and welcoming environment for all contributors. Please read and follow our Code of Conduct.
-
Fork and clone the repository:
git clone https://github.com/YOUR-USERNAME/ember.git cd ember
-
Set up Poetry (recommended): We use Poetry for dependency management. Install Poetry if you haven't already.
-
Install dependencies:
# Install with all development dependencies poetry install --with dev
-
Activate the virtual environment:
poetry shell
-
Set up pre-commit hooks (recommended):
pre-commit install
If you prefer not to use Poetry, you can use pip:
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode with dev dependencies
pip install -e ".[dev]"
The project is set up with proper Python packaging, so you should import from ember
directly:
# Correct way to import
from ember.core import non
from ember.xcs.tracer import jit
# No need to manipulate sys.path or use symlinks
The Ember codebase is organized into the following structure:
ember/
├── docs/ # Documentation
│ ├── cli/ # CLI documentation
│ ├── design/ # Design documents
│ └── quickstart/ # Quick start guides
├── src/ # Source code
│ ├── cli/ # TypeScript CLI implementation
│ └── ember/ # Main Python package
│ ├── cli.py # Python CLI entrypoint
│ ├── core/ # Core framework
│ ├── xcs/ # Execution engine
│ └── examples/ # Example applications
├── tests/ # Test suite
│ ├── cli/ # CLI tests
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── fuzzing/ # Fuzzing tests
├── examples/ # Standalone examples
├── scripts/ # Development and CI scripts
├── pyproject.toml # Python project configuration
├── package.json # Node.js project configuration
├── tsconfig.json # TypeScript configuration
└── README.md # Project overview
The .gitignore
file is configured to exclude common development files, caches, and sensitive configuration files.
We use pytest for testing. To run the test suite:
# Run all tests
poetry run pytest
# Run specific tests
poetry run pytest tests/unit/core
# Run tests with code coverage
poetry run pytest --cov=src/ember
# Run a specific test file
poetry run pytest tests/unit/core/test_app_context.py
We enforce high code quality standards:
-
Code Formatting:
- We use Black for code formatting
- Line length is set to 88 characters
- Run
poetry run black src tests
before committing
-
Import Sorting:
- We use isort for import sorting
- Run
poetry run isort src tests
before committing
-
Linting:
- We use ruff and pylint for linting
- Run
poetry run ruff check src tests
before committing - Run
poetry run pylint src/ember
for more detailed linting
-
Type Checking:
- We use mypy for static type checking
- Run
poetry run mypy src
before committing
All these checks are also performed automatically when you submit a pull request.
- Check our issue tracker for open issues
- Look for issues tagged with
good first issue
if you're new to the project - Feel free to ask questions in the issue comments if you need clarification
When opening a new issue, please:
- Search existing issues first to avoid duplicates
- Use a clear and descriptive title
- Follow the issue template if one is provided
- For bug reports, include:
- Steps to reproduce
- Expected behavior
- Actual behavior
- Environment details (OS, Python version, etc.)
- Code samples or error traces when relevant
- For feature requests, explain:
- The problem you're trying to solve
- Your proposed solution
- Alternatives you've considered
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes:
- Write clean, well-commented code
- Add/update tests to cover your changes
- Update documentation as needed
- Ensure your code passes all tests and style checks
-
Commit your changes:
- Use clear, meaningful commit messages
- Reference issue numbers where applicable
git commit -m "Add feature X, fixes #123"
-
Keep your branch updated:
git fetch origin git rebase origin/main
When submitting a pull request:
- Fill out the PR template completely
- Link to related issues
- Describe your changes in detail
- Ensure all tests and checks pass
- Include screenshots or examples for UI or behavior changes
- Request reviews from maintainers or contributors familiar with the area of code
During code review:
- Be responsive to feedback
- Make requested changes promptly
- Ask questions if something isn't clear
- Be patient and respectful
- Remember that the goal is to improve code quality
Good documentation is essential:
-
Docstrings:
- All public modules, classes, and functions must have docstrings
- We follow Google-style docstrings
- Include type hints in docstrings for complex parameters
- Example:
def process_data(data: List[Dict[str, Any]], options: Optional[Dict[str, Any]] = None) -> Result: """Process input data with optional configuration. Args: data: List of data dictionaries to process options: Optional configuration parameters Returns: A Result object containing processed output Raises: ValueError: If data is empty or malformed """
-
README and Documentation Files:
- Update relevant documentation for significant changes
- Keep examples up-to-date
- Add new documentation for new features
-
Code Comments:
- Use comments for complex or non-obvious logic
- Avoid redundant comments that just restate the code
- Use TODO comments for future improvements (with issue references)
We strive for high test coverage:
-
Test Coverage:
- All new code should have corresponding tests
- We aim for at least 90% code coverage
- Critical paths should have 100% coverage
-
Test Types:
- Unit tests: For testing individual functions and classes in isolation
- Integration tests: For testing interactions between components
- Property-based tests: Using Hypothesis for testing invariants
- Fuzzing tests: For finding edge cases and security issues
-
Test Naming and Organization:
- Test files should be named
test_*.py
- Test classes should be named
Test*
- Test functions should be named
test_*
- Group related tests in the same file or directory
- Test files should be named
-
Test Quality:
- Tests should be deterministic and reliable
- Mock external dependencies appropriately
- Test edge cases and error conditions
- Include both positive and negative test cases
Performance is important in Ember:
-
Measurement:
- Use profiling tools to identify bottlenecks
- Include benchmarks for performance-critical code
- Compare before/after performance for optimizations
-
Optimizations:
- Optimize for readability and maintainability first
- Focus optimizations on critical paths
- Document performance trade-offs in comments
- Use appropriate data structures and algorithms
-
Concurrency:
- Ensure thread safety for shared resources
- Use appropriate locking mechanisms
- Consider asynchronous approaches where applicable
We use Python type hints extensively:
-
Type Annotations:
- Annotate all function parameters and return values
- Use appropriate generic types when needed
- Use Optional, Union, and other typing constructs as needed
-
Type Checking:
- Run
mypy
to check for type errors - Address all type warnings
- Use TypeVar and Generic for polymorphic code
- Run
-
Custom Types:
- Define new type aliases for complex types
- Use Protocol for structural typing
- Document type parameters and constraints
Our release process follows these steps:
- Feature development in feature branches
- Pull requests to the main branch after code review
- Continuous integration tests on all PRs
- Periodic releases with semantic versioning:
- MAJOR version for incompatible API changes
- MINOR version for backwards-compatible functionality
- PATCH version for backwards-compatible bug fixes
- Release notes summarizing changes and upgrades
- Discussions: Join our GitHub Discussions for questions and ideas
- Issues: Use GitHub Issues for bug reports and feature requests
- Discord: Join our Discord server for real-time discussion
Thank you for contributing to Ember! Your time and effort help make this project better for everyone.
By contributing to Ember, you agree that your contributions will be licensed under the project's Apache 2.0 License.