-
-
Notifications
You must be signed in to change notification settings - Fork 20
Update from task c1cfb1d8-08f1-4b59-adfb-791673e37be7 #90
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
Open
mrayanasim09
wants to merge
3
commits into
actions/black
Choose a base branch
from
writing-unit-tests-37be7
base: actions/black
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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,96 @@ | ||
| name: Test & Coverage | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| branches: [main, master] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.10", "3.11", "3.12"] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: 'pip' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| python -m pip install -e ".[test]" | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
|
|
||
| - name: Run tests with coverage | ||
| run: | | ||
| pytest --cov=Utilities --cov-report=xml --cov-report=term-missing | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| file: ./coverage.xml | ||
| flags: unittests | ||
| env_vars: OS,PYTHON | ||
| name: codecov-umbrella | ||
| fail_ci_if_error: false | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.10' | ||
| cache: 'pip' | ||
|
|
||
| - name: Install linting tools | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install flake8 black isort mypy | ||
|
|
||
| - name: Check formatting with Black | ||
| run: black --check --line-length=100 . | ||
|
|
||
| - name: Check imports with isort | ||
| run: isort --check-only --profile black . | ||
|
|
||
| - name: Lint with Flake8 | ||
| run: | | ||
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
| flake8 . --count --max-line-length=100 --statistics | ||
|
|
||
| - name: Type checking with MyPy | ||
| run: | | ||
| mypy Utilities --ignore-missing-imports --warn-return-any || true | ||
|
|
||
| security: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.10' | ||
|
|
||
| - name: Install Bandit | ||
| run: pip install bandit | ||
|
|
||
| - name: Run Bandit security scan | ||
| run: bandit -r . -lll -f json -o bandit-report.json || true | ||
|
|
||
| - name: Upload Bandit report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: bandit-security-report | ||
| path: bandit-report.json | ||
| retention-days: 30 |
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,41 @@ | ||
| ``` | ||
| # Dependencies | ||
| .venv/ | ||
| venv/ | ||
| __pycache__/ | ||
| *.pyc | ||
| *.pyo | ||
| *.pyd | ||
|
|
||
| # Build artifacts | ||
| dist/ | ||
| build/ | ||
| *.egg-info/ | ||
|
|
||
| # Environment | ||
| .env | ||
| .env.local | ||
| *.env.* | ||
|
|
||
| # Editors | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # Logs | ||
| *.log | ||
|
|
||
| # Coverage | ||
| .coverage | ||
| coverage/ | ||
| htmlcov/ | ||
|
|
||
| # Testing | ||
| .pytest_cache/ | ||
| .mypy_cache/ | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
| ``` |
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,90 @@ | ||
| # Pre-commit configuration for python-projects repository | ||
| # See https://pre-commit.com for more information | ||
|
|
||
| repos: | ||
| # Core Python formatting and linting | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v4.5.0 | ||
| hooks: | ||
| - id: trailing-whitespace | ||
| - id: end-of-file-fixer | ||
| - id: check-yaml | ||
| - id: check-json | ||
| - id: check-added-large-files | ||
| args: ['--maxkb=1024'] | ||
| - id: check-merge-conflict | ||
| - id: detect-private-key | ||
| - id: debug-statements | ||
|
|
||
| # Black code formatter | ||
| - repo: https://github.com/psf/black | ||
| rev: 23.12.1 | ||
| hooks: | ||
| - id: black | ||
| language_version: python3.10 | ||
| args: [--line-length=100] | ||
|
|
||
| # Isort import sorting | ||
| - repo: https://github.com/pycqa/isort | ||
| rev: 5.13.2 | ||
| hooks: | ||
| - id: isort | ||
| args: ["--profile", "black", "--line-length=100"] | ||
|
|
||
| # Flake8 linter | ||
| - repo: https://github.com/pycqa/flake8 | ||
| rev: 7.0.0 | ||
| hooks: | ||
| - id: flake8 | ||
| args: [--max-line-length=100, --extend-ignore=E203,W503] | ||
| additional_dependencies: [flake8-docstrings] | ||
|
|
||
| # Security scanning with Bandit | ||
| - repo: https://github.com/PyCQA/bandit | ||
| rev: 1.7.5 | ||
| hooks: | ||
| - id: bandit | ||
| args: ["-r", "-lll"] | ||
| exclude: ^tests/ | ||
|
|
||
| # Type checking with mypy (optional, can be slow) | ||
| - repo: https://github.com/pre-commit/mirrors-mypy | ||
| rev: v1.8.0 | ||
| hooks: | ||
| - id: mypy | ||
| args: [--ignore-missing-imports, --warn-return-any] | ||
| additional_dependencies: [] | ||
| exclude: ^(machine_learning|GUI|Game)/ | ||
|
|
||
| # Pyupgrade for modern Python syntax | ||
| - repo: https://github.com/asottile/pyupgrade | ||
| rev: v3.15.0 | ||
| hooks: | ||
| - id: pyupgrade | ||
| args: [--py310-plus] | ||
|
|
||
| # Security vulnerability check | ||
| - repo: https://github.com/adamchainz/blacken-docs | ||
| rev: 1.16.0 | ||
| hooks: | ||
| - id: blacken-docs | ||
| additional_dependencies: [black==23.12.1] | ||
|
|
||
| # Check for common security issues in dependencies | ||
| - repo: https://github.com/Lucas-C/pre-commit-hooks-safety | ||
| rev: v1.3.3 | ||
| hooks: | ||
| - id: python-safety-dependencies-check | ||
| files: requirements.txt | ||
|
|
||
| ci: | ||
| autofix_commit_msg: | | ||
| [pre-commit.ci] auto fixes from pre-commit.com hooks | ||
|
|
||
| for more information, see https://pre-commit.ci | ||
| autofix_prs: true | ||
| autoupdate_branch: '' | ||
| autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' | ||
| autoupdate_schedule: weekly | ||
| skip: [] | ||
| submodules: false | ||
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,125 @@ | ||||||
| # Changelog | ||||||
|
|
||||||
| All notable changes to the python-projects repository will be documented in this file. | ||||||
|
|
||||||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||||||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||||||
|
|
||||||
| ## [Unreleased] | ||||||
|
|
||||||
| ### Added | ||||||
| - Production-grade package configuration with `pyproject.toml` and `setup.cfg` | ||||||
| - Pre-commit hooks for code quality automation | ||||||
| - Comprehensive CI/CD workflow for testing, linting, and security scanning | ||||||
| - Unit tests for Utilities module (24 test cases) | ||||||
| - Development guide documentation | ||||||
| - Proper package structure with `__init__.py` files including version info and `__all__` exports | ||||||
| - `.pre-commit-config.yaml` with Black, isort, Flake8, Bandit, and MyPy hooks | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick (typo): Consider using consistent capitalization for "Mypy" across the documentation. Here it's written as "MyPy" while
Suggested change
|
||||||
| - GitHub Actions workflow for multi-Python version testing | ||||||
| - MANIFEST.in for proper package distribution | ||||||
| - Enhanced `.gitignore` for Python projects | ||||||
|
|
||||||
| ### Fixed | ||||||
| - Corrected typos in module imports across all `__init__.py` files: | ||||||
| - `brithday` → `birthday` | ||||||
| - `broswer` → `browser` | ||||||
| - `insta` → `inta` | ||||||
| - `secert_code` → `secret_code` | ||||||
| - Updated import statements from bare `import` to proper relative imports (`from .module import *`) | ||||||
|
|
||||||
| ### Changed | ||||||
| - Improved import structure in all package `__init__.py` files | ||||||
| - Enhanced documentation with DEVELOPMENT.md guide | ||||||
| - Updated requirements.txt with pinned secure versions | ||||||
|
|
||||||
| ## [1.0.0] - 2024 | ||||||
|
|
||||||
| ### Added | ||||||
| - Initial release with 80+ Python projects | ||||||
| - Five main categories: Calculator, Game, GUI, Utilities, Machine Learning | ||||||
| - Comprehensive documentation (README, CONTRIBUTING, FAQ, etc.) | ||||||
| - Multiple CI/CD workflows (15+ GitHub Actions) | ||||||
| - CircleCI integration | ||||||
| - DeepSource code quality integration | ||||||
| - Community support channels (Discord, Reddit, LinkedIn) | ||||||
| - Security scanning with Bandit and Codacy | ||||||
| - Automated code formatting with Black | ||||||
| - Dependency management with Dependabot | ||||||
|
|
||||||
| ### Project Categories | ||||||
|
|
||||||
| #### Calculator (18 projects) | ||||||
| - Mega Calculator, Quadratic Equation Solver, BMI Calculator | ||||||
| - Stock Analyzer, Special Relativity Calculator | ||||||
| - Number Base Converter, Integration/Differentiation | ||||||
| - Time converters, Grade Calculator, Sudoku Solver | ||||||
| - Mortgage Calculator, Roman Numeral Converter, ASCII Value Finder | ||||||
|
|
||||||
| #### Games (16 projects) | ||||||
| - Snake Game, Hangman, Tic Tac Toe (GUI & Terminal) | ||||||
| - 2048 Blocks, Master Mind, Color Guessing | ||||||
| - Twenty-One, Rock Paper Scissors, Dice Rolling | ||||||
| - Number Guessing, Typing Speed Test, Star Patterns | ||||||
|
|
||||||
| #### GUI (21 projects) | ||||||
| - Form applications, Calculators, Clocks | ||||||
| - Games: Tic Tac Toe, Snake & Ladder, Quiz | ||||||
| - Creative: Paint app, Turtle graphics (Pikachu, Doraemon, Rainbow) | ||||||
| - Tools: Notepad, File Explorer, YouTube Downloader, Todo List | ||||||
| - Calendar, Application Search, Birthday Message Generator | ||||||
|
|
||||||
| #### Machine Learning (11 projects) | ||||||
| - Computer Vision: Eye Blink Detection, Hand Gesture Brightness Control | ||||||
| - NLP: Text-to-Speech, Language Detector, Sentiment Analysis, Spam Detection | ||||||
| - Prediction: Crypto Price, Gold Price (Prophet library) | ||||||
| - Image Processing: Image to Sketch | ||||||
| - Tools: Phone Camera on PC | ||||||
|
|
||||||
| #### Utilities (22 projects) | ||||||
| - Network: WiFi Password Retriever, Site Connectivity Checker | ||||||
| - Web: Browser automation, Google Search, Instagram Info, GitHub API | ||||||
| - Security: Password Manager, Password Generator, Hash Cracker, Secret Code | ||||||
| - Tools: Countdown Timer, QR Code Generator, WhatsApp Spam Sender | ||||||
| - File Transfer via QR, Word/Letter Counter, Short Form Generator | ||||||
| - Birthday Finder (zodiac, birthstone, life path number) | ||||||
|
|
||||||
| ### Technical Stack | ||||||
| - **GUI**: pygame, pyqt5, pyqtwebengine, tkcalendar, pillow | ||||||
| - **ML/AI**: opencv-python, mediapipe, prophet, seaborn, scikit-learn | ||||||
| - **Web**: requests, googlesearch-python, instaloader, pytube | ||||||
| - **Utilities**: qrcode, pyautogui, pyttsx3, pyshorteners | ||||||
| - **Math/Science**: matplotlib, sympy, numpy, openpyxl, yfinance | ||||||
| - **NLP**: textblob, vaderSentiment, langdetect, nltk | ||||||
|
|
||||||
| ### Documentation | ||||||
| - README.md - Comprehensive project overview | ||||||
| - CONTRIBUTING.md - Contribution guidelines | ||||||
| - CODE_OF_CONDUCT.md - Community standards | ||||||
| - SECURITY.md - Vulnerability reporting | ||||||
| - FAQ.md - Common questions | ||||||
| - SUMMARY.md - Quick summary | ||||||
| - How_to_use.md - Installation and usage | ||||||
| - prerequisites.md - System requirements | ||||||
| - PULL_REQUEST_TEMPLATE.md - PR template | ||||||
|
|
||||||
| ### Known Issues | ||||||
| - Some modules may require Python 3.10+ compatibility verification | ||||||
| - Limited test coverage (only Utilities module tested initially) | ||||||
| - Some external dependencies may require API keys or authentication | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Version History | ||||||
|
|
||||||
| - **1.0.0** - Initial production-ready release with comprehensive improvements | ||||||
| - **0.x.x** - Development versions (pre-release) | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ## Contributing | ||||||
|
|
||||||
| We welcome contributions! Please see our [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to submit pull requests. | ||||||
|
|
||||||
| ## License | ||||||
|
|
||||||
| This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. | ||||||
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.
🚨 suggestion (security): The safety hook is scoped only to requirements.txt, which may be ineffective if dependencies are managed via pyproject.toml.
Since you define dependencies in pyproject.toml, this hook may never see your real dependency set. Consider either adding a documented step to export requirements.txt from pyproject, or updating the hook/tooling to operate directly on pyproject.toml (e.g., via pip-audit or a similar tool) so that all actual dependencies are checked.