Skip to content

Commit 01dd2ae

Browse files
committed
Update to poetry 2.0
1 parent 6c97281 commit 01dd2ae

File tree

12 files changed

+240
-321
lines changed

12 files changed

+240
-321
lines changed

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ on:
1313
jobs:
1414
docs:
1515
uses: MrThearMan/CI/.github/workflows/[email protected]
16+
with:
17+
poetry-version: "2.0.0"

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ jobs:
1010
uses: MrThearMan/CI/.github/workflows/[email protected]
1111
secrets:
1212
pypi-token: ${{ secrets.PYPI_API_TOKEN }}
13+
with:
14+
poetry-version: "2.0.0"

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ jobs:
1717
uses: MrThearMan/CI/.github/workflows/[email protected]
1818
with:
1919
python-version: '["3.10", "3.11", "3.12", "3.13"]'
20+
poetry-version: "2.0.0"

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ repos:
2020
]
2121

2222
- repo: https://github.com/astral-sh/ruff-pre-commit
23-
rev: v0.8.4
23+
rev: v0.9.0
2424
hooks:
2525
- id: ruff
2626
- id: ruff-format
2727

2828
- repo: https://github.com/python-poetry/poetry
29-
rev: 1.8.0
29+
rev: 2.0.0
3030
hooks:
3131
- id: poetry-check
3232
- id: poetry-lock

Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export DJANGO_SETTINGS_MODULE = example_project.config.settings
1111
.PHONY: lint
1212
.PHONY: migrate
1313
.PHONY: migrations
14-
.PHONY: mypy
1514
.PHONY: profile
1615
.PHONY: setup
1716
.PHONY: test
@@ -39,7 +38,6 @@ define helptext
3938
lint Run pre-commit hooks on all files.
4039
migrate Migrate database.
4140
migrations Make migrations.
42-
mypy Run mypy on all files.
4341
profile <pid> Run py-spy for a given PID.
4442
setup Make migrations, apply them, and add a superuser
4543
test <name> Run all tests maching the given <name>
@@ -81,9 +79,6 @@ migrate:
8179
migrations:
8280
@poetry run python manage.py makemigrations
8381

84-
mypy:
85-
@poetry run mypy query_optimizer/
86-
8782
profile:
8883
@poetry run py-spy record -o profile.svg --pid $(call args, "")
8984

example_project/app/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def log(self) -> str:
5454

5555
query: str
5656
summary: str
57-
for index, (query, summary) in enumerate(zip(self.queries, self.stacks)):
57+
for index, (query, summary) in enumerate(zip(self.queries, self.stacks, strict=False)):
5858
message += f"{index + 1})"
5959
message += "\n\n"
6060
message += "--- Query ".ljust(75, "-")

example_project/config/logging.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import logging
22
import traceback
3+
from collections.abc import Callable
34
from pathlib import Path
4-
from typing import Any, Callable
5+
from typing import Any
56

67
logger = logging.getLogger(__name__)
78

poetry.lock

Lines changed: 208 additions & 273 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
[tool.poetry]
1+
[project]
22
name = "graphene-django-query-optimizer"
33
version = "0.10.5"
44
description = "Automatically optimize SQL queries in Graphene-Django schemas."
55
authors = [
6-
"Matti Lamppu <[email protected]>",
7-
]
8-
packages = [
9-
{ include = "query_optimizer" },
6+
{ name = "Matti Lamppu", email = "[email protected]" },
107
]
118
license = "MIT"
129
readme = "README.md"
13-
homepage = "https://mrthearman.github.io/graphene-django-query-optimizer"
14-
repository = "https://github.com/MrThearMan/graphene-django-query-optimizer"
15-
documentation = "https://mrthearman.github.io/graphene-django-query-optimizer"
1610
keywords = [
1711
"django",
1812
"graphene",
@@ -39,48 +33,49 @@ classifiers = [
3933
"Framework :: Django :: 5.0",
4034
"Framework :: Django :: 5.1",
4135
]
42-
include = [
43-
"README.md",
44-
"LICENSE",
45-
]
46-
exclude = [
47-
"tests",
36+
requires-python = ">=3.10,<4"
37+
dynamic = [
38+
"dependencies",
4839
]
4940

50-
[tool.poetry.urls]
41+
[project.urls]
42+
"Homepage" = "https://mrthearman.github.io/graphene-django-query-optimizer"
43+
"Repository" = "https://github.com/MrThearMan/graphene-django-query-optimizer"
5144
"Bug Tracker" = "https://github.com/MrThearMan/graphene-django-query-optimizer/issues"
45+
"Documentation" = "https://mrthearman.github.io/graphene-django-query-optimizer"
46+
47+
[tool.poetry]
48+
requires-poetry = ">=2.0.0"
49+
packages = [
50+
{ include = "query_optimizer" },
51+
]
5252

5353
[tool.poetry.dependencies]
54-
python = ">=3.10,<4"
5554
Django = ">=4.2"
5655
graphene-django = ">=3.0.0"
5756
django-settings-holder = ">=0.1.2"
5857
django-filter = { version = ">=21.1", optional = true }
5958

60-
[tool.poetry.extras]
61-
filter = ["django-filter"]
62-
6359
[tool.poetry.group.test.dependencies]
6460
pytest = "8.3.4"
6561
coverage = "7.6.10"
6662
pytest-django = "4.9.0"
6763
tox = "4.23.2"
6864
tox-gh-actions = "3.2.0"
69-
faker = "33.3.0"
65+
faker = "33.3.1"
7066
factory-boy = "3.3.1"
7167
sqlparse = "0.5.3"
7268
django-graphiql-debug-toolbar = "0.2.0"
7369
py-spy = "0.4.0"
70+
django-filter = "24.3"
7471

7572
[tool.poetry.group.docs.dependencies]
7673
mkdocs = "1.6.1"
77-
pymdown-extensions = "10.13"
74+
pymdown-extensions = "10.14"
7875
mkdocs-mermaid2-plugin = "1.2.1"
7976

8077
[tool.poetry.group.lint.dependencies]
81-
mypy = "1.14.1"
8278
pre-commit = "4.0.1"
83-
django-stubs = "5.1.1"
8479

8580
[tool.ruff]
8681
fix = true
@@ -167,6 +162,7 @@ lint.extend-select = [
167162
"UP042", # replace-str-enum
168163
]
169164
lint.ignore = [
165+
"A005", # Allow shadowing builtin modules
170166
"ANN401", # Any-typing allowed
171167
"ARG002", # Unused method argument
172168
"ARG003", # Unused class method argument
@@ -268,18 +264,6 @@ extend-ignore-names = [
268264
[tool.ruff.lint.pylint]
269265
max-args = 7
270266

271-
[tool.mypy]
272-
python_version = "3.13"
273-
warn_return_any = true
274-
warn_unused_configs = true
275-
ignore_missing_imports = true
276-
plugins = [
277-
"mypy_django_plugin.main",
278-
]
279-
280-
[tool.django-stubs]
281-
django_settings_module = "example_project.config.settings"
282-
283267
[tool.coverage.run]
284268
relative_files = true
285269

query_optimizer/optimizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def paginate_prefetch_queryset(self, queryset: QuerySet, filter_info: GraphQLFil
200200
remote_field = field.remote_field
201201
field_name = (
202202
remote_field.name # .
203-
if isinstance(field, (models.ManyToManyField, GenericRelation))
203+
if isinstance(field, models.ManyToManyField | GenericRelation)
204204
else remote_field.attname
205205
)
206206

0 commit comments

Comments
 (0)