From afc43fdf67a3b729feffce8be581eb9eb23aba80 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 11 Nov 2024 13:36:15 +0100 Subject: [PATCH 1/6] chore: :see_no_evil: remove Django specific ignore files --- .gitignore | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 4ba75a4..d7f7ded 100644 --- a/.gitignore +++ b/.gitignore @@ -87,10 +87,9 @@ site persistent_storage !persistent_storage/**/*.md -# Python Django +# Python Web App +*.sqlite3 +*.sqlite3-journal + +# Misc files *.log -local_settings.py -db.sqlite3 -db.sqlite3-journal -# We'll disable migrations for now, until we have actual users -migrations From ece6a21e16bde88580ce902495e05dd5b5c07961 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 11 Nov 2024 13:36:51 +0100 Subject: [PATCH 2/6] chore: :hammer: remove Django build recipes from justfile --- justfile | 50 ++++++++++++++------------------------------------ 1 file changed, 14 insertions(+), 36 deletions(-) diff --git a/justfile b/justfile index 0d06723..027e269 100644 --- a/justfile +++ b/justfile @@ -1,7 +1,11 @@ @_default: just --list --unsorted -run-all: install-deps format-python check-python run-tests +run-all: install-deps format-python check-python run-tests check-commits build-website + +# Install Python package dependencies +install-deps: + poetry install # Generate SVG images from all PlantUML files generate-puml-all: @@ -11,59 +15,33 @@ generate-puml-all: generate-puml name: docker run --rm -v $(pwd):/puml -w /puml ghcr.io/plantuml/plantuml:latest -tsvg "**/{{name}}.puml" -# Start up the docker container -start-docker: - docker compose up -d - -# Close the docker container -stop-docker: - docker compose down - -# Update the Django migration files -update-migrations: install-deps - yes | poetry run python manage.py makemigrations - poetry run python manage.py migrate - -# Run Django tests -run-tests: install-deps update-migrations +# Run Python tests +run-tests: poetry run pytest # Check Python code with the linter for any errors that need manual attention -check-python: install-deps +check-python: poetry run ruff check . # Reformat Python code to match coding style and general structure -format-python: install-deps +format-python: poetry run ruff check --fix . poetry run ruff format . -# Builds and starts a development web server for the Django app (at http://localhost:8000) -start-app: install-deps update-migrations - poetry run python ./manage.py runserver - -# Install Python package dependencies -install-deps: - poetry install - -# Add test data when running locally based on json files found in `fixtures/` -add-test-data: install-deps update-migrations - poetry run python manage.py loaddata */*/fixtures/*.json - -# Reset local Sprout (remove __pycache__ folders, db, migrations, and persistent storage raw files) +# Reset local Sprout (remove __pycache__ folders, generated build files, etc) reset-local: find . -type d -name "__pycache__" -exec rm -rf {} + - find */**/migrations -type f ! -name '__init__.py' -exec rm {} \; - rm db.sqlite3 - rm persistent_storage/raw/*.csv + rm -rf .storage # Build the documentation website using Quarto -build-website: install-deps +build-website: # To let Quarto know where python is. export QUARTO_PYTHON=.venv/bin/python3 poetry run quartodoc build poetry run quarto render --execute -check-commit: +# Run checks on commits with non-main branches +check-commits: #!/bin/zsh if [[ $(git rev-parse --abbrev-ref HEAD) != "main" ]] then From 0c16e31a337a051bb3e05cc1b92ebb3a3a263e38 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 11 Nov 2024 13:37:24 +0100 Subject: [PATCH 3/6] chore: :wrench: remove Django dependencies from `pyproject.toml` --- pyproject.toml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8b90ec2..363b80f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,22 +28,10 @@ python = "^3.12" [tool.poetry.group.test.dependencies] pytest = "^8.3.2" -pytest-django = "^4.8.0" [tool.poetry.group.dev.dependencies] ruff = "^0.6.2" -[tool.poetry.group.django.dependencies] -psycopg2-binary = "^2.9.9" -django-widget-tweaks = "^1.5.0" -dj-database-url = "^2.2.0" -gunicorn = "^23.0.0" -whitenoise = "^6.7.0" -django = "^5.1" - [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" - -[tool.pytest.ini_options] -DJANGO_SETTINGS_MODULE = "CONFIG_FOLDERNAME.settings" From 867773e1209e1c7e598b4898f4f0f16cb94e1cc5 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 11 Nov 2024 13:37:48 +0100 Subject: [PATCH 4/6] chore: :wrench: remove Ruff ignoring of Django files --- ruff.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/ruff.toml b/ruff.toml index f8ae9db..90a4c9e 100644 --- a/ruff.toml +++ b/ruff.toml @@ -14,9 +14,6 @@ extend-select = [ # Ignore missing docstring at the top of files ignore = ["D100"] -# Ignore Django migration files -exclude = ["**/migrations/*.py"] - [lint.pydocstyle] convention = "google" From d43f6ef55141920b5a98ab58a928ba3eebfd4cbb Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 11 Nov 2024 13:38:18 +0100 Subject: [PATCH 5/6] chore: :technologist: remove recommendations of Django specific extensions --- .vscode/extensions.json | 45 +++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 7f7b2ba..bc81bc9 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,26 +1,23 @@ { - // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. - // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp - // List of extensions which should be recommended for users of this workspace. - "recommendations": [ - "jebbs.plantuml", - "batisteo.vscode-django", - "donjayamanne.githistory", - "felipecaputo.git-project-manager", - "GitHub.vscode-pull-request-github", - "ms-azuretools.vscode-docker", - "ms-python.python", - "ms-python.vscode-pylance", - "njpwerner.autodocstring", - "quarto.quarto", - "streetsidesoftware.code-spell-checker", - "vivaxy.vscode-conventional-commits", - "charliermarsh.ruff", - "pshaddel.conventional-branch", - "yy0931.vscode-sqlite3-editor", - "junstyle.vscode-django-support", - "monosans.djlint" - ], - // List of extensions recommended by VS Code that should not be recommended for users of this workspace. - "unwantedRecommendations": [] + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + // List of extensions which should be recommended for users of this workspace. + "recommendations": [ + "jebbs.plantuml", + "donjayamanne.githistory", + "felipecaputo.git-project-manager", + "GitHub.vscode-pull-request-github", + "ms-azuretools.vscode-docker", + "ms-python.python", + "ms-python.vscode-pylance", + "njpwerner.autodocstring", + "quarto.quarto", + "streetsidesoftware.code-spell-checker", + "vivaxy.vscode-conventional-commits", + "charliermarsh.ruff", + "pshaddel.conventional-branch", + "yy0931.vscode-sqlite3-editor" + ], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] } From 25e434141da6dfa5b023f9798745a4849d4ba7b4 Mon Sep 17 00:00:00 2001 From: "Luke W. Johnston" Date: Mon, 11 Nov 2024 13:38:42 +0100 Subject: [PATCH 6/6] chore: :technologist: remove Django linting of HTML files --- .vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 9e1fcb6..f006005 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -29,9 +29,6 @@ "[python]": { "editor.defaultFormatter": "charliermarsh.ruff" }, - "[html][django-html]": { - "editor.defaultFormatter": "monosans.djlint" - }, "python.defaultInterpreterPath": "${workspaceFolder}/.venv", "python.languageServer": "Pylance", "files.insertFinalNewline": true,