Skip to content

Commit 58bd0c5

Browse files
committed
chore: restructure project for public open-source release
Major project reorganization to improve maintainability and follow open-source best practices: ### Documentation - Reorganize all docs into docs/ folder - Create comprehensive installation guide (consolidates SETUP.md + SERVICE-SETUP.md) - Create detailed configuration reference - Create development guide (consolidates CLAUDE.md + TESTING.md) - Update all README.md links to new structure - Add Tests badge to README ### Scripts - Move all scripts to scripts/ folder for better organization - Update README examples to use new paths ### Open Source Best Practices - Add MIT LICENSE file - Add CONTRIBUTING.md with detailed contribution guidelines - Add .github/ISSUE_TEMPLATE/ for bug reports and feature requests - Add .github/PULL_REQUEST_TEMPLATE.md for PR submissions - Add .github/workflows/tests.yml for CI/CD with GitHub Actions - Code quality checks (Black, Ruff, mypy) - Unit tests across Python 3.9-3.12 - Security scanning (Bandit, Safety) - Codecov integration ### Security & Best Practices - Remove .env from git tracking (was committed by mistake) - Update .gitignore with comprehensive exclusions - Add .claude/ to gitignore ### Cleanup - Remove obsolete files: CLAUDE.md, MIGRATION.md, SETUP.md, SERVICE-SETUP.md, TESTING.md - Consolidate documentation to reduce duplication ### New Project Structure ``` pi-camera-service/ ├── .github/ # GitHub templates and workflows ├── docs/ # All documentation ├── scripts/ # Installation and test scripts ├── camera_service/ # Main application ├── tests/ # Test suite ├── LICENSE # MIT License ├── CONTRIBUTING.md # Contribution guidelines ├── CHANGELOG.md # Version history └── README.md # Project overview ``` This prepares the project for public release on GitHub with professional organization and contribution workflows.
1 parent 6396803 commit 58bd0c5

23 files changed

+2614
-1591
lines changed

.env

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug or issue
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Bug Description
10+
11+
A clear and concise description of the bug.
12+
13+
## Environment
14+
15+
- **Raspberry Pi Model:** (e.g., Pi 5, Pi 4, Zero 2W)
16+
- **Camera Model:** (e.g., Camera Module 3, Camera Module 3 Wide NoIR, HQ Camera)
17+
- **OS Version:** (run `cat /etc/os-release`)
18+
- **Python Version:** (run `python --version`)
19+
- **Service Version:** (run `cat VERSION`)
20+
21+
## Steps to Reproduce
22+
23+
1. Step one
24+
2. Step two
25+
3. Step three
26+
4. See error
27+
28+
## Expected Behavior
29+
30+
What you expected to happen.
31+
32+
## Actual Behavior
33+
34+
What actually happened.
35+
36+
## Logs
37+
38+
Please provide relevant log output:
39+
40+
```bash
41+
sudo journalctl -u pi-camera-service -n 100
42+
```
43+
44+
<details>
45+
<summary>Logs (click to expand)</summary>
46+
47+
```
48+
[paste logs here]
49+
```
50+
51+
</details>
52+
53+
## Configuration
54+
55+
Your `.env` configuration (remove sensitive data like API keys!):
56+
57+
```bash
58+
CAMERA_WIDTH=1920
59+
CAMERA_HEIGHT=1080
60+
# ... other settings
61+
```
62+
63+
## Screenshots
64+
65+
If applicable, add screenshots to help explain the problem.
66+
67+
## Additional Context
68+
69+
Any other context about the problem.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: Feature Request
3+
about: Suggest a new feature or enhancement
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Problem Statement
10+
11+
What problem does this feature solve? Why is it needed?
12+
13+
## Proposed Solution
14+
15+
How should this feature work? Be as detailed as possible.
16+
17+
## Use Case
18+
19+
Describe a real-world scenario where this feature would be useful.
20+
21+
## Example
22+
23+
If applicable, provide code examples or API usage:
24+
25+
```bash
26+
# Example API call
27+
curl -X POST http://localhost:8000/v1/camera/new_feature \
28+
-H "Content-Type: application/json" \
29+
-d '{"param": "value"}'
30+
```
31+
32+
## Alternatives Considered
33+
34+
What other approaches did you consider? Why is this solution better?
35+
36+
## Camera Compatibility
37+
38+
Which camera models should this work with?
39+
40+
- [ ] Camera Module 3 / 3 Wide
41+
- [ ] HQ Camera
42+
- [ ] Camera Module v2
43+
- [ ] NoIR variants
44+
- [ ] All cameras
45+
46+
## Additional Context
47+
48+
Screenshots, links to similar features, references, etc.
49+
50+
## Willingness to Contribute
51+
52+
- [ ] I would like to implement this feature myself
53+
- [ ] I can test this feature when implemented
54+
- [ ] I can provide feedback during development

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Pull Request
2+
3+
## Description
4+
5+
Brief description of what this PR does.
6+
7+
Fixes # (issue number)
8+
9+
## Type of Change
10+
11+
- [ ] Bug fix (non-breaking change that fixes an issue)
12+
- [ ] New feature (non-breaking change that adds functionality)
13+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
14+
- [ ] Documentation update
15+
- [ ] Code refactoring
16+
- [ ] Performance improvement
17+
- [ ] Test improvement
18+
19+
## Changes Made
20+
21+
- Change 1
22+
- Change 2
23+
- Change 3
24+
25+
## Testing
26+
27+
### Test Environment
28+
29+
- **Raspberry Pi Model:**
30+
- **Camera Model:**
31+
- **OS Version:**
32+
- **Python Version:**
33+
34+
### Tests Performed
35+
36+
- [ ] All existing tests pass (`pytest`)
37+
- [ ] New tests added for new functionality
38+
- [ ] Manual testing completed
39+
- [ ] Integration tests pass (`./scripts/test-api-v2.sh`)
40+
- [ ] Code coverage maintained (>80%)
41+
42+
### Test Results
43+
44+
```bash
45+
# Paste pytest output here
46+
```
47+
48+
## Code Quality
49+
50+
- [ ] Code follows project style guidelines
51+
- [ ] Black formatting applied (`black camera_service tests`)
52+
- [ ] Ruff linting passed (`ruff check camera_service tests`)
53+
- [ ] Type checking passed (`mypy camera_service`)
54+
- [ ] Docstrings added to public methods
55+
- [ ] Type hints added to new functions
56+
57+
## Documentation
58+
59+
- [ ] README.md updated (if needed)
60+
- [ ] docs/ updated (if needed)
61+
- [ ] CHANGELOG.md updated
62+
- [ ] API documentation updated (if API changes)
63+
- [ ] Configuration documentation updated (if new config options)
64+
- [ ] .env.example updated (if new environment variables)
65+
66+
## Backwards Compatibility
67+
68+
- [ ] This change is backwards compatible
69+
- [ ] This change breaks compatibility (documented in CHANGELOG.md)
70+
71+
## Screenshots (if applicable)
72+
73+
Add screenshots or API examples demonstrating the changes.
74+
75+
## Additional Notes
76+
77+
Any additional information reviewers should know.
78+
79+
## Checklist
80+
81+
- [ ] My code follows the contribution guidelines
82+
- [ ] I have performed a self-review of my code
83+
- [ ] I have commented my code, particularly in hard-to-understand areas
84+
- [ ] My changes generate no new warnings
85+
- [ ] I have added tests that prove my fix is effective or that my feature works
86+
- [ ] New and existing unit tests pass locally
87+
- [ ] Any dependent changes have been merged and published

