Skip to content

Commit

Permalink
Drop singledispatch (#234)
Browse files Browse the repository at this point in the history
* drop singledispatch dependency

* bump: graphene-mongo v0.4.3

---------

Co-authored-by: Ananthu C V <weepingclown@disroot.org>
  • Loading branch information
mak626 and WeepingClown13 committed Mar 12, 2024
1 parent 8f46790 commit 6851c41
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 240 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Lint with ruff
run: |
python -m pip install ruff
make lint
- name: Install dependencies
run: |
python -m pip install poetry
poetry config virtualenvs.create false
poetry install --with dev
- name: Lint with ruff
run: make lint
- name: Run Tests
run: make test
- name: Build Package
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python }}
- name: Lint with ruff
- name: Install dependencies
run: |
python -m pip install ruff
make lint
python -m pip install poetry
poetry config virtualenvs.create false
poetry install --with dev
- name: Lint with ruff
run: make lint
1 change: 1 addition & 0 deletions examples/django_mongoengine/bike_catalog/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""

from django.contrib import admin
from django.urls import path, include

Expand Down
1 change: 1 addition & 0 deletions examples/django_mongoengine/manage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""

import os
import sys

Expand Down
4 changes: 1 addition & 3 deletions graphene_mongo/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
from mongoengine.base import get_document, LazyReference
from . import advanced_types
from .utils import (
import_single_dispatch,
get_field_description,
get_query_fields,
ExecutorEnum,
sync_to_async,
)
from concurrent.futures import ThreadPoolExecutor, as_completed

singledispatch = import_single_dispatch()
from functools import singledispatch


class MongoEngineConversionError(Exception):
Expand Down
23 changes: 0 additions & 23 deletions graphene_mongo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,6 @@ def is_valid_mongoengine_model(model):
)


def import_single_dispatch():
try:
from functools import singledispatch
except ImportError:
singledispatch = None

if not singledispatch:
try:
from singledispatch import singledispatch
except ImportError:
pass

if not singledispatch:
raise Exception(
"It seems your python version does not include "
"functools.singledispatch. Please install the 'singledispatch' "
"package. More information here: "
"https://pypi.python.org/pypi/singledispatch"
)

return singledispatch


# noqa
def get_type_for_document(schema, document):
types = schema.types.values()
Expand Down
394 changes: 190 additions & 204 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "graphene-mongo"
packages = [{ include = "graphene_mongo" }]
version = "0.4.2"
version = "0.4.3"
description = "Graphene Mongoengine integration"
authors = [
"Abaw Chen <abaw.chen@gmail.com>",
Expand Down Expand Up @@ -31,7 +31,6 @@ python = ">=3.8,<4"
graphene = ">=3.1.1"
promise = ">=2.3"
mongoengine = ">=0.27"
singledispatch = ">=4.1.0"
asgiref = "^3.7.2"

[tool.poetry.group.dev.dependencies]
Expand All @@ -40,7 +39,7 @@ mongomock = ">=4.1.2"
mock = ">=5.0.1"
pytest-cov = "*"
pytest-asyncio = "^0.21.0"
ruff = "^0.1.6"
ruff = "*"
setuptools = "^69.0.2"


Expand Down

0 comments on commit 6851c41

Please sign in to comment.