Contributing to nrx¶
Thank you for your interest in contributing to nrx! This guide will help you get started.
Development Setup¶
Prerequisites¶
- Python 3.10 or higher
- Git
- Make
Clone the Repository¶
The --recursive flag is important as it includes the templates submodule.
Set Up Development Environment¶
According to the project instructions, use the development virtual environment:
python3.10 -m venv nrx310-dev
source nrx310-dev/bin/activate
pip install -r requirements.txt -r requirements-dev.txt
Environment Selection
Always use nrx310-dev for development. Do NOT use:
~/.venv/nrx310- Production testing only./nrx310- Wrong environment
Verify Installation¶
Code Quality Standards¶
Pylint Requirements¶
All code must achieve a 10.00/10 pylint score to pass CI:
Complexity Guidelines¶
- Extract helper functions if cyclomatic complexity > 12 branches
- Follow PEP 8 conventions
- Avoid implicit booleanness comparisons in tests (use
not xinstead ofx == [])
Testing Requirements¶
All new functionality requires unit tests:
- Place tests in
tests/unit/ - All tests must pass before committing
- Use descriptive test names and docstrings
Run tests:
For more details, see Testing Documentation.
Development Workflow¶
Branch Strategy¶
main- Production releasesdev- Development branch (default target for PRs)- Feature branches - Named descriptively (e.g.,
feature/export-error-handling)
Making Changes¶
-
Create a feature branch from
dev: -
Make your changes
-
Run quality checks:
-
Commit your changes following the commit message format
-
Push to your fork:
Commit Messages¶
Follow this format:
Short descriptive title (50 chars max)
- Bullet point details
- What changed and why
- Related issue references
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Creating Pull Requests¶
- Push your branch to origin
- Create a PR targeting the
devbranch - Include a comprehensive summary with:
- Bug fixes
- New features
- Test coverage
- Breaking changes (if any)
CI/CD Pipeline¶
GitHub Actions run on push/PR:
- Pylint - Python 3.10, 3.11
- Unit Tests - Python 3.10, 3.11
- System Tests - Integration tests
All must pass before merging.
Code Organization¶
Project Structure¶
nrx/
├── src/nrx/ # Source code
│ └── nrx.py # Main application
├── tests/
│ ├── unit/ # Unit tests (pytest)
│ ├── dc1/ # System test fixtures
│ └── ...
├── docs/ # Documentation
├── .github/
│ └── workflows/ # CI/CD workflows
├── Makefile # Build commands
└── requirements*.txt # Dependencies
Best Practices¶
- Keep functions under 12 branches for pylint
- Extract helper functions when complexity grows
- Use descriptive variable names
- Add docstrings to all public functions
Documentation¶
Update relevant documentation for your changes:
docs/- User-facing documentationREADME.md- For major feature changes- Docstrings - For all public functions
Building Documentation¶
# Install docs dependencies
pip install -r requirements-dev.txt
# Serve locally
mkdocs serve
# Build static site
mkdocs build
Debugging¶
Run with Debug Output¶
Test Specific Functionality¶
# Config loading
PYTHONPATH=./src python -c "from nrx.nrx import load_toml_config; print(load_toml_config('config.conf'))"
# Unit test specific file
PYTHONPATH=./src pytest tests/unit/test_config.py -v
Special Considerations¶
Backward Compatibility¶
- Maintain compatibility with older config files
- Support both old and new parameter names
- Document breaking changes prominently
NetBox Integration¶
- Test against multiple NetBox versions
- Handle API version differences gracefully
- See
make test-previous,test-current,test-latestfor version testing
Using uv for Development¶
For faster local development with uv:
# Install in editable mode
uv pip install -e .
# Run from source
uv run nrx --version
# Run tests
uv run pytest tests/unit/ -v
Getting Help¶
- Join our Discord server
- Check #netreplica on NetDev Community Slack
- Open a GitHub issue
Code Review Process¶
- All PRs require review before merging
- Address review comments promptly
- Keep PRs focused and reasonably sized
- Update PR description if scope changes
Release Process¶
Releases are managed by maintainers:
- Version bump in
src/nrx/__about__.py - Update
CHANGELOG.md - Tag release in git
- Publish to PyPI via GitHub Actions
- Update documentation
License¶
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.
Recognition¶
Contributors are recognized in:
- Release notes
- GitHub contributors page
- Project documentation
Thank you for contributing to nrx!