Contributing to RDSAI CLI

December 27, 2025 ยท View on GitHub

Thank you for your interest in contributing to RDSAI CLI! This document provides guidelines and instructions for contributing.

๐Ÿš€ Getting Started

Prerequisites

  • Python 3.13+
  • uv (recommended) or pip
  • Git
  • MySQL instance (for testing database features)

Development Setup

# Clone the repository
git clone https://github.com/aliyun/rdsai-cli.git
cd rdsai-cli

# Install dependencies with uv (recommended)
uv sync --extra dev

# Or with pip (use virtual environment recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e ".[dev]"

# Run the CLI
uv run rdsai
# or if using pip with venv
python -m cli

Running Tests

You can use the convenience script or run pytest directly:

# Using the convenience script (recommended)
./dev/pytest.sh

# Or run pytest directly
uv run pytest

# Run specific test file
uv run pytest tests/loop/test_runtime.py

# Run tests with verbose output
uv run pytest -v

# Run tests matching a pattern
uv run pytest -k "test_runtime"

# Run with coverage (requires pytest-cov)
uv run pytest --cov=. --cov-report=html

Note: This project uses pytest-asyncio for async tests. Make sure async test functions are properly decorated.

Code Quality

We use Ruff for linting and formatting:

# Using the convenience script (recommended)
# Auto-fix linting and formatting issues
./dev/code-style.sh

# Check only (without fixing)
./dev/code-style.sh --check

# Or run commands directly
# Check for linting errors (without fixing)
uv run ruff check .

# Auto-fix linting errors
uv run ruff check --fix .

# Check code formatting (without reformatting)
uv run ruff format --check .

# Auto-format code
uv run ruff format .

# Run all checks at once
uv run ruff check . && uv run ruff format --check . && uv run pytest

CI/CD: Our GitHub Actions workflows automatically run these checks on every push and PR:

  • Lint workflow (lint.yml): Runs ruff check and ruff format --check
  • Test workflow (python-package.yml): Runs pytest on Python 3.13

๐Ÿ“ Code Style

General Guidelines

  • Follow PEP 8 conventions
  • Use type hints for all function signatures
  • Write docstrings for public functions and classes
  • Keep line length under 120 characters
  • Use meaningful variable and function names

Code Formatting

  • Ruff handles all formatting automatically
  • Run ruff format . before committing
  • The formatter enforces consistent style across the codebase

๐Ÿ”„ Pull Request Process

Before Submitting

  1. Create an issue first (optional but recommended) โ€” Discuss the change you want to make
  2. Fork the repository โ€” Create your own copy
  3. Create a feature branch โ€” git checkout -b feature/your-feature-name or git checkout -b fix/your-bug-name
  4. Make your changes โ€” Follow the code style guidelines
  5. Write tests โ€” Ensure your changes are covered with appropriate tests
  6. Run all checks locally โ€” Ensure everything passes before submitting:
    # Fix linting and formatting issues
    ./dev/code-style.sh
    
    # Run tests
    ./dev/pytest.sh
    

Submitting

  1. Commit your changes โ€” Write clear, descriptive commit messages

    git add .
    git commit -m "feat: add new feature description"
    # or
    git commit -m "fix: resolve bug description"
    
  2. Push your branch to your fork

    git push origin feature/your-feature-name
    
  3. Open a Pull Request against the main branch

    • Fill out the PR description template
    • Reference related issues if applicable
    • Add screenshots or examples if relevant
  4. Wait for review โ€” Address feedback promptly

PR Guidelines

  • Keep PRs focused โ€” One feature/fix per PR
  • Write clear commit messages โ€” Use conventional commit format:
    • feat: for new features
    • fix: for bug fixes
    • docs: for documentation changes
    • refactor: for code refactoring
    • test: for test additions/changes
    • chore: for maintenance tasks
  • Update documentation โ€” If you add features or change behavior
  • Add tests โ€” New features should include tests
  • Ensure CI passes โ€” All GitHub Actions checks must pass
  • Keep PRs small โ€” Easier to review and merge

Pre-commit Checklist

Before submitting your PR, ensure:

  • Code follows style guidelines
  • All type hints are present and correct
  • Tests pass locally (./dev/pytest.sh)
  • Code style checks pass (./dev/code-style.sh --check)
  • Documentation is updated if needed
  • Commit messages are clear and descriptive

๐Ÿ› Reporting Issues

Bug Reports

When reporting a bug, please include:

  • RDSAI CLI version โ€” rdsai --version
  • Python version โ€” python --version or uv python list
  • Operating system โ€” OS name and version
  • Steps to reproduce โ€” Clear, step-by-step instructions
  • Expected behavior โ€” What you expected to happen
  • Actual behavior โ€” What actually happened
  • Error messages or logs โ€” Full error traceback if available
  • Configuration โ€” Relevant config files or settings (redact sensitive info)
  • Database version โ€” MySQL version if relevant

Feature Requests

When requesting a feature, please include:

  • Clear description โ€” What the feature should do
  • Use case โ€” Why is this needed? What problem does it solve?
  • Possible implementation approach โ€” Optional, but helpful
  • Alternatives considered โ€” What other solutions did you consider?

Issue Templates

Use GitHub issue templates when available:

  • Bug report template
  • Feature request template

๐Ÿ’ฌ Communication

  • GitHub Issues โ€” Bug reports, feature requests, questions
  • GitHub Discussions โ€” General discussion, ideas, Q&A
  • Pull Requests โ€” Code contributions with review and discussion

๐Ÿ“œ License

By contributing, you agree that your contributions will be licensed under the MIT License.


Thank you for contributing to RDSAI CLI! ๐ŸŽ‰

Your contributions help make this project better for everyone. If you have questions or need help, don't hesitate to open an issue or start a discussion.