From af8888f58e1004000ba90adfd42231546c08ccd2 Mon Sep 17 00:00:00 2001 From: Firas K <3097061+firaskafri@users.noreply.github.com> Date: Wed, 3 May 2023 13:25:16 +0300 Subject: [PATCH] Upgrade github actions versions, default python and dev dependencies (#1407) * Use Python 3.10 for deployments on PyPi * Update gh-action-pypi-publish version * Update python version * Update checkout and setup-python versions * Upgrade dev dependencies * fromat examples and few files to follow black new version * Upgrade pytest version --------- Co-authored-by: Firas Kafri --- .github/workflows/deploy.yml | 10 +++++----- .github/workflows/lint.yml | 8 ++++---- .github/workflows/tests.yml | 4 ++-- .pre-commit-config.yaml | 10 +++++----- .../cookbook/ingredients/migrations/0001_initial.py | 1 - .../ingredients/migrations/0002_auto_20161104_0050.py | 1 - .../ingredients/migrations/0003_auto_20181018_1746.py | 1 - .../cookbook/recipes/migrations/0001_initial.py | 1 - .../recipes/migrations/0002_auto_20161104_0106.py | 1 - .../recipes/migrations/0003_auto_20181018_1728.py | 1 - .../cookbook/ingredients/migrations/0001_initial.py | 1 - .../ingredients/migrations/0002_auto_20161104_0050.py | 1 - .../cookbook/recipes/migrations/0001_initial.py | 1 - .../recipes/migrations/0002_auto_20161104_0106.py | 1 - graphene_django/filter/tests/conftest.py | 1 - graphene_django/forms/mutation.py | 2 -- graphene_django/rest_framework/mutation.py | 1 - graphene_django/tests/schema_view.py | 1 - graphene_django/tests/test_query.py | 2 -- setup.py | 10 +++++----- 20 files changed, 21 insertions(+), 38 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 07c0766..a733c03 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,17 +10,17 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: '3.10' - name: Build wheel and source tarball run: | pip install wheel python setup.py sdist bdist_wheel - name: Publish a Python distribution to PyPI - uses: pypa/gh-action-pypi-publish@v1.1.0 + uses: pypa/gh-action-pypi-publish@v1.8.6 with: user: __token__ password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9f1c3ab..8cee90a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,11 +7,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: '3.10' - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c2cdc99..31b479e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,9 +14,9 @@ jobs: - django: "3.2" python-version: "3.7" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e64c4e1..adb54c7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,8 @@ default_language_version: - python: python3.9 + python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-merge-conflict - id: check-json @@ -16,15 +16,15 @@ repos: - id: trailing-whitespace exclude: README.md - repo: https://github.com/asottile/pyupgrade - rev: v3.2.0 + rev: v3.3.2 hooks: - id: pyupgrade args: [--py37-plus] - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 23.3.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 diff --git a/examples/cookbook-plain/cookbook/ingredients/migrations/0001_initial.py b/examples/cookbook-plain/cookbook/ingredients/migrations/0001_initial.py index 345cadb..23d71e8 100644 --- a/examples/cookbook-plain/cookbook/ingredients/migrations/0001_initial.py +++ b/examples/cookbook-plain/cookbook/ingredients/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/examples/cookbook-plain/cookbook/ingredients/migrations/0002_auto_20161104_0050.py b/examples/cookbook-plain/cookbook/ingredients/migrations/0002_auto_20161104_0050.py index 00fe255..5f9e7a0 100644 --- a/examples/cookbook-plain/cookbook/ingredients/migrations/0002_auto_20161104_0050.py +++ b/examples/cookbook-plain/cookbook/ingredients/migrations/0002_auto_20161104_0050.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("ingredients", "0001_initial"), ] diff --git a/examples/cookbook-plain/cookbook/ingredients/migrations/0003_auto_20181018_1746.py b/examples/cookbook-plain/cookbook/ingredients/migrations/0003_auto_20181018_1746.py index 8015d1f..e823a2e 100644 --- a/examples/cookbook-plain/cookbook/ingredients/migrations/0003_auto_20181018_1746.py +++ b/examples/cookbook-plain/cookbook/ingredients/migrations/0003_auto_20181018_1746.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("ingredients", "0002_auto_20161104_0050"), ] diff --git a/examples/cookbook-plain/cookbook/recipes/migrations/0001_initial.py b/examples/cookbook-plain/cookbook/recipes/migrations/0001_initial.py index fceeb9b..c415147 100644 --- a/examples/cookbook-plain/cookbook/recipes/migrations/0001_initial.py +++ b/examples/cookbook-plain/cookbook/recipes/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/examples/cookbook-plain/cookbook/recipes/migrations/0002_auto_20161104_0106.py b/examples/cookbook-plain/cookbook/recipes/migrations/0002_auto_20161104_0106.py index 0156920..f38bb69 100644 --- a/examples/cookbook-plain/cookbook/recipes/migrations/0002_auto_20161104_0106.py +++ b/examples/cookbook-plain/cookbook/recipes/migrations/0002_auto_20161104_0106.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("recipes", "0001_initial"), ] diff --git a/examples/cookbook-plain/cookbook/recipes/migrations/0003_auto_20181018_1728.py b/examples/cookbook-plain/cookbook/recipes/migrations/0003_auto_20181018_1728.py index c54855b..dacdb30 100644 --- a/examples/cookbook-plain/cookbook/recipes/migrations/0003_auto_20181018_1728.py +++ b/examples/cookbook-plain/cookbook/recipes/migrations/0003_auto_20181018_1728.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("recipes", "0002_auto_20161104_0106"), ] diff --git a/examples/cookbook/cookbook/ingredients/migrations/0001_initial.py b/examples/cookbook/cookbook/ingredients/migrations/0001_initial.py index 345cadb..23d71e8 100644 --- a/examples/cookbook/cookbook/ingredients/migrations/0001_initial.py +++ b/examples/cookbook/cookbook/ingredients/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/examples/cookbook/cookbook/ingredients/migrations/0002_auto_20161104_0050.py b/examples/cookbook/cookbook/ingredients/migrations/0002_auto_20161104_0050.py index 00fe255..5f9e7a0 100644 --- a/examples/cookbook/cookbook/ingredients/migrations/0002_auto_20161104_0050.py +++ b/examples/cookbook/cookbook/ingredients/migrations/0002_auto_20161104_0050.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("ingredients", "0001_initial"), ] diff --git a/examples/cookbook/cookbook/recipes/migrations/0001_initial.py b/examples/cookbook/cookbook/recipes/migrations/0001_initial.py index fceeb9b..c415147 100644 --- a/examples/cookbook/cookbook/recipes/migrations/0001_initial.py +++ b/examples/cookbook/cookbook/recipes/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - initial = True dependencies = [ diff --git a/examples/cookbook/cookbook/recipes/migrations/0002_auto_20161104_0106.py b/examples/cookbook/cookbook/recipes/migrations/0002_auto_20161104_0106.py index 0156920..f38bb69 100644 --- a/examples/cookbook/cookbook/recipes/migrations/0002_auto_20161104_0106.py +++ b/examples/cookbook/cookbook/recipes/migrations/0002_auto_20161104_0106.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("recipes", "0001_initial"), ] diff --git a/graphene_django/filter/tests/conftest.py b/graphene_django/filter/tests/conftest.py index a11831c..f8a65d7 100644 --- a/graphene_django/filter/tests/conftest.py +++ b/graphene_django/filter/tests/conftest.py @@ -87,7 +87,6 @@ def Query(EventType): events = DjangoFilterConnectionField(EventType) def resolve_events(self, info, **kwargs): - events = [ Event(name="Live Show", tags=["concert", "music", "rock"]), Event(name="Musical", tags=["movie", "music"]), diff --git a/graphene_django/forms/mutation.py b/graphene_django/forms/mutation.py index 3d59464..40d1d3c 100644 --- a/graphene_django/forms/mutation.py +++ b/graphene_django/forms/mutation.py @@ -82,7 +82,6 @@ class DjangoFormMutation(BaseDjangoFormMutation): def __init_subclass_with_meta__( cls, form_class=None, only_fields=(), exclude_fields=(), **options ): - if not form_class: raise Exception("form_class is required for DjangoFormMutation") @@ -129,7 +128,6 @@ class DjangoModelFormMutation(BaseDjangoFormMutation): exclude_fields=(), **options, ): - if not form_class: raise Exception("form_class is required for DjangoModelFormMutation") diff --git a/graphene_django/rest_framework/mutation.py b/graphene_django/rest_framework/mutation.py index c01d915..4062a44 100644 --- a/graphene_django/rest_framework/mutation.py +++ b/graphene_django/rest_framework/mutation.py @@ -72,7 +72,6 @@ class SerializerMutation(ClientIDMutation): _meta=None, **options ): - if not serializer_class: raise Exception("serializer_class is required for the SerializerMutation") diff --git a/graphene_django/tests/schema_view.py b/graphene_django/tests/schema_view.py index 8ed2ecf..4d538ba 100644 --- a/graphene_django/tests/schema_view.py +++ b/graphene_django/tests/schema_view.py @@ -5,7 +5,6 @@ from .mutations import PetFormMutation, PetMutation class QueryRoot(ObjectType): - thrower = graphene.String(required=True) request = graphene.String(required=True) test = graphene.String(who=graphene.String()) diff --git a/graphene_django/tests/test_query.py b/graphene_django/tests/test_query.py index df339d8..383ff2e 100644 --- a/graphene_django/tests/test_query.py +++ b/graphene_django/tests/test_query.py @@ -780,7 +780,6 @@ def test_should_query_promise_connectionfields(): def test_should_query_connectionfields_with_last(): - r = Reporter.objects.create( first_name="John", last_name="Doe", email="johndoe@example.com", a_choice=1 ) @@ -818,7 +817,6 @@ def test_should_query_connectionfields_with_last(): def test_should_query_connectionfields_with_manager(): - r = Reporter.objects.create( first_name="John", last_name="Doe", email="johndoe@example.com", a_choice=1 ) diff --git a/setup.py b/setup.py index cc9770c..96da8ff 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ rest_framework_require = ["djangorestframework>=3.6.3"] tests_require = [ - "pytest>=7.1.3", + "pytest>=7.3.1", "pytest-cov", "pytest-random-order", "coveralls", @@ -26,10 +26,10 @@ tests_require = [ dev_requires = [ - "black==22.8.0", - "flake8==5.0.4", - "flake8-black==0.3.3", - "flake8-bugbear==22.9.11", + "black==23.3.0", + "flake8==6.0.0", + "flake8-black==0.3.6", + "flake8-bugbear==23.3.23", "pre-commit", ] + tests_require