Thank you for your interest in contributing to NetOps Assistant! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Process
- Pull Request Process
- Testing
- Code Style
- Documentation
- Attribution
We are committed to providing a friendly, safe, and welcoming environment for all contributors. Please:
- Be respectful and considerate
- Accept constructive criticism gracefully
- Focus on what is best for the community
- Show empathy towards other community members
- Fork the repository to your GitHub account
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/netops-assistant.git cd netops-assistant - Set up development environment:
python -m venv venv source venv/bin/activate # Linux/macOS # or venv\Scripts\activate # Windows pip install -r requirements.txt pip install -r requirements-dev.txt # Development dependencies
- Create a branch for your feature or fix:
git checkout -b feature/your-feature-name
Before starting work, check if there's an existing issue for your idea. If not, create one to discuss your proposal.
We welcome various types of contributions:
- Bug fixes: Fix reported issues
- Features: Add new functionality
- Documentation: Improve or translate docs
- Tests: Increase test coverage
- Performance: Optimize existing code
- Integrations: Add support for new platforms/vendors
Follow conventional commits format:
type(scope): brief description
Detailed explanation if needed
Fixes #issue_number
Types:
feat: New featurefix: Bug fixdocs: Documentationtest: Testsrefactor: Code refactoringperf: Performance improvementchore: Maintenance
Example:
feat(telegram): add inline keyboard support for approvals
Added inline keyboards to approval notifications for better UX.
Admins can now approve/reject directly from Telegram.
Fixes #42
-
Ensure your code works:
# Run tests pytest tests/ # Check code style flake8 . black . --check # Validate configuration python utils/config_validator.py
-
Update documentation if you changed functionality
-
Open a Pull Request with:
- Clear title and description
- Reference to related issue(s)
- Screenshots/logs if applicable
- Test results
-
PR Review Process:
- At least one maintainer review required
- All CI checks must pass
- Resolve all review comments
- Keep PR focused and atomic
# All tests
pytest
# Specific module
pytest tests/test_workflow.py
# With coverage
pytest --cov=app --cov=services --cov=integrations
# Integration tests (requires services)
pytest tests/integration/ --integration- Add unit tests for new functions
- Include integration tests for new features
- Test edge cases and error handling
- Maintain >80% coverage for new code
Example test:
import pytest
from services.workflow import WorkflowService
@pytest.mark.asyncio
async def test_parameter_extraction():
workflow = WorkflowService()
result = await workflow.extract_parameters(
"Configure port 5 on SW-01 in VLAN 100"
)
assert result['device_name'] == 'SW-01'
assert result['interface'] == 'Gi0/5'
assert result['vlan'] == 100We use Python 3.9+ with the following standards:
- Black for code formatting (line length: 100)
- isort for import sorting
- flake8 for linting
Run formatters:
black . --line-length 100
isort .
flake8 .- Type hints for function signatures
- Docstrings for classes and public methods
- Async/await for I/O operations
- Context managers for resource handling
- Proper error handling with custom exceptions
Example:
from typing import Dict, Optional
import asyncio
async def configure_interface(
device: str,
interface: str,
vlan: int
) -> Dict[str, Any]:
"""
Configure interface on network device.
Args:
device: Device hostname or IP
interface: Interface name (e.g., 'Gi0/1')
vlan: VLAN ID to configure
Returns:
Configuration result with status and job_id
Raises:
DeviceConnectionError: If device unreachable
ValidationError: If parameters invalid
"""
# Implementation
pass- Add docstrings to all public functions/classes
- Include type hints
- Document exceptions
- Provide usage examples
- Update README.md for new features
- Add examples to docs/EXAMPLES.md
- Document configuration in docs/CONFIG.md
- Include screenshots when relevant
For new integrations or APIs:
class NetBoxClient:
"""
NetBox API client for device management.
Example:
>>> client = NetBoxClient(url="https://netbox.local", token="...")
>>> device = await client.get_device("SW-01")
>>> print(device.primary_ip)
"""This project is created and maintained by nimbo78:
By contributing, you agree that your contributions will be licensed under Apache License 2.0 with the attribution requirements specified in the LICENSE file.
Feel free to:
- Open an issue for questions
- Contact maintainers via Telegram
- Join discussions in existing issues
Thank you for contributing to NetOps Assistant! 🚀