Skip to content

chore: 🔥 remove Django-specific configs #22

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 7 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
11 changes: 5 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,9 @@ site
persistent_storage
!persistent_storage/**/*.md

# Python Django
# Python Web App
*.sqlite3
*.sqlite3-journal

# Misc files
*.log
local_settings.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was this local_settings.py anyway? :)

db.sqlite3
db.sqlite3-journal
# We'll disable migrations for now, until we have actual users
migrations
45 changes: 21 additions & 24 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -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": []
}
3 changes: 0 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
50 changes: 14 additions & 36 deletions justfile
Original file line number Diff line number Diff line change
@@ -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:
Expand 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
Expand Down
12 changes: 0 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 0 additions & 3 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down