Use uv instead of Poetry

This commit is contained in:
2024-12-09 06:17:08 +01:00
parent b87e639156
commit dc19efc536
6 changed files with 125 additions and 1379 deletions

24
.gitignore vendored
View File

@ -92,22 +92,30 @@ ipython_config.py
# However, in case of collaboration, if having platform-specific dependencies or dependencies # However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not # having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies. # install all needed dependencies.
#Pipfile.lock Pipfile.lock
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
uv.lock
# poetry # poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more # This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries. # commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock poetry.lock
# pdm # pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control. # in version control.
# https://pdm.fming.dev/#use-with-ide # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml .pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/ __pypackages__/
@ -159,8 +167,10 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
*.json # Old responses
**/json/*.json
**/json2/*.json
**/json3/*.json
# The directory where "django-admin collectstatic" will collect static files for deployment.
staticfiles/ staticfiles/
*.sqlite

1
.python-version Normal file
View File

@ -0,0 +1 @@
3.13

1314
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,64 +1,71 @@
[tool.poetry] [project]
name = "twitch-drop-notifier" name = "twitch-drop-notifier"
version = "0.1.0" version = "0.1.0"
description = "" description = "A Django app that notifies you when a new Twitch drop is available."
authors = ["Joakim Hellsén <tlovinator@gmail.com>"]
readme = "README.md" readme = "README.md"
package-mode = false requires-python = ">=3.13"
dependencies = [
[tool.poetry.dependencies] "discord-webhook",
python = "^3.12" "django-debug-toolbar",
discord-webhook = "^1.3.1" "django-stubs-ext",
django = { version = "^5.1.2" } "django",
django-debug-toolbar = "^4.4.6" "platformdirs",
django-simple-history = "^3.7.0" "psycopg[binary,pool]",
pillow = "^10.4.0" "python-dotenv",
platformdirs = "^4.3.6"
python-dotenv = "^1.0.1"
requests = "^2.32.3"
requests-cache = "^1.2.1"
sentry-sdk = { extras = ["django"], version = "^2.16.0" }
undetected-playwright-patch = "^1.40.0.post1700587210000"
whitenoise = { extras = ["brotli"], version = "^6.7.0" }
[tool.poetry.group.dev.dependencies]
djlint = "^1.35.2"
pre-commit = "^3.8.0"
pytest = "^8.3.3"
pytest-django = "^4.9.0"
ruff = "^0.5.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.ruff]
# https://docs.astral.sh/ruff/settings/
target-version = "py312"
fix = true
unsafe-fixes = true
preview = true
lint.select = ["ALL"]
line-length = 119
lint.pydocstyle.convention = "google"
lint.ignore = [
"CPY001", # Missing copyright notice at top of file
"D100", # Checks for undocumented public module definitions.
"D101", # Checks for undocumented public class definitions.
"D102", # Checks for undocumented public method definitions.
"D104", # Missing docstring in public package.
"D105", # Missing docstring in magic method.
"D106", # Checks for undocumented public class definitions, for nested classes.
"ERA001", # Found commented-out code
"FIX002", # Line contains TODO
"COM812", # Checks for the absence of trailing commas.
"ISC001", # Checks for implicitly concatenated strings on a single line.
"DJ001", # Checks nullable string-based fields (like CharField and TextField) in Django models.
"PLR0912", # Too many branches # TODO: Actually fix this instead of ignoring it.
"PLR0915", # Too many statements # TODO: Actually fix this instead of ignoring it.
"C901", # Function is too complex # TODO: Actually fix this instead of ignoring it.
] ]
# You can install development dependencies with `uv install --dev`.
# Or you can install them with `uv install --dev -r requirements-dev.txt`.
# uv can be replaced with `pip`if you don't have uv installed.
[dependency-groups]
dev = [
"djlint",
"pre-commit",
"pytest",
"pytest-django",
"ruff",
"django-stubs[compatible-mypy]",
"black",
]
# https://docs.astral.sh/ruff/settings/
[tool.ruff]
# Enable all rules
lint.select = ["ALL"]
# https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
lint.pydocstyle.convention = "google"
# Ignore some rules
lint.ignore = [
"CPY001", # Checks for the absence of copyright notices within Python files.
"D100", # Checks for undocumented public module definitions.
"D104", # Checks for undocumented public package definitions.
"D106", # Checks for undocumented public class definitions, for nested classes.
"ERA001", # Checks for commented-out Python code.
"FIX002", # Checks for "TODO" comments.
# Conflicting lint rules when using Ruff's formatter
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"COM812", # Checks for the absence of trailing commas.
"COM819", # Checks for the presence of prohibited trailing commas.
"D206", # Checks for docstrings that are indented with tabs.
"D300", # Checks for docstrings that use '''triple single quotes''' instead of """triple double quotes""".
"E111", # Checks for indentation with a non-multiple of 4 spaces.
"E114", # Checks for indentation of comments with a non-multiple of 4 spaces.
"E117", # Checks for over-indented code.
"ISC001", # Checks for implicitly concatenated strings on a single line.
"ISC002", # Checks for implicitly concatenated strings that span multiple lines.
"Q000", # Checks for inline strings that use single quotes or double quotes, depending on the value of the lint.flake8-quotes.inline-quotes option.
"Q001", # Checks for multiline strings that use single quotes or double quotes, depending on the value of the lint.flake8-quotes.multiline-quotes setting.
"Q002", # Checks for docstrings that use single quotes or double quotes, depending on the value of the lint.flake8-quotes.docstring-quotes setting.
"Q003", # Checks for strings that include escaped quotes, and suggests changing the quote style to avoid the need to escape them.
"W191", # Checks for indentation that uses tabs.
]
# Default is 88 characters
line-length = 120
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"**/tests/**" = [ "**/tests/**" = [
"ARG", # Unused function args -> fixtures nevertheless are functionally relevant... "ARG", # Unused function args -> fixtures nevertheless are functionally relevant...
@ -71,11 +78,41 @@ lint.ignore = [
"RUF012", # Checks for mutable default values in class attributes. "RUF012", # Checks for mutable default values in class attributes.
] ]
# https://www.djlint.com/
[tool.djlint] [tool.djlint]
# Set a profile for the template language. The profile will enable linter rules that apply to your template language, and may also change reformatting.
profile = "django" profile = "django"
format_attribute_template_tags = true
ignore = "H006" # Img tag should have height and width attributes.
# Formatter will attempt to format template syntax inside of tag attributes.
format_attribute_template_tags = true
# Format contents of style tags using css-beautify
format_css = true
# Format contents of script tags using js-beautify.
format_js = true
# Ignore some rules
ignore = "H006" # Img tag should have height and width attributes.
# https://pytest-django.readthedocs.io/en/latest/
[tool.pytest.ini_options] [tool.pytest.ini_options]
# Where our Django settings are located.
DJANGO_SETTINGS_MODULE = "core.settings" DJANGO_SETTINGS_MODULE = "core.settings"
# Only run tests in files that match this pattern.
python_files = ["test_*.py"] python_files = ["test_*.py"]
[tool.mypy]
plugins = ["mypy_django_plugin.main"]
[tool.django-stubs]
django_settings_module = "core.settings"
[tool.black]
line-length = 120
preview = true
unstable = true
[tool.isort]
profile = "black"

6
requirements-dev.txt Normal file
View File

@ -0,0 +1,6 @@
django-stubs[compatible-mypy]
djlint
pre-commit
pytest
pytest-django
ruff

6
requirements.txt Normal file
View File

@ -0,0 +1,6 @@
discord-webhook
django
django-debug-toolbar
platformdirs
psycopg[binary,pool]
python-dotenv