Development Guide
May 26, 2026 ยท View on GitHub
Welcome to geek-computers Python repository! This guide will help you set up your development environment and contribute to the project.
Prerequisites
- Python 3.10+ (we test against 3.10, 3.11, and 3.12)
- pip (Python package manager)
- git
Setup
1. Clone the Repository
git clone https://github.com/geekcomputers/Python.git
cd Python
2. Create Virtual Environment
# On Linux/Mac
python3 -m venv venv
source venv/bin/activate
# On Windows
python -m venv venv
venv\Scripts\activate
3. Install Dependencies
pip install --upgrade pip
pip install -r requirements.txt
4. Install Development Tools
pip install ruff bandit mypy pytest codespell
Code Quality Checks
Before submitting a PR, run these checks locally:
Run Codespell (spell checking)
codespell --skip "*.json,*.txt,*.pdf,*.md"
Run Bandit (security analysis)
bandit -r . --skip B101,B105
Run Ruff (linting)
ruff check .
Run Pytest (unit tests)
pytest
Run MyPy (type checking)
mypy . --ignore-missing-imports
Writing Scripts
When adding new scripts:
- Use clear, descriptive names -
calculate_fibonacci.pyinstead oftest.py - Add docstrings - Describe what your script does
- Include comments - Explain complex logic
- Use type hints (where applicable) - Helps with code clarity
- Test your code - Run it locally before submitting
Example Script Template
"""
Module Name: Calculate Fibonacci Sequence
Description: Generate Fibonacci numbers up to N
Author: Your Name
Date: YYYY-MM-DD
"""
def fibonacci(n: int) -> list[int]:
"""
Generate Fibonacci sequence up to nth number.
Args:
n: Number of Fibonacci numbers to generate
Returns:
List of Fibonacci numbers
"""
if n <= 0:
return []
elif n == 1:
return [0]
fib = [0, 1]
for i in range(2, n):
fib.append(fib[i-1] + fib[i-2])
return fib
if __name__ == "__main__":
result = fibonacci(10)
print(result)
Submission Process
- Create a feature branch -
git checkout -b feature/your-feature-name - Make your changes - Add or modify scripts
- Run quality checks - Use the commands above
- Commit your changes - Use clear commit messages
- Push to your fork -
git push origin feature/your-feature-name - Create a Pull Request - Include description and testing info
Pull Request Guidelines
- Keep PRs focused on a single feature or fix
- Update README.md if adding new scripts
- Reference any related issues with "Closes #123"
- Follow the pull request template
Common Issues
ImportError for dependencies
Make sure you've activated the virtual environment and installed all requirements:
source venv/bin/activate # Linux/Mac
pip install -r requirements.txt
Tests fail locally but not in CI
Check your Python version - we test on 3.10, 3.11, and 3.12:
python --version
Code style issues
Run ruff with auto-fix:
ruff check . --fix
Need Help?
- Check existing issues
- Review the README.md for script documentation
- Email: craig@geekcomputers.co.uk
Happy coding! ๐