This commit adds extensive documentation to the Mistral OCR CLI project: - Add API.md with detailed API response format documentation - Add CHANGELOG.md to track version changes - Add CONTRIBUTING.md with guidelines for contributors - Enhance README.md with more detailed usage examples and troubleshooting - Add proper docstrings to all Python modules and functions - Update requirements.txt with development dependencies - Improve setup.py with better metadata These changes make the project more accessible to users and contributors.
4.3 KiB
Contributing to Mistral OCR CLI
Thank you for your interest in contributing to Mistral OCR CLI! This document provides guidelines and instructions for contributing to this project.
Table of Contents
Code of Conduct
Please be respectful and considerate of others when contributing to this project. We aim to foster an inclusive and welcoming community.
Getting Started
Development Environment Setup
-
Fork and clone the repository:
git clone https://github.com/yourusername/mistral-ocr-python.git cd mistral-ocr-python -
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate -
Install the package in development mode:
pip install -e . -
Install development dependencies:
pip install pytest pytest-cov black flake8
Project Structure
mistral-ocr-python/
├── mistral_ocr/ # Main package
│ ├── __init__.py
│ ├── __main__.py # CLI entry point
│ ├── client.py # Mistral API client
│ └── commands/ # Command implementations
│ ├── __init__.py
│ ├── convert.py # Convert command
│ ├── markdown.py # Markdown command
│ ├── process.py # Process command
│ └── version.py # Version command
├── tests/ # Test directory
├── .gitignore
├── README.md
├── CONTRIBUTING.md
├── LICENSE
├── requirements.txt
├── setup.py
└── build.sh
Development Workflow
Creating a Feature
-
Create a new branch:
git checkout -b feature/your-feature-name -
Make your changes:
- Implement your feature or fix
- Add or update tests as necessary
- Update documentation to reflect your changes
-
Commit your changes:
git add . git commit -m "Add feature: your feature description"
Testing
We use pytest for testing. To run the tests:
python -m pytest
For coverage report:
python -m pytest --cov=mistral_ocr
Please ensure that your code is well-tested and that all tests pass before submitting a pull request.
Documentation
- Update the README.md if your changes affect the usage of the tool
- Add docstrings to your code following the Google style guide
- Update or add examples if necessary
Pull Request Process
-
Push your changes to your fork:
git push origin feature/your-feature-name -
Create a pull request from your fork to the main repository
-
Describe your changes in the pull request:
- What does this PR add or fix?
- Any breaking changes?
- Any dependencies added?
-
Address review comments if any are provided
-
Your PR will be merged once it's approved
Coding Standards
We follow PEP 8 and use Black for code formatting:
black mistral_ocr
For linting:
flake8 mistral_ocr
General guidelines:
- Use descriptive variable and function names
- Add type hints to function signatures
- Write docstrings for all functions, classes, and modules
- Keep functions small and focused on a single task
- Use comments to explain complex logic
Release Process
Releases are managed by the project maintainers. If you'd like to propose a release:
-
Update the version number in:
mistral_ocr/commands/version.pysetup.py
-
Update the CHANGELOG.md with the changes in the new version
-
Create a pull request with these changes
-
Once merged, the maintainers will create a new release tag
Thank you for contributing to Mistral OCR CLI!