Contributing to ray-ascend

Thank you for your interest in contributing to ray-ascend! This document provides guidelines and instructions for contributing to the project.

Getting Started

  1. Fork the repository on GitHub
  2. Clone your fork locally:
    git clone https://gitcode.com/YOUR_USERNAME/ray-ascend.git
    cd ray-ascend
    
  3. Add the upstream repository:
    git remote add upstream https://gitcode.com/Ascend/ray-ascend.git
    

Development Setup

  1. Create a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  2. Install the package in development mode:

    pip install -e .
    
  3. Install pre-commit hooks:

    pip install pre-commit
    pre-commit install
    

Making Changes

  1. Create a new branch for your changes:

    git checkout -b feature/your-feature-name
    
  2. Make your changes and commit them:

    git add .
    git commit -m "Description of your changes"
    
  3. Push your changes to your fork:

    git push origin feature/your-feature-name
    
  4. Open a pull request on GitHub

Code Style

This project uses the following tools to maintain code quality:

  • black: Code formatting
  • isort: Import sorting
  • flake8: Linting
  • mypy: Type checking

Pre-commit hooks will automatically run these tools before each commit. You can also run them manually:

# Format code
black .

# Sort imports
isort .

# Run linter
flake8 .

# Type checking
mypy .

Testing

Before submitting a pull request, please ensure that:

  1. All existing tests pass
  2. New features include appropriate tests
  3. Code coverage is maintained or improved

Run tests with:

pytest

Pull Request Guidelines

  • Keep pull requests focused on a single feature or bug fix
  • Write clear, descriptive commit messages
  • Update documentation as needed
  • Ensure all tests pass
  • Follow the existing code style
  • Add tests for new features

Reporting Issues

When reporting issues, please include:

  • A clear description of the problem
  • Steps to reproduce the issue
  • Expected behavior
  • Actual behavior
  • Environment details (OS, Python version, etc.)

Code of Conduct

  • Be respectful and inclusive
  • Welcome newcomers and help them get started
  • Focus on constructive feedback
  • Assume good intentions

Questions?

If you have questions about contributing, feel free to:

  • Open an issue for discussion
  • Reach out to the maintainers

Thank you for contributing to ray-ascend!