Skip to content
Merged

v2 #27

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
f50c9f5
Reset django project
satyam-seth Aug 12, 2025
09636c9
Add git ignore file
satyam-seth Aug 12, 2025
a30e854
Install Django project
satyam-seth Aug 14, 2025
3320a6b
Add installed Django package to requirements file
satyam-seth Aug 14, 2025
72ae8f1
Start django project `backend`
satyam-seth Aug 14, 2025
5af198b
Merge pull request #30 from satyam-seth-learnings/initialize-django-p…
satyam-seth Aug 14, 2025
78cc523
Start django app core
satyam-seth Aug 14, 2025
0d97ae8
Install django app in project setting
satyam-seth Aug 14, 2025
f8d32b6
Add Djnago app setup instructions
satyam-seth Aug 14, 2025
15c8019
Merge pull request #32 from satyam-seth-learnings/start-django-app
satyam-seth Aug 14, 2025
5e058d7
Add students model
satyam-seth Aug 14, 2025
48ea96d
Add student model str method
satyam-seth Aug 14, 2025
204e9ba
Generate migration file for django model
satyam-seth Aug 14, 2025
e05c2c4
Add pycache and sqlite3 files in gitignore
satyam-seth Aug 14, 2025
aedc92c
Add instructions for model setup
satyam-seth Aug 14, 2025
f941487
Merge pull request #34 from satyam-seth-learnings/setup-django-model
satyam-seth Aug 14, 2025
cb381be
Add unit test for model
satyam-seth Aug 14, 2025
873ad2c
Add instructions to run unit tests
satyam-seth Aug 14, 2025
380b91e
Merge pull request #36 from satyam-seth-learnings/model-unit-test
satyam-seth Aug 14, 2025
b286082
Add drf package in requirements file
satyam-seth Aug 15, 2025
132cf55
Install DRF in project setting
satyam-seth Aug 15, 2025
690de7c
Add DRF setup instructions in readme file
satyam-seth Aug 15, 2025
9233096
Merge pull request #38 from satyam-seth-learnings/setup-drf
satyam-seth Aug 15, 2025
d57c9a9
Add coverage package in requirements file
satyam-seth Aug 15, 2025
18eab77
add coverage files in gitignore
satyam-seth Aug 15, 2025
9b2278c
Add coverage setup instructions in readme file
satyam-seth Aug 15, 2025
e2b06df
Merge pull request #40 from satyam-seth-learnings/setup-test-coverage
satyam-seth Aug 15, 2025
cd9779a
Add mypy package in requirements file
satyam-seth Aug 15, 2025
99acf89
Add django stubs package in requirements file
satyam-seth Aug 15, 2025
7fc32c5
Add djangorestframework-stubs package in requirements file
satyam-seth Aug 15, 2025
53937ce
Add mypy config file
satyam-seth Aug 15, 2025
b96a3bf
Add instructions to setup mypy
satyam-seth Aug 15, 2025
1a5b197
Fix mypy warning
satyam-seth Aug 15, 2025
04b1fbd
Merge pull request #42 from satyam-seth-learnings/setup-mypy
satyam-seth Aug 15, 2025
f88a2b4
Add black package in requirements file
satyam-seth Aug 15, 2025
d0921ba
Add black config
satyam-seth Aug 15, 2025
26415dd
Add vscode setting to format code on save using black
satyam-seth Aug 15, 2025
a0e8f88
Fix formmating
satyam-seth Aug 15, 2025
b267838
Add instructions to setup black
satyam-seth Aug 15, 2025
02a9595
Add black official doc
satyam-seth Aug 15, 2025
ab9d7ac
Merge pull request #44 from satyam-seth-learnings/setup-black
satyam-seth Aug 15, 2025
33cc1e1
Merge pull request #45 from satyam-seth-learnings/setup-black
satyam-seth Aug 15, 2025
9cad6fd
Add isort package in requirements file
satyam-seth Aug 15, 2025
a9f07cd
Add isort config
satyam-seth Aug 15, 2025
e11e362
Configure vs code for isort
satyam-seth Aug 16, 2025
4779e44
Add instructions to setup isort
satyam-seth Aug 16, 2025
ea2a074
Fix isort warning
satyam-seth Aug 16, 2025
3743ec3
Merge pull request #47 from satyam-seth-learnings/setup-isort
satyam-seth Aug 16, 2025
b6b4c29
Add pylint package in requirements file
satyam-seth Aug 16, 2025
134c3fe
Add pylint-django package in requirements file
satyam-seth Aug 16, 2025
82b9e1b
Add pylint config file
satyam-seth Aug 16, 2025
352967e
Add instructions to setup pylint
satyam-seth Aug 16, 2025
ed0ae85
Fix pylint warning
satyam-seth Aug 16, 2025
3941390
Merge pull request #49 from satyam-seth-learnings/setup-pylint
satyam-seth Aug 16, 2025
ad18367
Add pre commit package in requirements file
satyam-seth Aug 16, 2025
139249c
Add pre commit config file
satyam-seth Aug 16, 2025
77bf4c6
Add black pre commit
satyam-seth Aug 16, 2025
2bb4de1
Add isort pre commit
satyam-seth Aug 16, 2025
eb4d5d1
Add mypy pre commit
satyam-seth Aug 16, 2025
70499d2
Add pylint pre commit
satyam-seth Aug 16, 2025
98f5602
Add instructions to setup pre commit
satyam-seth Aug 16, 2025
163ab1c
Fix pre commit hook warnings
satyam-seth Aug 16, 2025
d6d29aa
Merge pull request #51 from satyam-seth-learnings/setup-pre-commit
satyam-seth Aug 16, 2025
017e516
Add pre push hook bash file
satyam-seth Aug 16, 2025
beaaddf
Add instructions to setup pre push hook
satyam-seth Aug 16, 2025
c681561
Merge pull request #52 from satyam-seth-learnings/setup-pre-push
satyam-seth Aug 16, 2025
4c3292b
Add manage py path in env
satyam-seth Aug 16, 2025
4817c91
Add VS Code config for python test runner
satyam-seth Aug 16, 2025
9fb5a78
Add instructions to setup vs code test runner
satyam-seth Aug 16, 2025
2ab0d47
Merge pull request #54 from satyam-seth-learnings/setup-vs-code-test-…
satyam-seth Aug 16, 2025
ee5b5fa
Add recommended extensions file
satyam-seth Aug 16, 2025
d23a676
Add instructions to install recommended VS Code extensions
satyam-seth Aug 16, 2025
abadea3
Merge pull request #57 from satyam-seth-learnings/vscode-recommended-…
satyam-seth Aug 16, 2025
6bb4bad
Add basic check workflow
satyam-seth Aug 16, 2025
61ac691
Merge pull request #59 from satyam-seth-learnings/setup-basic-checks-…
satyam-seth Aug 16, 2025
f872a12
Fix vscode settings file
satyam-seth Aug 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MANAGE_PY_PATH=manage.py
19 changes: 19 additions & 0 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

