|
1 | 1 | # Contributing to CTk Interactive Canvas |
2 | 2 |
|
3 | | -Thank you for your interest in contributing to CTk Interactive Canvas! This document provides guidelines and instructions for contributing. |
| 3 | +Contributions are welcome. The guidelines below keep changes reviewable and consistent with the rest of the codebase. |
4 | 4 |
|
5 | | -## Code of Conduct |
| 5 | +## Reporting Issues |
6 | 6 |
|
7 | | -- Be respectful and inclusive |
8 | | -- Focus on constructive feedback |
9 | | -- Assume good intentions |
10 | | -- Help others learn and grow |
| 7 | +When reporting a bug, include the Python version, CustomTkinter version, operating system, a minimal reproduction, the expected and actual behavior, and any traceback. Search existing issues first. |
11 | 8 |
|
12 | | -## How to Contribute |
13 | | - |
14 | | -### Reporting Bugs |
15 | | - |
16 | | -1. **Check existing issues** - Search the issue tracker first |
17 | | -2. **Create a clear report** - Include: |
18 | | - - Python version |
19 | | - - CustomTkinter version |
20 | | - - Operating system |
21 | | - - Minimal code to reproduce the issue |
22 | | - - Expected vs actual behavior |
23 | | - - Error messages and tracebacks |
24 | | - |
25 | | -### Suggesting Features |
26 | | - |
27 | | -1. **Check existing issues** - Someone may have already suggested it |
28 | | -2. **Describe the use case** - Explain why this feature is needed |
29 | | -3. **Provide examples** - Show how it would be used |
30 | | -4. **Consider alternatives** - Discuss other approaches |
31 | | - |
32 | | -### Submitting Pull Requests |
33 | | - |
34 | | -#### Before You Start |
35 | | - |
36 | | -1. **Discuss major changes** - Open an issue first for significant changes |
37 | | -2. **Check for existing work** - Review open pull requests |
38 | | -3. **Fork the repository** - Work in your own fork |
39 | | - |
40 | | -#### Development Setup |
| 9 | +## Development Setup |
41 | 10 |
|
42 | 11 | ```bash |
43 | | -git clone https://github.com/YourUsername/ctk_interactive_canvas.git |
| 12 | +git clone https://github.com/DeltaGa/ctk_interactive_canvas.git |
44 | 13 | cd ctk_interactive_canvas |
45 | 14 | pip install -e ".[dev]" |
46 | 15 | ``` |
47 | 16 |
|
48 | | -#### Code Standards |
| 17 | +## Standards |
49 | 18 |
|
50 | | -**Style Guidelines**: |
51 | | -- Follow PEP 8 |
52 | | -- Use PEP 257 docstrings |
53 | | -- Type hints on all functions/methods |
54 | | -- Line length: 100 characters maximum |
55 | | -- No comments (documentation via docstrings only) |
| 19 | +- Follow the conventions in [STYLE.md](STYLE.md) and [OPTIMIZATION.md](OPTIMIZATION.md). |
| 20 | +- PEP 8, PEP 257 docstrings, full type hints, 100-character lines. |
| 21 | +- Format and lint before committing: |
56 | 22 |
|
57 | | -**Run formatters**: |
58 | 23 | ```bash |
59 | 24 | black . |
60 | 25 | ruff check --fix . |
61 | | -``` |
62 | | - |
63 | | -**Type checking**: |
64 | | -```bash |
65 | 26 | mypy src/ctk_interactive_canvas |
66 | 27 | ``` |
67 | 28 |
|
68 | | -#### Testing Requirements |
| 29 | +## Testing |
69 | 30 |
|
70 | | -1. **Write tests** - All new features must include tests |
71 | | -2. **Maintain coverage** - Aim for >80% code coverage |
72 | | -3. **Run test suite**: |
73 | | -```bash |
74 | | -pytest |
75 | | -``` |
| 31 | +All new behavior must include tests. Run the suite with coverage before opening a pull request: |
76 | 32 |
|
77 | | -4. **Run with coverage**: |
78 | 33 | ```bash |
79 | 34 | pytest --cov=ctk_interactive_canvas --cov-report=term-missing |
80 | 35 | ``` |
81 | 36 |
|
82 | | -#### Commit Guidelines |
83 | | - |
84 | | -**Commit messages**: |
85 | | -- Use present tense ("Add feature" not "Added feature") |
86 | | -- Be descriptive and concise |
87 | | -- Reference issue numbers when applicable |
88 | | - |
89 | | -**Example**: |
90 | | -``` |
91 | | -Add support for polygon shapes (#123) |
92 | | -
|
93 | | -- Implement DraggablePolygon class |
94 | | -- Add polygon creation methods to InteractiveCanvas |
95 | | -- Include tests for polygon operations |
96 | | -``` |
97 | | - |
98 | | -#### Pull Request Process |
99 | | - |
100 | | -1. **Update documentation** - Modify README.md if needed |
101 | | -2. **Update CHANGELOG.md** - Add entry under [Unreleased] |
102 | | -3. **Ensure tests pass** - All CI checks must pass |
103 | | -4. **Request review** - Tag maintainers if needed |
104 | | -5. **Address feedback** - Respond to review comments |
105 | | - |
106 | | -### Code Organization |
107 | | - |
108 | | -``` |
109 | | -ctk_interactive_canvas/ |
110 | | -├── src/ |
111 | | -│ └── ctk_interactive_canvas/ |
112 | | -│ ├── __init__.py |
113 | | -│ ├── interactive_canvas.py |
114 | | -│ └── draggable_rectangle.py |
115 | | -├── tests/ |
116 | | -│ ├── test_canvas.py |
117 | | -│ ├── test_rectangle.py |
118 | | -│ └── test_integration.py |
119 | | -├── pyproject.toml |
120 | | -└── README.md |
121 | | -``` |
122 | | - |
123 | | -### Development Philosophy |
124 | | - |
125 | | -**Core Principles**: |
126 | | -1. **Simplicity** - Prefer simple, clear solutions |
127 | | -2. **Performance** - Optimize hot paths, profile before optimizing |
128 | | -3. **Compatibility** - Maintain backwards compatibility when possible |
129 | | -4. **Documentation** - Code should be self-documenting |
130 | | -5. **Type Safety** - Use type hints throughout |
131 | | - |
132 | | -**What We Value**: |
133 | | -- Clean, readable code over clever tricks |
134 | | -- Comprehensive tests over perfect coverage metrics |
135 | | -- User experience over feature count |
136 | | -- Backwards compatibility over breaking changes |
137 | | - |
138 | | -### Adding New Features |
139 | | - |
140 | | -**Checklist**: |
141 | | -- [ ] Feature discussed in an issue |
142 | | -- [ ] Code follows style guidelines |
143 | | -- [ ] Type hints added |
144 | | -- [ ] Docstrings added (PEP 257) |
145 | | -- [ ] Tests written (>80% coverage) |
146 | | -- [ ] Tests pass |
147 | | -- [ ] Documentation updated |
148 | | -- [ ] CHANGELOG.md updated |
149 | | -- [ ] No breaking changes (or documented and justified) |
150 | | - |
151 | | -### Performance Guidelines |
152 | | - |
153 | | -- Profile before optimizing |
154 | | -- Use appropriate data structures |
155 | | -- Avoid premature optimization |
156 | | -- Document performance-critical sections |
157 | | -- Include benchmarks for significant optimizations |
158 | | - |
159 | | -### Documentation Standards |
160 | | - |
161 | | -**Docstrings** (PEP 257): |
162 | | -```python |
163 | | -def function(arg1: int, arg2: str) -> bool: |
164 | | - """ |
165 | | - Brief one-line description. |
166 | | - |
167 | | - Args: |
168 | | - arg1: Description of arg1. |
169 | | - arg2: Description of arg2. |
170 | | - |
171 | | - Returns: |
172 | | - Description of return value. |
173 | | - |
174 | | - Raises: |
175 | | - ValueError: When this happens. |
176 | | - """ |
177 | | -``` |
178 | | - |
179 | | -**README updates**: |
180 | | -- Keep examples simple and clear |
181 | | -- Test all code examples |
182 | | -- Update API reference if needed |
183 | | - |
184 | | -### Release Process |
185 | | - |
186 | | -(Maintainers only) |
187 | | - |
188 | | -1. Update version in `pyproject.toml` and `src/ctk_interactive_canvas/__init__.py` |
189 | | -2. Update CHANGELOG.md with release date |
190 | | -3. Create git tag: `git tag -a v0.x.0 -m "Release 0.x.0"` |
191 | | -4. Push tag: `git push origin v0.x.0` |
192 | | -5. GitHub Actions will automatically publish to PyPI |
193 | | - |
194 | | -### Questions? |
195 | | - |
196 | | -- **Documentation**: Check README.md first |
197 | | -- **Issues**: Search existing issues |
198 | | -- **Discussions**: Use GitHub Discussions for questions |
199 | | -- **Contact**: dev.github.tkjoramsmith@outlook.com |
| 37 | +## Pull Requests |
200 | 38 |
|
201 | | -## License |
| 39 | +1. Discuss significant changes in an issue first. |
| 40 | +2. Keep commits focused, with present-tense messages that reference issues where applicable. |
| 41 | +3. Update the README and add a `CHANGELOG.md` entry under `[Unreleased]`. |
| 42 | +4. Ensure the full suite and CI checks pass. |
202 | 43 |
|
203 | | -By contributing, you agree that your contributions will be licensed under the MIT License. |
| 44 | +By contributing, you agree that your contributions are licensed under the MIT License. |
204 | 45 |
|
205 | 46 | --- |
206 | 47 |
|
207 | | -**Thank you for contributing!** 🎉 |
| 48 | +© 2026 DeltaGa. All rights reserved. |
0 commit comments