Guide for contributing to the IriusRisk CLI.
# Clone and setup
git clone <repository-url>
cd iriusrisk_cli
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -e .
# Run tests
pytest# Run all tests
pytest
# Run specific test types
pytest tests/unit/ # Unit tests
pytest tests/cli/ # CLI tests
pytest tests/integration/ # Integration tests
# Run with coverage
pytest --cov=src/iriusrisk_cli
# Run specific test
pytest tests/unit/test_project_service.py::TestProjectService::test_list_projects- Create a feature branch from
main - Make your changes
- Write tests for new functionality
- Ensure all tests pass
- Submit a pull request
- Follow existing patterns in the codebase
- Write tests for new functionality
- Use type hints where appropriate
- Keep functions focused and small
- Add command function in appropriate
commands/file - Register command in
main.py - Add tests in
tests/cli/ - Update help text and examples
Example:
# commands/projects.py
@click.command()
@click.argument('project_id')
def show(project_id):
"""Show project details."""
# Implementation hereThe CLI supports multiple configuration methods. For development:
# Option 1: User config (recommended for development)
iriusrisk config set-hostname https://your-instance.iriusrisk.com
iriusrisk config set-api-key # prompts securely for API key
# Option 2: Project .env file
cat > .env << EOF
IRIUS_HOSTNAME=https://your-instance.iriusrisk.com
IRIUS_API_KEY=your-api-token-here
IRIUS_LOG_RESPONSES=true # Optional: for debugging
EOF
# Option 3: Environment variables
export IRIUS_HOSTNAME=https://your-instance.iriusrisk.com
export IRIUS_API_KEY=your-api-token-hereNote: Both IRIUS_API_KEY and IRIUS_API_TOKEN are supported for backward compatibility.
export IRIUS_LOG_RESPONSES=true
iriusrisk project list
# Check captured_responses/ directory- Import errors: Run
pip install -e . - Test failures: Check configuration using
iriusrisk config show - API errors: Verify credentials and network access
- Config not found: Ensure either user config (~/.iriusrisk/config.json), .env file, or environment variables are set
- All tests pass
- New functionality has tests
- Code follows existing patterns
- Clear commit messages
Include:
- What the change does
- Why it's needed
- How to test it
- Any breaking changes
- Automated tests run
- Code review by maintainers
- Address feedback
- Merge when approved
Maintainers handle releases:
- Update version in
setup.py - Create git tag
- Publish to PyPI
- Issues: Use GitHub issues for bugs and features
- Questions: Start a GitHub discussion
- Code Review: Submit a draft PR for early feedback