-
Notifications
You must be signed in to change notification settings - Fork 0
feat: repo polish – LICENSE, CI, tests, type hints, templates, Makefile #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --- | ||
| name: Bug Report | ||
| about: Report a bug or unexpected behaviour | ||
| labels: bug | ||
| --- | ||
|
|
||
| ## Describe the Bug | ||
| <!-- A clear and concise description of what the bug is. --> | ||
|
|
||
| ## Steps to Reproduce | ||
| 1. Go to '...' | ||
| 2. Click on '...' | ||
| 3. See error | ||
|
|
||
| ## Expected Behaviour | ||
| <!-- What you expected to happen. --> | ||
|
|
||
| ## Actual Behaviour | ||
| <!-- What actually happened. Include error messages or screenshots if relevant. --> | ||
|
|
||
| ## Environment | ||
| - **OS**: <!-- e.g. Windows 11, Ubuntu 22.04, macOS 14 --> | ||
| - **Python version**: <!-- e.g. 3.11.2 --> | ||
| - **Camera**: <!-- e.g. built-in laptop webcam, USB Logitech C920 --> | ||
| - **Browser (web UI only)**: <!-- e.g. Chrome 124 --> | ||
|
|
||
| ## Additional Context | ||
| <!-- Anything else that might help diagnose the issue. --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| name: Feature Request | ||
| about: Suggest a new feature or improvement | ||
| labels: enhancement | ||
| --- | ||
|
|
||
| ## Problem / Motivation | ||
| <!-- Describe the problem you're trying to solve or the gap you noticed. --> | ||
|
|
||
| ## Proposed Solution | ||
| <!-- Describe the feature you'd like to see. Be as specific as possible. --> | ||
|
|
||
| ## Alternatives Considered | ||
| <!-- Have you considered any alternative approaches? Why did you prefer this one? --> | ||
|
|
||
| ## Additional Context | ||
| <!-- Screenshots, mockups, links, or any other context that would help. --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ## Summary | ||
| <!-- A short description of the change and why it is needed. --> | ||
|
|
||
| ## Type of Change | ||
| - [ ] Bug fix | ||
| - [ ] New feature | ||
| - [ ] Refactor / code quality | ||
| - [ ] Documentation update | ||
| - [ ] Other: <!-- describe --> | ||
|
|
||
| ## Changes Made | ||
| <!-- List the key changes in this PR. --> | ||
| - | ||
|
|
||
| ## Testing | ||
| - [ ] Existing tests pass (`pytest tests/ -v`) | ||
| - [ ] New tests added for new functionality | ||
| - [ ] Manually tested with webcam | ||
|
|
||
| ## Checklist | ||
| - [ ] Code follows the project style (PEP 8, max line length 120) | ||
| - [ ] README updated if behaviour changed | ||
| - [ ] CHANGELOG.md updated under `[Unreleased]` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint (flake8) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Install flake8 | ||
| run: pip install flake8 | ||
|
|
||
| - name: Lint with flake8 | ||
| run: | | ||
| # Fail only on syntax errors and undefined names; style warnings are informational | ||
| flake8 src/ web_app.py --max-line-length=120 --select=E9,F63,F7,F82 | ||
|
|
||
| test: | ||
| name: Unit Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Install test dependencies | ||
| run: pip install pytest pandas numpy opencv-python-headless Pillow | ||
|
|
||
| - name: Run tests | ||
| run: pytest tests/ -v | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). | ||
|
|
||
| --- | ||
|
|
||
| ## [1.0.0] - 2026-01-22 | ||
|
|
||
| ### Added | ||
| - Real-time face recognition and attendance marking via webcam | ||
| - Flask web dashboard with live video preview (5 fps) | ||
| - Face enrollment via webcam capture directly in the browser | ||
| - Daily attendance records exported to CSV (`data/Attendance/`) | ||
| - CLI interface (`src/main.py`) for server or terminal-only environments | ||
| - OpenCV-based face recognition engine (`src/face_recognition.py`) — runs 100% locally, no cloud APIs | ||
| - Support for per-person image directories under `ImagesAttendance/` | ||
| - `GET /attendance` API endpoint for today's attendance list | ||
| - `GET /enrolled-persons` API endpoint for enrolled person names | ||
| - `POST /recognize` API endpoint for single-frame recognition | ||
| - `POST /enroll` API endpoint for face enrollment | ||
| - `GET /health` health-check endpoint | ||
| - `--host` and `--port` CLI flags for `web_app.py` | ||
|
|
||
| --- | ||
|
|
||
| ## [Unreleased] | ||
|
|
||
| ### Planned | ||
| - Database backend (PostgreSQL / MongoDB) | ||
| - Multi-camera support | ||
| - Liveness detection (anti-spoofing) | ||
| - REST API for external integration | ||
| - Docker containerisation | ||
| - Email / SMS notifications | ||
| - PDF / Excel report generation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # Contributing to Face Attendance System | ||
|
|
||
| Thank you for your interest in contributing! This guide will help you get set up quickly. | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Getting Started | ||
|
|
||
| ### 1. Fork & Clone | ||
|
|
||
| ```bash | ||
| git clone https://github.com/<your-username>/face-attendance-opencv-python.git | ||
| cd face-attendance-opencv-python | ||
| ``` | ||
|
|
||
| ### 2. Create a Virtual Environment | ||
|
|
||
| ```bash | ||
| python -m venv .venv | ||
| # Windows | ||
| .venv\Scripts\activate | ||
| # macOS/Linux | ||
| source .venv/bin/activate | ||
| ``` | ||
|
|
||
| ### 3. Install Dependencies | ||
|
|
||
| ```bash | ||
| pip install -r requirements.txt | ||
| pip install pytest flake8 # dev/test tools | ||
| ``` | ||
|
|
||
| ### 4. Verify Your Setup | ||
|
|
||
| ```bash | ||
| # Run the test suite | ||
| pytest tests/ -v | ||
|
|
||
| # Run the linter | ||
| flake8 src/ web_app.py --max-line-length=120 --select=E9,F63,F7,F82 | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 🌿 Branching | ||
|
|
||
| - Branch from `main` using a descriptive name: | ||
| - `feature/multi-camera-support` | ||
| - `fix/attendance-duplicate-entry` | ||
| - `docs/update-installation` | ||
|
|
||
| --- | ||
|
|
||
| ## ✅ Pull Request Checklist | ||
|
|
||
| Before opening a PR, please make sure: | ||
|
|
||
| - [ ] The existing tests still pass (`pytest tests/ -v`) | ||
| - [ ] New functionality includes tests where applicable | ||
| - [ ] Code follows the existing style (PEP 8, max line length 120) | ||
| - [ ] The README is updated if you changed behaviour or added features | ||
|
|
||
| --- | ||
|
|
||
| ## 🐛 Reporting Issues | ||
|
|
||
| Use the [GitHub issue tracker](https://github.com/icecold009/face-attendance-opencv-python/issues). | ||
| Please include: | ||
|
|
||
| - Python version and OS | ||
| - Steps to reproduce | ||
| - Expected vs. actual behaviour | ||
| - Any relevant error output or screenshots | ||
|
|
||
| --- | ||
|
|
||
| ## 📄 License | ||
|
|
||
| By contributing you agree that your contributions will be licensed under the project's [MIT License](LICENSE). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 icecold009 | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| .PHONY: install run run-cli test lint clean | ||
|
|
||
| install: | ||
| pip install -r requirements.txt | ||
|
|
||
| run: | ||
| python web_app.py | ||
|
|
||
| run-cli: | ||
| cd src && python main.py | ||
|
|
||
| test: | ||
| python -m pytest tests/ -v | ||
|
|
||
| lint: | ||
| flake8 src/ web_app.py --max-line-length=120 --select=E9,F63,F7,F82 | ||
|
|
||
| clean: | ||
| find . -type d -name __pycache__ -exec rm -rf {} + | ||
| find . -type f -name "*.pyc" -delete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,4 +7,5 @@ cmake | |
| dlib>=19.7 | ||
| click | ||
| face-recognition-models | ||
| face-recognition>=1.3.0 | ||
| flask>=2.0.0 | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test job installs a minimal dependency set but does not install
face-recognition. Sincesrc/face_attendance_app.pyimportsface_recognitionat import time,pytestwill fail during import. Either install the full runtime deps here (e.g.,pip install -r requirements.txt) or adjust the application code/tests to avoid requiringface-recognitionto import/run the unit tests.