.github/workflows/tests.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master, develop ]
6+
pull_request:
7+
branches: [ master, develop ]
8+
9+
jobs:
10+
lint:
11+
name: Code Quality
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.11'
22+
23+
- name: Cache pip packages
24+
uses: actions/cache@v4
25+
with:
26+
path: ~/.cache/pip
27+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-dev.txt') }}
28+
restore-keys: |
29+
${{ runner.os }}-pip-
30+
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install black ruff mypy
35+
36+
- name: Check formatting with Black
37+
run: black --check camera_service tests
38+
39+
- name: Lint with Ruff
40+
run: ruff check camera_service tests
41+
42+
- name: Type check with mypy
43+
run: mypy camera_service --ignore-missing-imports
44+
45+
test:
46+
name: Unit Tests
47+
runs-on: ubuntu-latest
48+
strategy:
49+
matrix:
50+
python-version: ['3.9', '3.10', '3.11', '3.12']
51+
52+
steps:
53+
- name: Checkout code
54+
uses: actions/checkout@v4
55+
56+
- name: Set up Python ${{ matrix.python-version }}
57+
uses: actions/setup-python@v5
58+
with:
59+
python-version: ${{ matrix.python-version }}
60+
61+
- name: Cache pip packages
62+
uses: actions/cache@v4
63+
with:
64+
path: ~/.cache/pip
65+
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt', 'requirements-dev.txt') }}
66+
restore-keys: |
67+
${{ runner.os }}-${{ matrix.python-version }}-pip-
68+
69+
- name: Install dependencies
70+
run: |
71+
python -m pip install --upgrade pip
72+
pip install -r requirements.txt
73+
pip install -r requirements-dev.txt
74+
75+
- name: Run unit tests with coverage
76+
run: |
77+
pytest tests/ \
78+
--ignore=tests/test_api_integration.py \
79+
--cov=camera_service \
80+
--cov-report=xml \
81+
--cov-report=term-missing \
82+
-v
83+
84+
- name: Upload coverage to Codecov
85+
uses: codecov/codecov-action@v4
86+
if: matrix.python-version == '3.11'
87+
with:
88+
file: ./coverage.xml
89+
flags: unittests
90+
name: codecov-umbrella
91+
fail_ci_if_error: false
92+
93+
security:
94+
name: Security Scan
95+
runs-on: ubuntu-latest
96+
97+
steps:
98+
- name: Checkout code
99+
uses: actions/checkout@v4
100+
101+
- name: Run Bandit security scan
102+
uses: PyCQA/bandit-action@v1
103+
with:
104+
path: camera_service
105+
106+
- name: Check for known vulnerabilities
107+
run: |
108+
python -m pip install --upgrade pip
109+
pip install safety
110+
safety check --file requirements.txt --output text || true

0 commit comments

Comments
 (0)