Compare commits
10 commits
00be7b7ff5
...
77512fc73c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77512fc73c | ||
|
|
ca09a2916e | ||
|
|
d635b7ba05 | ||
|
|
71c492c648 | ||
|
|
cd0b9d9c96 | ||
|
|
f4ed431a94 | ||
|
|
3603d26f1e | ||
|
|
28f7db8b72 | ||
|
|
b5663d1bc8 | ||
|
|
a7c73f559f |
12 changed files with 120 additions and 1 deletions
5
.envrc
Normal file
5
.envrc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export PYTHONDEVMODE=1
|
||||
export VIRTUAL_ENV=.venv
|
||||
layout python3
|
||||
export DJANGO_SETTINGS_MODULE=dx.settings
|
||||
export DJANGO_CONFIGURATION=Local
|
||||
4
.pre-commit-config.yaml
Normal file
4
.pre-commit-config.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
- repo: https://github.com/peterdemin/pip-compile-multi
|
||||
rev: v2.6.2
|
||||
hooks:
|
||||
- id: pip-compile-multi-verify
|
||||
24
justfile
Normal file
24
justfile
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
default: test
|
||||
|
||||
alias tc := test-coverage
|
||||
alias l := lint
|
||||
alias lf := lint-fix
|
||||
alias c := compile-dependencies
|
||||
|
||||
test:
|
||||
# pytest options can be found in pyproject.toml
|
||||
# look for [tool.pytest.ini_options]
|
||||
python -m pytest
|
||||
|
||||
test-coverage:
|
||||
# here we allow extra arguments to be passed to pytest
|
||||
python -m pytest --cov=src --cov-config=pyproject.toml
|
||||
|
||||
lint:
|
||||
ruff check .
|
||||
|
||||
lint-fix:
|
||||
ruff check --fix .
|
||||
|
||||
compile-dependencies:
|
||||
pip-compile-multi
|
||||
|
|
@ -13,3 +13,16 @@ build-backend = "hatchling.build"
|
|||
|
||||
[tool.pytest.ini_options]
|
||||
pythonpath = ["src"]
|
||||
testpaths = ["tests"]
|
||||
|
||||
[tool.coverage.run]
|
||||
branch = true
|
||||
data_file = "coverage/.coverage"
|
||||
source = ["src"]
|
||||
omit = ["*/migrations/*"]
|
||||
|
||||
[tool.coverage.html]
|
||||
directory = "coverage/htmlcov"
|
||||
|
||||
[tool.coverage.report]
|
||||
skip_empty = true
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
django-configurations
|
||||
django>=5.1,<5.2
|
||||
pip-lock
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# SHA1:e1677d1f2cf78dc26b96c6f8b02f0a0192f1d402
|
||||
# SHA1:78e037786a8e05baa81b92ef0373bd8fc1069bd9
|
||||
#
|
||||
# This file is autogenerated by pip-compile-multi
|
||||
# To update, run:
|
||||
|
|
@ -8,6 +8,10 @@
|
|||
asgiref==3.8.1
|
||||
# via django
|
||||
django==5.1.3
|
||||
# via
|
||||
# -r requirements/base.in
|
||||
# django-configurations
|
||||
django-configurations==2.5.1
|
||||
# via -r requirements/base.in
|
||||
pip-lock==2.12.0
|
||||
# via -r requirements/base.in
|
||||
|
|
|
|||
0
src/dx/__init__.py
Normal file
0
src/dx/__init__.py
Normal file
39
src/dx/settings.py
Normal file
39
src/dx/settings.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
from pathlib import Path
|
||||
from configurations import Configuration
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
class Base(Configuration):
|
||||
DEBUG = False
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
INSTALLED_APPS = [
|
||||
"dx",
|
||||
]
|
||||
ROOT_URLCONF = "dx.urls"
|
||||
SECRET_KEY = "django-insecure-cbgvn=orgh$&6l-w91pp2=(b#hjwe1z&ijwiafgt(py1lq5i85"
|
||||
TEMPLATES = [
|
||||
{
|
||||
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
||||
"DIRS": [BASE_DIR / "templates"],
|
||||
"APP_DIRS": True,
|
||||
},
|
||||
]
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
class Dev(Base):
|
||||
# Dangerous: disable host header validation
|
||||
ALLOWED_HOSTS = ["*"]
|
||||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.sqlite3",
|
||||
"NAME": "db.sqlite3",
|
||||
},
|
||||
}
|
||||
DEBUG = True
|
||||
INSTALLED_APPS = Base.INSTALLED_APPS + ["django_extensions"]
|
||||
|
||||
|
||||
class Local(Dev):
|
||||
pass
|
||||
1
src/dx/urls.py
Normal file
1
src/dx/urls.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
urlpatterns = []
|
||||
2
src/foo.py
Normal file
2
src/foo.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def dummy():
|
||||
return (1, 1, 1)
|
||||
18
src/manage.py
Executable file
18
src/manage.py
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dx.settings")
|
||||
os.environ.setdefault("DJANGO_CONFIGURATION", "Base")
|
||||
|
||||
from configurations.management import execute_from_command_line
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
8
tests/test_something.py
Normal file
8
tests/test_something.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
def test_always_true():
|
||||
assert True
|
||||
|
||||
|
||||
def test_something_in_src():
|
||||
from foo import dummy
|
||||
|
||||
assert dummy() == (1, 1, 1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue