mirror of
https://github.com/ZGCA-Forge/MsgCenterPy.git
synced 2025-12-17 04:50:55 +00:00
Update docs
This commit is contained in:
@@ -3,98 +3,92 @@ Contributing to MsgCenterPy
|
||||
|
||||
Thank you for your interest in contributing to MsgCenterPy! This document provides guidelines for contributing to the project.
|
||||
|
||||
For detailed contribution guidelines, please see our `Contributing Guide <https://github.com/ZGCA-Forge/MsgCenterPy/blob/main/.github/CONTRIBUTING.md>`_ on GitHub.
|
||||
|
||||
Quick Links
|
||||
-----------
|
||||
|
||||
- `GitHub Repository <https://github.com/ZGCA-Forge/MsgCenterPy>`_
|
||||
- `Issue Tracker <https://github.com/ZGCA-Forge/MsgCenterPy/issues>`_
|
||||
- `Pull Requests <https://github.com/ZGCA-Forge/MsgCenterPy/pulls>`_
|
||||
- `Discussions <https://github.com/ZGCA-Forge/MsgCenterPy/discussions>`_
|
||||
|
||||
Development Setup
|
||||
-----------------
|
||||
|
||||
1. Fork the repository on GitHub
|
||||
2. Clone your fork locally
|
||||
3. Install in development mode:
|
||||
2. Clone your fork locally:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git clone https://github.com/YOUR-USERNAME/MsgCenterPy.git
|
||||
git clone https://github.com/YOUR_USERNAME/MsgCenterPy.git
|
||||
cd MsgCenterPy
|
||||
pip install -e .[dev]
|
||||
|
||||
4. Set up pre-commit hooks:
|
||||
3. (Optional) If you need ROS2 support, set up ROS environment first:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pre-commit install
|
||||
# Create and activate conda environment with ROS2
|
||||
conda create -n msgcenterpy-dev python=3.11
|
||||
conda activate msgcenterpy-dev
|
||||
conda install ros-humble-ros-core ros-humble-std-msgs ros-humble-geometry-msgs -c robostack-staging
|
||||
|
||||
4. Run the development setup script:
|
||||
|
||||
**Linux/macOS:**
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
./scripts/setup-dev.sh
|
||||
|
||||
**Windows:**
|
||||
|
||||
.. code-block:: powershell
|
||||
|
||||
.\scripts\setup-dev.ps1
|
||||
|
||||
The setup script will automatically:
|
||||
|
||||
- Install the package in development mode with all dependencies
|
||||
- Set up pre-commit hooks
|
||||
- Run initial code quality checks
|
||||
- Display helpful commands for development
|
||||
|
||||
Code Style and Quality
|
||||
----------------------
|
||||
|
||||
We use several tools to maintain code quality:
|
||||
We use automated code quality checks that run via pre-commit hooks:
|
||||
|
||||
- **Black**: Code formatting
|
||||
- **Black**: Code formatting (line length: 120)
|
||||
- **isort**: Import sorting
|
||||
- **flake8**: Code linting
|
||||
- **mypy**: Type checking
|
||||
- **pytest**: Testing
|
||||
- **bandit**: Security scanning
|
||||
- **prettier**: YAML/JSON formatting
|
||||
|
||||
Run quality checks:
|
||||
These checks run automatically when you commit. You can also run them manually:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Format code
|
||||
black msgcenterpy tests
|
||||
isort msgcenterpy tests
|
||||
|
||||
# Type checking
|
||||
mypy msgcenterpy
|
||||
|
||||
# Run tests
|
||||
pytest
|
||||
# Run all pre-commit hooks
|
||||
pre-commit run --all-files
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
Please ensure all tests pass and add tests for new features:
|
||||
**Important**: Always run tests before committing to ensure your changes work correctly.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
# Run all tests
|
||||
pytest
|
||||
|
||||
# Run with coverage
|
||||
# Run with verbose output
|
||||
pytest -v
|
||||
|
||||
# Run specific test file
|
||||
pytest tests/test_specific_module.py
|
||||
**Note**: If ROS2 is not installed, ROS-related tests will be automatically skipped. The test suite is designed to work with or without ROS2 dependencies.
|
||||
|
||||
Version Management
|
||||
------------------
|
||||
|
||||
This project uses `bump2version` for semantic version management. The tool is included in development dependencies and automatically manages version numbers across the codebase.
|
||||
|
||||
**Setup**
|
||||
|
||||
bump2version is automatically installed when you install development dependencies:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip install -e .[dev]
|
||||
|
||||
**Configuration**
|
||||
|
||||
Version configuration is stored in `.bumpversion.cfg`:
|
||||
|
||||
- **Single source of truth**: `msgcenterpy/__init__.py`
|
||||
- **Auto-commit**: Creates commit with version bump
|
||||
- **Auto-tag**: Creates git tag for new version
|
||||
- **Semantic versioning**: Follows MAJOR.MINOR.PATCH format
|
||||
|
||||
**Usage**
|
||||
This project uses `bump2version` for version management. It's automatically installed with dev dependencies.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -107,54 +101,25 @@ Version configuration is stored in `.bumpversion.cfg`:
|
||||
# Breaking changes (0.1.0 → 1.0.0)
|
||||
bump2version major
|
||||
|
||||
**Release Workflow**
|
||||
|
||||
1. Make your changes and commit them
|
||||
2. Choose appropriate version bump type
|
||||
3. Run bump2version command
|
||||
4. Push changes and tags:
|
||||
After bumping version, push changes and tags:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
git push && git push --tags
|
||||
|
||||
**Version Bump Guidelines**
|
||||
|
||||
- **patch**: Bug fixes, documentation updates, internal refactoring
|
||||
- **minor**: New features, backward-compatible API additions
|
||||
- **major**: Breaking changes, API removals or modifications
|
||||
|
||||
**Notes**
|
||||
|
||||
- Only developers need bump2version (it's in dev dependencies only)
|
||||
- Version numbers are automatically synchronized across all files
|
||||
- Git working directory must be clean before version bump
|
||||
- Each version bump creates a commit and git tag automatically
|
||||
|
||||
Submitting Changes
|
||||
------------------
|
||||
|
||||
1. Create a new branch for your feature/fix
|
||||
2. Make your changes
|
||||
3. Add tests for new functionality
|
||||
4. Ensure all tests pass
|
||||
5. Update documentation if needed
|
||||
6. Submit a pull request
|
||||
|
||||
Pull Request Guidelines
|
||||
-----------------------
|
||||
|
||||
- Use descriptive titles and descriptions
|
||||
- Reference related issues
|
||||
- Include tests for new features
|
||||
- Update documentation as needed
|
||||
- Follow the existing code style
|
||||
2. Make your changes and add tests
|
||||
3. Run tests to ensure everything works
|
||||
4. Update documentation if needed
|
||||
5. Submit a pull request with:
|
||||
- Descriptive title and description
|
||||
- Reference to related issues
|
||||
- Tests for new features
|
||||
|
||||
Getting Help
|
||||
------------
|
||||
|
||||
If you need help:
|
||||
|
||||
- Check existing `Issues <https://github.com/ZGCA-Forge/MsgCenterPy/issues>`_
|
||||
- Start a `Discussion <https://github.com/ZGCA-Forge/MsgCenterPy/discussions>`_
|
||||
- Contact the maintainers
|
||||
|
||||
Reference in New Issue
Block a user