Thank you for your interest in contributing to OneCite! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Pull Request Process
- Coding Standards
- Testing
- Documentation
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to ang@hezhiang.com.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/OneCite.git cd OneCite - Add the upstream repository:
git remote add upstream https://github.com/HzaCode/OneCite.git
- Python 3.10 or higher
- pip
# Install the package in editable mode with development dependencies
pip install -e ".[dev]"# Run tests to verify everything is working
pytest
# Check code style
flake8 onecite testsIf you find a bug, please create an issue on GitHub with:
- A clear, descriptive title
- Steps to reproduce the problem
- Expected behavior vs. actual behavior
- Your environment (OS, Python version, OneCite version)
- Any relevant logs or error messages
Feature requests are welcome! Please create an issue with:
- A clear description of the feature
- Why this feature would be useful
- Any implementation ideas you have
-
Create a new branch for your feature or bugfix:
git checkout -b feature/your-feature-name # or git checkout -b fix/bug-description -
Make your changes following our Coding Standards
-
Add or update tests for your changes
-
Update documentation if needed
-
Run tests to ensure everything works:
pytest pytest --cov=onecite # Check coverage -
Commit your changes with a clear commit message:
git commit -m "feat: add support for new citation format" # or git commit -m "fix: resolve DOI parsing issue"
-
Update your fork with the latest upstream changes:
git fetch upstream git rebase upstream/main
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub with:
- A clear title and description
- Reference to any related issues
- Screenshots or examples if applicable
-
Address review comments promptly
-
Ensure CI passes - all tests must pass before merging
Use conventional commits format:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changestest:- Test additions or changesrefactor:- Code refactoringstyle:- Code style changes (formatting, etc.)chore:- Maintenance tasks
We follow PEP 8 style guide. Key points:
- Use 4 spaces for indentation (no tabs)
- Maximum line length: 100 characters
- Use descriptive variable and function names
- Add docstrings to all public functions and classes
Use type hints where possible:
def process_doi(doi: str) -> Dict[str, Any]:
"""Process a DOI and return citation data."""
passUse Google-style docstrings:
def example_function(param1: str, param2: int) -> bool:
"""
Brief description of function.
Args:
param1: Description of param1
param2: Description of param2
Returns:
Description of return value
Raises:
ValueError: When invalid input is provided
"""
pass# Run all tests
pytest
# Run specific test file
pytest tests/test_core.py
# Run with coverage
pytest --cov=onecite --cov-report=html
# Run verbose mode
pytest -v- Write tests for all new features and bug fixes
- Aim for >80% code coverage
- Use descriptive test function names
- Include docstrings explaining what the test does
- Use fixtures for common setup
Example:
def test_doi_parsing_valid_format():
"""Test that valid DOI formats are parsed correctly."""
doi = "10.1038/nature14539"
result = parse_doi(doi)
assert result is not None
assert result['prefix'] == "10.1038"- Add docstrings to all public functions, classes, and modules
- Keep docstrings up-to-date with code changes
- Include examples in docstrings when helpful
Documentation is in the docs/ directory using reStructuredText format:
# Build documentation
cd docs
make html
# View documentation
open _build/html/index.htmlUpdate README.md if your changes:
- Add new features
- Change installation process
- Modify usage examples
- Add new dependencies
If you have questions or need help:
- Open an issue on GitHub
- Check existing issues and documentation
- Email ang@hezhiang.com
Thank you for contributing to OneCite! 🎉