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): Runsruff checkandruff format --check - Test workflow (
python-package.yml): Runspyteston 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
- Create an issue first (optional but recommended) โ Discuss the change you want to make
- Fork the repository โ Create your own copy
- Create a feature branch โ
git checkout -b feature/your-feature-nameorgit checkout -b fix/your-bug-name - Make your changes โ Follow the code style guidelines
- Write tests โ Ensure your changes are covered with appropriate tests
- Run all checks locally โ Ensure everything passes before submitting:
# Fix linting and formatting issues ./dev/code-style.sh # Run tests ./dev/pytest.sh
Submitting
-
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" -
Push your branch to your fork
git push origin feature/your-feature-name -
Open a Pull Request against the
mainbranch- Fill out the PR description template
- Reference related issues if applicable
- Add screenshots or examples if relevant
-
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 featuresfix:for bug fixesdocs:for documentation changesrefactor:for code refactoringtest:for test additions/changeschore: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 --versionoruv 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.