Skip to content

Commit

Permalink
Adopt ruff formatter and linter (#2)
Browse files Browse the repository at this point in the history
* update poetry configuration to new format
* adopt ruff formatter and linter
* remove invalid rule selector `W503`
* remove obsolete lint script
  • Loading branch information
xshapira authored Apr 16, 2024
1 parent 6b37c77 commit b6aa24f
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 138 deletions.
12 changes: 0 additions & 12 deletions bin/lint

This file was deleted.

134 changes: 27 additions & 107 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 33 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
name = "djantic2"
version = "1.0.1"
description = "Pydantic models for Django"
authors = ["Jonathan Sundqvist <[email protected]>", "Jordan Eremieff <[email protected]>"]
authors = [
"Jonathan Sundqvist <[email protected]>",
"Jordan Eremieff <[email protected]>",
]
license = "MIT"
packages = [{include = "djantic"}]
packages = [{ include = "djantic" }]

[tool.poetry.dependencies]
python = "^3.8"
pydantic = "^2.6.2"
Django = ">3,<6"

[tool.poetry.dev-dependencies]
black = "^24.2.0"
[tool.poetry.group.dev.dependencies]
ruff = "^0.3.7"
setuptools = "^65.5.1"
twine = "^3.4.1"
wheel = "^0.38.1"
flake8 = "^3.9.2"
mypy = "^0.910"
pytest = "^6.2.4"
pytest-cov = "^2.12.1"
Expand All @@ -33,6 +35,32 @@ psycopg2-binary = "^2.9.1"
bump2version = "^1.0.1"
factory-boy = "^3.2.1"


[tool.ruff]
line-length = 88
exclude = ['.git', '__pycache__', '__init__.py', '.mypy_cache', '.pytest_cache']
lint.select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"UP", # pyupgrade
]
lint.ignore = [
"E501", # line too long
"C901", # Comprehension is too complex (11 > 10)
"W191", # indentation contains tabs
"E402",
"E203",
]

[tool.ruff.lint.pyupgrade]
# Preserve types, even if a file imports `from __future__ import annotations`.
keep-runtime-typing = true


[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
17 changes: 3 additions & 14 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
[flake8]
max-line-length = 88
ignore = E203, W503
exclude =
.git
.venv
__pycache__
.eggs
*.egg
settings.py

[mypy]
disallow_any_generics = True
disallow_any_explicit = True
Expand All @@ -32,7 +21,7 @@ warn_no_return = True

[tool:pytest]
DJANGO_SETTINGS_MODULE = tests.testapp.settings
norecursedirs =
norecursedirs =
data
static
node_modules
Expand All @@ -44,7 +33,7 @@ norecursedirs =
.pytest_cache
.secret
.txt
.idea
.idea
.git
.venv
*.egg
Expand All @@ -58,4 +47,4 @@ addopts = -v
--durations=10
-p no:logging
-s
--ignore .venv
--ignore .venv

0 comments on commit b6aa24f

Please sign in to comment.