echo "Running tests with coverage..."

coverage run manage.py test
status=$?

if [ $status -ne 0 ]; then
echo "❌ Tests failed. Push aborted."
exit 1
fi

coverage report --fail-under=85 # set your threshold
if [ $? -ne 0 ]; then
echo "❌ Coverage is below threshold. Push aborted."
exit 1
fi

echo "✅ Tests passed and coverage is acceptable. Proceeding with push."
42 changes: 42 additions & 0 deletions .github/workflows/basic-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: 🚦 Basic Checks

on:
push:
branches:
- main
pull_request:

jobs:
quality-checks:
name: Quality Checks
runs-on: ubuntu-latest

steps:
- name: 📥 Checkout code
uses: actions/checkout@v4

- name: 🐍 Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: 📦 Install dependencies
run: pip install -r requirements.txt

- name: 🎨 Run black (formatting)
run: black --check .

- name: 🧹 Run isort (import sorting)
run: isort --check-only .

- name: 🧐 Run mypy (type checking)
run: mypy .

- name: 🔍 Run pylint (linting)
run: pylint **/*.py

- name: 🧪 Run tests with coverage
run: coverage run manage.py test

- name: 📊 Generate coverage report (fail if <85%)
run: coverage report --fail-under=85
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.venv
__pycache__
__pycache__/
*sqlite3
.coverage
htmlcov
3 changes: 0 additions & 3 deletions .isort.cfg

This file was deleted.

52 changes: 52 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
name: black to format python code

- repo: https://github.com/pycqa/isort
rev: 6.0.1
hooks:
- id: isort
name: isort to sort imports
args:
- --profile
- black
- --verbose
- --skip-glob
- "**/migrations/*.py"

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.0
hooks:
- id: mypy
name: mypy to check types
additional_dependencies:
- django-jazzmin==3.0.1
- django-stubs==5.2.2
- djangorestframework==3.16.0
- djangorestframework-stubs==3.16.1
args: ["--config-file=mypy.ini"]

- repo: https://github.com/pycqa/pylint
rev: v3.3.7
hooks:
- id: pylint
name: pylint to check code quality
entry: pylint
language: python
types: [python]
args: ["--rcfile=.pylintrc"]
additional_dependencies:
- django-jazzmin==3.0.1
- Django==5.2.4
- pylint-django==2.6.1
- djangorestframework==3.16.0
56 changes: 37 additions & 19 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no

# Clear in-memory caches upon conclusion of linting. Useful if running pylint
# in a server-like mode.
clear-cache-post-run=no

# Load and enable all available extensions. Use --list-extensions to see a list
# all available extensions.
#enable-all-extensions=
Expand Down Expand Up @@ -46,9 +50,9 @@ ignore=CVS

# Add files or directories matching the regular expressions patterns to the
# ignore-list. The regex matches against paths and can be in Posix or Windows
# format. Because '\' represents the directory delimiter on Windows systems, it
# can't be used as an escape character.
ignore-paths=
# format. Because '\\' represents the directory delimiter on Windows systems,
# it can't be used as an escape character.
ignore-paths=.*/migrations

