Contributing to DZDK CLI
Thank you for your interest in contributing to the Dzaleka Digital Heritage CLI! This guide will help you get started with contributing to the project.Getting Started
Prerequisites
Before you begin, ensure you have the following installed:- Python 3.8 or higher
- Git
- pip (Python package manager)
Fork and Clone
- Fork the Repository Visit the DZDK CLI repository and click the “Fork” button in the top-right corner.
-
Clone Your Fork
-
Add Upstream Remote
Development Environment Setup
1. Create a Virtual Environment
2. Install Dependencies
Install both production and development dependencies:click>=8.0.0- Command-line interface frameworkrequests>=2.26.0- HTTP library for API callsrich>=10.0.0- Rich terminal output formattingpyyaml>=6.0- YAML configuration file supportpandas>=2.0.0- Data manipulation and exporttabulate>=0.9.0- Table formattingprompt-toolkit>=3.0.0- Interactive shell featurespython-dateutil>=2.8.2- Date/time parsing
pytest==8.0.0- Testing frameworkpytest-cov==4.1.0- Code coverage reportingpytest-mock==3.12.0- Mocking support for testsblack==24.3.0- Code formatterflake8==7.0.0- Code lintermypy==1.8.0- Static type checker
3. Install in Editable Mode
Install the CLI in editable mode so changes are reflected immediately:dzdk commands while developing and testing your changes.
4. Verify Installation
Test that the CLI is working:Code Style Guidelines
Python Code Style
We follow PEP 8 guidelines with some project-specific conventions:Formatting
-
Use Black for automatic code formatting:
- Line length: Maximum 100 characters (Black default)
- Indentation: 4 spaces (no tabs)
- String quotes: Double quotes for docstrings, either for regular strings
Linting
- Run flake8 to check for style issues:
Type Checking
-
Use type hints where possible:
-
Run mypy for type checking:
Documentation
-
Use clear, descriptive docstrings for all functions and classes:
- Add inline comments for complex logic
- Update README.md when adding new features or commands
Rich Output Guidelines
-
Use Rich library for consistent terminal output:
console.print()for formatted outputcreate_header()for section headerscreate_info_panel()for information boxescreate_table()for tabular data
-
Follow the existing color scheme:
- Info: cyan
- Warning: yellow
- Danger/Error: red
- Success: green
- Title: bold cyan
- Highlight: bold yellow
Error Handling
Follow the established error handling patterns:Making Changes
Create a Feature Branch
feature/add-export-command- for new featuresfix/api-timeout-handling- for bug fixesdocs/update-readme- for documentation updatesrefactor/improve-error-handling- for refactoring
Development Workflow
- Make your changes in the appropriate files
-
Format your code with Black:
-
Check for linting issues:
-
Run tests to ensure nothing is broken:
- Add tests for new functionality (see Testing Guide)
-
Update documentation if needed:
- Update README.md with new commands
- Add docstrings to new functions
- Update help text for CLI commands
Commit Guidelines
- Write clear, descriptive commit messages
- Use the present tense (“Add feature” not “Added feature”)
- Reference issues when applicable
Pull Request Process
Before Submitting
-
Update your branch with the latest changes:
-
Run the full test suite:
-
Verify code quality:
-
Test manually by running the CLI with your changes:
Submitting Your PR
-
Push your changes:
- Create a Pull Request on GitHub
-
Fill out the PR template with:
- Clear description of changes
- Motivation and context
- Screenshots (if UI changes)
- Testing steps
- Related issues
- Address review feedback promptly
PR Requirements
- ✅ All tests pass
- ✅ Code is formatted with Black
- ✅ No linting errors from flake8
- ✅ New tests added for new features
- ✅ Documentation updated (if applicable)
- ✅ Commit messages are clear and descriptive
Adding New Features
When adding new features to the CLI:1. Follow Existing Structure
- Use Click decorators for commands and options
- Group related commands under command groups
- Example structure:
2. Add Error Handling
- Use try-except blocks for API calls
- Provide informative error messages
- Exit with appropriate status codes
3. Include Progress Indicators
- Use Rich Progress for long operations:
4. Add Documentation
- Update README.md with new command examples
- Add comprehensive docstrings
- Update help text for discoverability
5. Write Tests
See the Testing Guide for details on writing tests for new features.Code Review Process
All contributions go through code review:-
Automated checks run on your PR:
- Test suite execution
- Code quality checks
- Coverage reports
-
Manual review by maintainers:
- Code quality and style
- Functionality and correctness
- Documentation completeness
- Test coverage
-
Approval and merge:
- At least one maintainer approval required
- All checks must pass
- Branch must be up-to-date with main
Getting Help
If you need help or have questions:- Open an issue on GitHub for bugs or feature requests
- Start a discussion for questions or ideas
- Join our community at Dzaleka Connect
- Email us at contact@mail.dzaleka.com
Code of Conduct
By contributing, you agree to:- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Follow project guidelines