Development Guide
Setting Up Development Environment
Clone the repository:
git clone https://github.com/your-org/rift.git cd rift
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
Install development dependencies:
pip install -e ".[dev]"
Project Structure
rift/
├── rift/ # Main package directory
│ ├── __init__.py
│ ├── cli.py # Command-line interface
│ ├── core.py # Core functionality
│ ├── inventory.py # Inventory management
│ ├── playbook.py # Playbook management
│ ├── role.py # Role management
│ ├── config.py # Configuration handling
│ └── utils.py # Utility functions
├── tests/ # Test directory
│ ├── __init__.py
│ ├── test_cli.py
│ ├── test_core.py
│ └── ...
├── docs/ # Documentation
├── setup.py # Package setup
└── README.md # Project README
Running Tests
Run the test suite:
pytest
Run tests with coverage:
pytest --cov=rift
Code Style
The project follows PEP 8 style guidelines. To check your code:
flake8
black .
Documentation
Build the documentation:
cd docs
make html
The documentation will be available in docs/_build/html/
.
Contributing
Fork the repository
Create a feature branch
Make your changes
Run tests and ensure they pass
Submit a pull request
Release Process
Update version in
VERSION
fileUpdate changelog
Create a tag
Push changes and tag
GitHub Actions will build and release automatically
Testing
Unit Tests
Write unit tests for all new functionality:
import unittest
from rift.core import RiftCore
class TestRiftCore(unittest.TestCase):
def setUp(self):
self.core = RiftCore()
def test_initialization(self):
self.assertIsNotNone(self.core)
Integration Tests
Integration tests verify the complete workflow:
def test_full_deployment():
# Test complete deployment workflow
pass
Code Quality
We use several tools to maintain code quality:
Black: Code formatting
Flake8: Style checking
pytest: Testing framework
Coverage: Code coverage analysis
Continuous Integration
All code changes are tested using GitHub Actions:
Run tests on multiple Python versions
Check code style and formatting
Build documentation
Run security scans
Performance Testing
For performance-critical code, use benchmarking:
import time
def benchmark_function():
start = time.time()
# Your code here
end = time.time()
print(f"Function took {end - start:.2f} seconds")
Documentation Standards
Use reStructuredText for documentation
Include docstrings for all public functions
Add examples for complex functionality
Keep documentation up to date with code changes