Contributing to GigQ¶
This guide covers the development setup and contribution process.
Code of Conduct¶
By participating in this project, you agree to adhere to our Code of Conduct. Please treat other contributors with respect and maintain a positive and inclusive environment.
Getting Started¶
Prerequisites¶
To contribute to GigQ, you'll need:
- Python 3.10 or newer
- Git
- A GitHub account
Setting Up Your Development Environment¶
-
Fork the repository on GitHub.
-
Clone your fork to your local machine:
- Create a virtual environment:
- Install the package in development mode:
- Install development dependencies:
Development Workflow¶
Creating a Branch¶
Before making changes, create a branch from the main branch:
or
Making Changes¶
- Make your changes to the code.
- Add tests for any new functionality or bug fixes.
- Ensure all tests pass:
- Check formatting:
Committing Changes¶
- Stage your changes:
- Commit your changes with a descriptive message:
- Push your changes to your fork:
Submitting a Pull Request¶
- Go to the original GigQ repository on GitHub.
- Click on "Pull Requests" and then "New Pull Request".
- Click "compare across forks" and select your fork and branch.
- Add a title and description for your pull request.
- Submit the pull request.
Coding Standards¶
Python Style Guide¶
GigQ follows the PEP 8 style guide for Python code. Additionally:
- Use 4 spaces for indentation (no tabs).
- Add docstrings for all modules, classes, and functions.
- Keep line length to a maximum of 88 characters.
- Use descriptive variable names.
Docstrings¶
Use Google-style docstrings:
def function_example(param1, param2):
"""
A brief description of what the function does.
Args:
param1: Description of param1
param2: Description of param2
Returns:
Description of the return value
Raises:
ExceptionType: When and why this exception is raised
"""
Type Hints¶
Use type hints for function parameters and return values:
def function_with_type_hints(param1: str, param2: int) -> Dict[str, Any]:
"""
Example function with type hints.
"""
return {"param1": param1, "param2": param2}
Testing¶
Writing Tests¶
All new features and bug fixes should include tests. GigQ uses Python's built-in unittest framework:
import unittest
from gigq import Job, JobQueue
class TestJobQueue(unittest.TestCase):
def setUp(self):
# Setup code
self.queue = JobQueue(":memory:")
def test_submit_job(self):
job = Job(name="test", function=lambda: None)
job_id = self.queue.submit(job)
self.assertIsNotNone(job_id)
def tearDown(self):
# Cleanup code
pass
Running Tests¶
Run the entire test suite:
Run a specific test:
Documentation¶
Updating Documentation¶
GigQ uses MkDocs with the Material theme for documentation. To update documentation:
- Edit the markdown files in the
docs/directory. - Preview your changes locally:
- Ensure your documentation changes are included in your pull request.
Adding Examples¶
If you're adding a new feature, consider adding an example to the examples/ directory to demonstrate its usage. Make sure to update the documentation to reference your example.
Git Commit Messages¶
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests after the first line
Releasing¶
The release process is handled by the project maintainers. If you're interested in helping with releases, please contact one of the maintainers.
Getting Help¶
Open an issue on GitHub if you're stuck or have questions about the contribution process.