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 diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 87184de..17d7aa4 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,7 +4,6 @@ // 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", @@ -18,9 +17,7 @@ "vivaxy.vscode-conventional-commits", "charliermarsh.ruff", "pshaddel.conventional-branch", - "yy0931.vscode-sqlite3-editor", - "junstyle.vscode-django-support", - "monosans.djlint" + "yy0931.vscode-sqlite3-editor" ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] 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, 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 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" 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"