diff --git a/Makefile b/Makefile index d0f9273..ddf431a 100644 --- a/Makefile +++ b/Makefile @@ -30,8 +30,7 @@ requirements/dev.txt: requirements/dev.in requirements.txt .PHONY: fmt fmt: - isort . - black . + ruff format . .PHONY: help help: diff --git a/pip-compile.sh b/pip-compile.sh new file mode 100755 index 0000000..adec49d --- /dev/null +++ b/pip-compile.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# Intended to run in a docker container. Called by `make requirements.txt` +set -euf -o pipefail + +pip install --disable-pip-version-check --root-user-action=ignore -U pip pip-tools +# Compile main requirements +pip-compile -v \ + --resolver=backtracking \ + --generate-hashes \ + --strip-extras \ + --output-file=requirements.txt \ + pyproject.toml + +# Compile dev requirements +pip-compile -v \ + --constraint $(pwd)/requirements.txt \ + --resolver=backtracking \ + --generate-hashes \ + --extra=dev \ + --output-file=requirements-dev.txt \ + pyproject.toml diff --git a/pyproject.toml b/pyproject.toml index ceb18f8..0417a97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,47 @@ -[tool.black] -exclude = ''' -/( - \.mypy_cache - | \.venv - | migrations - | node_modules -)/ -''' - -[tool.isort] -profile = "black" -multi_line_output = 3 +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "django-layout" +version = "4.0" +dependencies = [ + "django==5.*", +] + +[project.optional-dependencies] +dev = [ + "django-stubs", + "mypy", + "pip-tools", + "readable-log-formatter", + "ruff", +] + +[tool.setuptools] +packages = { "find" = { } } +include-package-data = true + +[tool.ruff] +target-version = "py12" +exclude = ["migrations"] +select = ["ALL"] +ignore = [ + "ANN101", # Missing Type Annotation for "self" + "ANN401", # Dynamically typed expressions (typing.Any) are disallowed in `**kwargs`" + "ARG001", # Unused function argument (request, ...) + "ARG002", # Unused method argument (*args, **kwargs) + "D", # Missing or badly formatted docstrings + "FBT", # Flake Boolean Trap (don't use arg=True in functions) + "RUF012", # Mutable class attributes https://github.com/astral-sh/ruff/issues/5243 + + "COM812", # (ruff format) Checks for the absence of trailing commas + "ISC001", # (ruff format) Checks for implicitly concatenated strings on a single line +] + +[tool.ruff.extend-per-file-ignores] +# Also ignore `E402` in all `__init__.py` files. +"test_*.py" = [ + "S101", # S101 Use of `assert` detected + "PLR2004", # Magic value used in comparison, +] diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..a147276 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,135 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# pip-compile --constraint=/Users/alexclark/Developer/lincolnloop/django-layout/requirements.txt --extra=dev --generate-hashes --output-file=requirements-dev.txt pyproject.toml +# +asgiref==3.7.2 \ + --hash=sha256:89b2ef2247e3b562a16eef663bc0e2e703ec6468e2fa8a5cd61cd449786d4f6e \ + --hash=sha256:9e0ce3aa93a819ba5b45120216b23878cf6e8525eb3848653452b4192b92afed + # via + # -c /Users/alexclark/Developer/lincolnloop/django-layout/requirements.txt + # django +build==1.0.3 \ + --hash=sha256:538aab1b64f9828977f84bc63ae570b060a8ed1be419e7870b8b4fc5e6ea553b \ + --hash=sha256:589bf99a67df7c9cf07ec0ac0e5e2ea5d4b37ac63301c4986d1acb126aa83f8f + # via pip-tools +click==8.1.7 \ + --hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \ + --hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de + # via pip-tools +django==5.0.2 \ + --hash=sha256:56ab63a105e8bb06ee67381d7b65fe6774f057e41a8bab06c8020c8882d8ecd4 \ + --hash=sha256:b5bb1d11b2518a5f91372a282f24662f58f66749666b0a286ab057029f728080 + # via + # -c /Users/alexclark/Developer/lincolnloop/django-layout/requirements.txt + # django-layout (pyproject.toml) + # django-stubs + # django-stubs-ext +django-stubs==4.2.7 \ + --hash=sha256:4cf4de258fa71adc6f2799e983091b9d46cfc67c6eebc68fe111218c9a62b3b8 \ + --hash=sha256:8ccd2ff4ee5adf22b9e3b7b1a516d2e1c2191e9d94e672c35cc2bc3dd61e0f6b + # via django-layout (pyproject.toml) +django-stubs-ext==4.2.7 \ + --hash=sha256:45a5d102417a412e3606e3c358adb4744988a92b7b58ccf3fd64bddd5d04d14c \ + --hash=sha256:519342ac0849cda1559746c9a563f03ff99f636b0ebe7c14b75e816a00dfddc3 + # via django-stubs +mypy==1.8.0 \ + --hash=sha256:028cf9f2cae89e202d7b6593cd98db6759379f17a319b5faf4f9978d7084cdc6 \ + --hash=sha256:2afecd6354bbfb6e0160f4e4ad9ba6e4e003b767dd80d85516e71f2e955ab50d \ + --hash=sha256:2b5b6c721bd4aabaadead3a5e6fa85c11c6c795e0c81a7215776ef8afc66de02 \ + --hash=sha256:42419861b43e6962a649068a61f4a4839205a3ef525b858377a960b9e2de6e0d \ + --hash=sha256:42c6680d256ab35637ef88891c6bd02514ccb7e1122133ac96055ff458f93fc3 \ + --hash=sha256:485a8942f671120f76afffff70f259e1cd0f0cfe08f81c05d8816d958d4577d3 \ + --hash=sha256:4c886c6cce2d070bd7df4ec4a05a13ee20c0aa60cb587e8d1265b6c03cf91da3 \ + --hash=sha256:4e6d97288757e1ddba10dd9549ac27982e3e74a49d8d0179fc14d4365c7add66 \ + --hash=sha256:4ef4be7baf08a203170f29e89d79064463b7fc7a0908b9d0d5114e8009c3a259 \ + --hash=sha256:51720c776d148bad2372ca21ca29256ed483aa9a4cdefefcef49006dff2a6835 \ + --hash=sha256:52825b01f5c4c1c4eb0db253ec09c7aa17e1a7304d247c48b6f3599ef40db8bd \ + --hash=sha256:538fd81bb5e430cc1381a443971c0475582ff9f434c16cd46d2c66763ce85d9d \ + --hash=sha256:5c1538c38584029352878a0466f03a8ee7547d7bd9f641f57a0f3017a7c905b8 \ + --hash=sha256:6ff8b244d7085a0b425b56d327b480c3b29cafbd2eff27316a004f9a7391ae07 \ + --hash=sha256:7178def594014aa6c35a8ff411cf37d682f428b3b5617ca79029d8ae72f5402b \ + --hash=sha256:720a5ca70e136b675af3af63db533c1c8c9181314d207568bbe79051f122669e \ + --hash=sha256:7f1478736fcebb90f97e40aff11a5f253af890c845ee0c850fe80aa060a267c6 \ + --hash=sha256:855fe27b80375e5c5878492f0729540db47b186509c98dae341254c8f45f42ae \ + --hash=sha256:8963b83d53ee733a6e4196954502b33567ad07dfd74851f32be18eb932fb1cb9 \ + --hash=sha256:9261ed810972061388918c83c3f5cd46079d875026ba97380f3e3978a72f503d \ + --hash=sha256:99b00bc72855812a60d253420d8a2eae839b0afa4938f09f4d2aa9bb4654263a \ + --hash=sha256:ab3c84fa13c04aeeeabb2a7f67a25ef5d77ac9d6486ff33ded762ef353aa5592 \ + --hash=sha256:afe3fe972c645b4632c563d3f3eff1cdca2fa058f730df2b93a35e3b0c538218 \ + --hash=sha256:d19c413b3c07cbecf1f991e2221746b0d2a9410b59cb3f4fb9557f0365a1a817 \ + --hash=sha256:df9824ac11deaf007443e7ed2a4a26bebff98d2bc43c6da21b2b64185da011c4 \ + --hash=sha256:e46f44b54ebddbeedbd3d5b289a893219065ef805d95094d16a0af6630f5d410 \ + --hash=sha256:f5ac9a4eeb1ec0f1ccdc6f326bcdb464de5f80eb07fb38b5ddd7b0de6bc61e55 + # via django-layout (pyproject.toml) +mypy-extensions==1.0.0 \ + --hash=sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d \ + --hash=sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782 + # via mypy +packaging==23.2 \ + --hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \ + --hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 + # via build +pip-tools==7.3.0 \ + --hash=sha256:8717693288720a8c6ebd07149c93ab0be1fced0b5191df9e9decd3263e20d85e \ + --hash=sha256:8e9c99127fe024c025b46a0b2d15c7bd47f18f33226cf7330d35493663fc1d1d + # via django-layout (pyproject.toml) +pyproject-hooks==1.0.0 \ + --hash=sha256:283c11acd6b928d2f6a7c73fa0d01cb2bdc5f07c57a2eeb6e83d5e56b97976f8 \ + --hash=sha256:f271b298b97f5955d53fb12b72c1fb1948c22c1a6b70b315c54cedaca0264ef5 + # via build +readable-log-formatter==0.1.4 \ + --hash=sha256:3cbbd4737074e1ffa13d62c68fa5d10019737971ac33656fe328766e18e72a89 \ + --hash=sha256:b9054caa2b3ad4d3e49f7d0dda5f53955396912d46a7b14b2eda814e4a1f4550 + # via django-layout (pyproject.toml) +ruff==0.2.1 \ + --hash=sha256:0034d5b6323e6e8fe91b2a1e55b02d92d0b582d2953a2b37a67a2d7dedbb7acc \ + --hash=sha256:00a818e2db63659570403e44383ab03c529c2b9678ba4ba6c105af7854008105 \ + --hash=sha256:0a725823cb2a3f08ee743a534cb6935727d9e47409e4ad72c10a3faf042ad5ba \ + --hash=sha256:13471684694d41ae0f1e8e3a7497e14cd57ccb7dd72ae08d56a159d6c9c3e30e \ + --hash=sha256:3b42b5d8677cd0c72b99fcaf068ffc62abb5a19e71b4a3b9cfa50658a0af02f1 \ + --hash=sha256:6b95ac9ce49b4fb390634d46d6ece32ace3acdd52814671ccaf20b7f60adb232 \ + --hash=sha256:7022d66366d6fded4ba3889f73cd791c2d5621b2ccf34befc752cb0df70f5fad \ + --hash=sha256:a11567e20ea39d1f51aebd778685582d4c56ccb082c1161ffc10f79bebe6df35 \ + --hash=sha256:be60592f9d218b52f03384d1325efa9d3b41e4c4d55ea022cd548547cc42cd2b \ + --hash=sha256:c92db7101ef5bfc18e96777ed7bc7c822d545fa5977e90a585accac43d22f18a \ + --hash=sha256:dc586724a95b7d980aa17f671e173df00f0a2eef23f8babbeee663229a938fec \ + --hash=sha256:dd81b911d28925e7e8b323e8d06951554655021df8dd4ac3045d7212ac4ba080 \ + --hash=sha256:e3affdcbc2afb6f5bd0eb3130139ceedc5e3f28d206fe49f63073cb9e65988e0 \ + --hash=sha256:e5cb5526d69bb9143c2e4d2a115d08ffca3d8e0fddc84925a7b54931c96f5c02 \ + --hash=sha256:efababa8e12330aa94a53e90a81eb6e2d55f348bc2e71adbf17d9cad23c03ee6 \ + --hash=sha256:f3ef052283da7dec1987bba8d8733051c2325654641dfe5877a4022108098683 \ + --hash=sha256:fbd2288890b88e8aab4499e55148805b58ec711053588cc2f0196a44f6e3d855 + # via django-layout (pyproject.toml) +sqlparse==0.4.4 \ + --hash=sha256:5430a4fe2ac7d0f93e66f1efc6e1338a41884b7ddf2a350cedd20ccc4d9d28f3 \ + --hash=sha256:d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c + # via + # -c /Users/alexclark/Developer/lincolnloop/django-layout/requirements.txt + # django +types-pytz==2024.1.0.20240203 \ + --hash=sha256:9679eef0365db3af91ef7722c199dbb75ee5c1b67e3c4dd7bfbeb1b8a71c21a3 \ + --hash=sha256:c93751ee20dfc6e054a0148f8f5227b9a00b79c90a4d3c9f464711a73179c89e + # via django-stubs +types-pyyaml==6.0.12.12 \ + --hash=sha256:334373d392fde0fdf95af5c3f1661885fa10c52167b14593eb856289e1855062 \ + --hash=sha256:c05bc6c158facb0676674b7f11fe3960db4f389718e19e62bd2b84d6205cfd24 + # via django-stubs +typing-extensions==4.9.0 \ + --hash=sha256:23478f88c37f27d76ac8aee6c905017a143b0b1b886c3c9f66bc2fd94f9f5783 \ + --hash=sha256:af72aea155e91adfc61c3ae9e0e342dbc0cba726d6cba4b6c72c1f34e47291cd + # via + # django-stubs + # django-stubs-ext + # mypy +wheel==0.42.0 \ + --hash=sha256:177f9c9b0d45c47873b619f5b650346d632cdc35fb5e4d25058e09c9e581433d \ + --hash=sha256:c45be39f7882c9d34243236f2d63cbd58039e360f85d0913425fbd7ceea617a8 + # via pip-tools + +# WARNING: The following packages were not pinned, but pip requires them to be +# pinned when the requirements file includes hashes and the requirement is not +# satisfied by a package already installed. Consider using the --allow-unsafe flag. +# pip +# setuptools diff --git a/requirements/dev.in b/requirements/dev.in deleted file mode 100644 index 26bef69..0000000 --- a/requirements/dev.in +++ /dev/null @@ -1,4 +0,0 @@ ---constraint ../requirements.txt -pip-tools -black -isort diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index 822bbb3..0000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,80 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.12 -# by the following command: -# -# pip-compile --generate-hashes --output-file=requirements/dev.txt requirements/dev.in -# -black==24.1.1 \ - --hash=sha256:0269dfdea12442022e88043d2910429bed717b2d04523867a85dacce535916b8 \ - --hash=sha256:07204d078e25327aad9ed2c64790d681238686bce254c910de640c7cc4fc3aa6 \ - --hash=sha256:08b34e85170d368c37ca7bf81cf67ac863c9d1963b2c1780c39102187ec8dd62 \ - --hash=sha256:1a95915c98d6e32ca43809d46d932e2abc5f1f7d582ffbe65a5b4d1588af7445 \ - --hash=sha256:2588021038bd5ada078de606f2a804cadd0a3cc6a79cb3e9bb3a8bf581325a4c \ - --hash=sha256:2fa6a0e965779c8f2afb286f9ef798df770ba2b6cee063c650b96adec22c056a \ - --hash=sha256:34afe9da5056aa123b8bfda1664bfe6fb4e9c6f311d8e4a6eb089da9a9173bf9 \ - --hash=sha256:3897ae5a21ca132efa219c029cce5e6bfc9c3d34ed7e892113d199c0b1b444a2 \ - --hash=sha256:40657e1b78212d582a0edecafef133cf1dd02e6677f539b669db4746150d38f6 \ - --hash=sha256:48b5760dcbfe5cf97fd4fba23946681f3a81514c6ab8a45b50da67ac8fbc6c7b \ - --hash=sha256:5242ecd9e990aeb995b6d03dc3b2d112d4a78f2083e5a8e86d566340ae80fec4 \ - --hash=sha256:5cdc2e2195212208fbcae579b931407c1fa9997584f0a415421748aeafff1168 \ - --hash=sha256:5d7b06ea8816cbd4becfe5f70accae953c53c0e53aa98730ceccb0395520ee5d \ - --hash=sha256:7258c27115c1e3b5de9ac6c4f9957e3ee2c02c0b39222a24dc7aa03ba0e986f5 \ - --hash=sha256:854c06fb86fd854140f37fb24dbf10621f5dab9e3b0c29a690ba595e3d543024 \ - --hash=sha256:a21725862d0e855ae05da1dd25e3825ed712eaaccef6b03017fe0853a01aa45e \ - --hash=sha256:a83fe522d9698d8f9a101b860b1ee154c1d25f8a82ceb807d319f085b2627c5b \ - --hash=sha256:b3d64db762eae4a5ce04b6e3dd745dcca0fb9560eb931a5be97472e38652a161 \ - --hash=sha256:e298d588744efda02379521a19639ebcd314fba7a49be22136204d7ed1782717 \ - --hash=sha256:e2c8dfa14677f90d976f68e0c923947ae68fa3961d61ee30976c388adc0b02c8 \ - --hash=sha256:ecba2a15dfb2d97105be74bbfe5128bc5e9fa8477d8c46766505c1dda5883aac \ - --hash=sha256:fc1ec9aa6f4d98d022101e015261c056ddebe3da6a8ccfc2c792cbe0349d48b7 - # via -r requirements/dev.in -build==1.0.3 \ - --hash=sha256:538aab1b64f9828977f84bc63ae570b060a8ed1be419e7870b8b4fc5e6ea553b \ - --hash=sha256:589bf99a67df7c9cf07ec0ac0e5e2ea5d4b37ac63301c4986d1acb126aa83f8f - # via pip-tools -click==8.1.7 \ - --hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \ - --hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de - # via - # black - # pip-tools -isort==5.13.2 \ - --hash=sha256:48fdfcb9face5d58a4f6dde2e72a1fb8dcaf8ab26f95ab49fab84c2ddefb0109 \ - --hash=sha256:8ca5e72a8d85860d5a3fa69b8745237f2939afe12dbf656afbcb47fe72d947a6 - # via -r requirements/dev.in -mypy-extensions==1.0.0 \ - --hash=sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d \ - --hash=sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782 - # via black -packaging==23.2 \ - --hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \ - --hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 - # via - # black - # build -pathspec==0.12.1 \ - --hash=sha256:a0d503e138a4c123b27490a4f7beda6a01c6f288df0e4a8b79c7eb0dc7b4cc08 \ - --hash=sha256:a482d51503a1ab33b1c67a6c3813a26953dbdc71c31dacaef9a838c4e29f5712 - # via black -pip-tools==7.3.0 \ - --hash=sha256:8717693288720a8c6ebd07149c93ab0be1fced0b5191df9e9decd3263e20d85e \ - --hash=sha256:8e9c99127fe024c025b46a0b2d15c7bd47f18f33226cf7330d35493663fc1d1d - # via -r requirements/dev.in -platformdirs==4.2.0 \ - --hash=sha256:0614df2a2f37e1a662acbd8e2b25b92ccf8632929bc6d43467e17fe89c75e068 \ - --hash=sha256:ef0cc731df711022c174543cb70a9b5bd22e5a9337c8624ef2c2ceb8ddad8768 - # via black -pyproject-hooks==1.0.0 \ - --hash=sha256:283c11acd6b928d2f6a7c73fa0d01cb2bdc5f07c57a2eeb6e83d5e56b97976f8 \ - --hash=sha256:f271b298b97f5955d53fb12b72c1fb1948c22c1a6b70b315c54cedaca0264ef5 - # via build -wheel==0.42.0 \ - --hash=sha256:177f9c9b0d45c47873b619f5b650346d632cdc35fb5e4d25058e09c9e581433d \ - --hash=sha256:c45be39f7882c9d34243236f2d63cbd58039e360f85d0913425fbd7ceea617a8 - # via pip-tools - -# WARNING: The following packages were not pinned, but pip requires them to be -# pinned when the requirements file includes hashes and the requirement is not -# satisfied by a package already installed. Consider using the --allow-unsafe flag. -# pip -# setuptools diff --git a/requirements/requirements.in b/requirements/requirements.in deleted file mode 100644 index b2fc625..0000000 --- a/requirements/requirements.in +++ /dev/null @@ -1,11 +0,0 @@ -# pip install --upgrade --pre pip wheel setuptools pip-tools -# pip-compile --generate-hashes --output-file=requirements.txt requirements/requirements.in -# pip install -r requirements.txt - ---pre Django=={{ django_version }} -dj-database-url -goodconf[yaml] -django-alive -django-csp -whitenoise -psycopg2 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 4cdd225..0000000 --- a/setup.cfg +++ /dev/null @@ -1,8 +0,0 @@ -[metadata] -name = {{ project_name }} -version = 2.0 - -[options.entry_points] -console_scripts = - manage.py = {{ project_name }}.config:config.django_manage - generate-config = {{ project_name }}.config:generate_config diff --git a/setup.py b/setup.py deleted file mode 100644 index c823345..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env python -from setuptools import setup - -setup()