# Files or directories matching the regular expression patterns are skipped.
# The regex matches against base names, not paths. The default value ignores
Expand Down Expand Up @@ -89,6 +93,12 @@ py-version=3.10
# Discover python modules and packages in the file system subtree.
recursive=no

# Add paths to the list of the source roots. Supports globbing patterns. The
# source root is an absolute path or a path relative to the current working
# directory used to determine a package namespace for modules located under the
# source root.
source-roots=

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes
Expand Down Expand Up @@ -224,6 +234,10 @@ no-docstring-rgx=^_
# These decorators are taken in consideration only for invalid-name.
property-classes=abc.abstractproperty

# Regular expression matching correct type alias names. If left empty, type
# alias names will be checked with the set naming style.
#typealias-rgx=

# Regular expression matching correct type variable names. If left empty, type
# variable names will be checked with the set naming style.
#typevar-rgx=
Expand All @@ -246,21 +260,18 @@ check-protected-access-in-special-methods=no
defining-attr-methods=__init__,
__new__,
setUp,
asyncSetUp,
__post_init__

# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,
_fields,
_replace,
_source,
_make
exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit

# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls

# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=cls
valid-metaclass-classmethod-first-arg=mcs


[DESIGN]
Expand Down Expand Up @@ -307,8 +318,7 @@ min-public-methods=2
[EXCEPTIONS]

# Exceptions that will emit a warning when caught.
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,builtins.Exception


[FORMAT]
Expand Down Expand Up @@ -347,6 +357,9 @@ single-line-if-stmt=no
# one.
allow-any-import-level=

# Allow explicit reexports by alias from a package __init__.
allow-reexport-from-package=no

# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no

Expand Down Expand Up @@ -416,14 +429,18 @@ disable=raw-checker-failed,
useless-suppression,
deprecated-pragma,
use-symbolic-message-instead,
import-outside-toplevel

use-implicit-booleaness-not-comparison-to-string,
use-implicit-booleaness-not-comparison-to-zero,
missing-module-docstring,
import-outside-toplevel,
fixme


# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=c-extension-no-member
enable=


[METHOD_ARGS]
Expand Down Expand Up @@ -469,8 +486,9 @@ evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor
# used to format the message information. See doc for all details.
msg-template=

# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio). You can also give a reporter class, e.g.
# Set the output format. Available formats are: text, parseable, colorized,
# json2 (improved json format), json (old json format) and msvs (visual
# studio). You can also give a reporter class, e.g.
# mypackage.mymodule.MyReporterClass.
#output-format=

Expand Down Expand Up @@ -504,8 +522,8 @@ min-similarity-lines=4
# Limits count of emitted suggestions for spelling mistakes.
max-spelling-suggestions=4

# Spelling dictionary name. Available dictionaries: none. To make it work,
# install the 'python-enchant' package.
# Spelling dictionary name. No available dictionaries : You need to install
# both the python package and the system dependency for enchant to work.
spelling-dict=

# List of comma separated words that should be considered directives if they
Expand Down Expand Up @@ -622,4 +640,4 @@ redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io

# pylint_django configuration
[pylint-django]
django-settings-module=django_starter.settings
django-settings-module=backend.settings
15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"recommendations": [
"ms-python.python",
"esbenp.prettier-vscode",
"ms-python.black-formatter",
"ms-python.isort",
"ms-python.mypy-type-checker",
"batisteo.vscode-django",
"ms-python.pylint",
"ms-python.debugpy",
"ms-python.vscode-pylance",
"yy0931.vscode-sqlite3-editor",
"streetsidesoftware.code-spell-checker"
]
}
37 changes: 17 additions & 20 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true,
},
"isort.args": [
"skip_glob",
"*/migrations/*",
],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--load-plugins",
"pylint_django",
"django-settings-module=django_starter.settings",
],
"python.linting.mypyEnabled": true,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.unusedImports": "explicit",
"source.organizeImports": "explicit"
},
"editor.rulers": [100],
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"isort.args": ["--profile", "black", "--skip-glob", "*/migrations/*"],
"python.testing.unittestEnabled": true,
"python.testing.pytestEnabled": false,
"python.testing.unittestArgs": ["-p", "*test*.py"]
}
Loading