Skip to content

Commit f16d434

Browse files
authored
Add Python 3.10 & Update Build Scripts (#352)
This PR drops tests for Python 3.6 and updates the build scripts.
1 parent 294d529 commit f16d434

File tree

11 files changed

+76
-72
lines changed

11 files changed

+76
-72
lines changed

.flake8

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
ignore = E203,W503
3+
exclude = .git,.mypy_cache,.pytest_cache,.tox,.venv,__pycache__,build,dist,docs
4+
max-line-length = 120

.github/workflows/deploy.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
14-
- name: Set up Python 3.9
15-
uses: actions/setup-python@v2
13+
- uses: actions/checkout@v3
14+
- name: Set up Python 3.10
15+
uses: actions/setup-python@v3
1616
with:
17-
python-version: 3.9
17+
python-version: '3.10'
1818
- name: Build wheel and source tarball
1919
run: |
2020
pip install wheel

.github/workflows/lint.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
11-
- name: Set up Python 3.9
12-
uses: actions/setup-python@v2
10+
- uses: actions/checkout@v3
11+
- name: Set up Python 3.10
12+
uses: actions/setup-python@v3
1313
with:
14-
python-version: 3.9
14+
python-version: '3.10'
1515
- name: Install dependencies
1616
run: |
1717
python -m pip install --upgrade pip

.github/workflows/tests.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ jobs:
99
max-parallel: 10
1010
matrix:
1111
sql-alchemy: ["1.2", "1.3", "1.4"]
12-
python-version: ["3.6", "3.7", "3.8", "3.9"]
12+
python-version: ["3.7", "3.8", "3.9", "3.10"]
1313

1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1616
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v3
1818
with:
1919
python-version: ${{ matrix.python-version }}
2020
- name: Install dependencies
@@ -27,12 +27,12 @@ jobs:
2727
SQLALCHEMY: ${{ matrix.sql-alchemy }}
2828
TOXENV: ${{ matrix.toxenv }}
2929
- name: Upload coverage.xml
30-
if: ${{ matrix.sql-alchemy == '1.4' && matrix.python-version == '3.9' }}
31-
uses: actions/upload-artifact@v2
30+
if: ${{ matrix.sql-alchemy == '1.4' && matrix.python-version == '3.10' }}
31+
uses: actions/upload-artifact@v3
3232
with:
3333
name: graphene-sqlalchemy-coverage
3434
path: coverage.xml
3535
if-no-files-found: error
3636
- name: Upload coverage.xml to codecov
37-
if: ${{ matrix.sql-alchemy == '1.4' && matrix.python-version == '3.9' }}
38-
uses: codecov/codecov-action@v1
37+
if: ${{ matrix.sql-alchemy == '1.4' && matrix.python-version == '3.10' }}
38+
uses: codecov/codecov-action@v3

.pre-commit-config.yaml

+15-18
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
default_language_version:
2-
python: python3.7
2+
python: python3.10
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: c8bad492e1b1d65d9126dba3fe3bd49a5a52b9d6 # v2.1.0
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.2.0
66
hooks:
7-
- id: check-merge-conflict
8-
- id: check-yaml
9-
- id: debug-statements
10-
- id: end-of-file-fixer
7+
- id: check-merge-conflict
8+
- id: check-yaml
9+
- id: debug-statements
10+
- id: end-of-file-fixer
1111
exclude: ^docs/.*$
12-
- id: trailing-whitespace
12+
- id: trailing-whitespace
1313
exclude: README.md
14-
- repo: https://github.com/PyCQA/flake8
15-
rev: 88caf5ac484f5c09aedc02167c59c66ff0af0068 # 3.7.7
14+
- repo: https://github.com/pycqa/isort
15+
rev: 5.10.1
1616
hooks:
17-
- id: flake8
18-
- repo: https://github.com/asottile/seed-isort-config
19-
rev: v1.7.0
17+
- id: isort
18+
name: isort (python)
19+
- repo: https://github.com/PyCQA/flake8
20+
rev: 4.0.0
2021
hooks:
21-
- id: seed-isort-config
22-
- repo: https://github.com/pre-commit/mirrors-isort
23-
rev: v4.3.4
24-
hooks:
25-
- id: isort
22+
- id: flake8

graphene_sqlalchemy/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from .types import SQLAlchemyObjectType
21
from .fields import SQLAlchemyConnectionField
2+
from .types import SQLAlchemyObjectType
33
from .utils import get_query, get_session
44

55
__version__ = "3.0.0b1"

graphene_sqlalchemy/converter.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
from typing import _ForwardRef as ForwardRef
3030

3131
try:
32-
from sqlalchemy_utils import ChoiceType, JSONType, ScalarListType, TSVectorType
32+
from sqlalchemy_utils import (ChoiceType, JSONType, ScalarListType,
33+
TSVectorType)
3334
except ImportError:
3435
ChoiceType = JSONType = ScalarListType = TSVectorType = object
3536

graphene_sqlalchemy/types.py

+30-30
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525

2626
class ORMField(OrderedType):
2727
def __init__(
28-
self,
29-
model_attr=None,
30-
type_=None,
31-
required=None,
32-
description=None,
33-
deprecation_reason=None,
34-
batching=None,
35-
_creation_counter=None,
36-
**field_kwargs
28+
self,
29+
model_attr=None,
30+
type_=None,
31+
required=None,
32+
description=None,
33+
deprecation_reason=None,
34+
batching=None,
35+
_creation_counter=None,
36+
**field_kwargs
3737
):
3838
"""
3939
Use this to override fields automatically generated by SQLAlchemyObjectType.
@@ -89,7 +89,7 @@ class Meta:
8989

9090

9191
def construct_fields(
92-
obj_type, model, registry, only_fields, exclude_fields, batching, connection_field_factory
92+
obj_type, model, registry, only_fields, exclude_fields, batching, connection_field_factory
9393
):
9494
"""
9595
Construct all the fields for a SQLAlchemyObjectType.
@@ -110,11 +110,11 @@ def construct_fields(
110110
inspected_model = sqlalchemy.inspect(model)
111111
# Gather all the relevant attributes from the SQLAlchemy model in order
112112
all_model_attrs = OrderedDict(
113-
inspected_model.column_attrs.items() +
114-
inspected_model.composites.items() +
115-
[(name, item) for name, item in inspected_model.all_orm_descriptors.items()
116-
if isinstance(item, hybrid_property)] +
117-
inspected_model.relationships.items()
113+
inspected_model.column_attrs.items()
114+
+ inspected_model.composites.items()
115+
+ [(name, item) for name, item in inspected_model.all_orm_descriptors.items()
116+
if isinstance(item, hybrid_property)]
117+
+ inspected_model.relationships.items()
118118
)
119119

120120
# Filter out excluded fields
@@ -191,21 +191,21 @@ class SQLAlchemyObjectTypeOptions(ObjectTypeOptions):
191191
class SQLAlchemyObjectType(ObjectType):
192192
@classmethod
193193
def __init_subclass_with_meta__(
194-
cls,
195-
model=None,
196-
registry=None,
197-
skip_registry=False,
198-
only_fields=(),
199-
exclude_fields=(),
200-
connection=None,
201-
connection_class=None,
202-
use_connection=None,
203-
interfaces=(),
204-
id=None,
205-
batching=False,
206-
connection_field_factory=None,
207-
_meta=None,
208-
**options
194+
cls,
195+
model=None,
196+
registry=None,
197+
skip_registry=False,
198+
only_fields=(),
199+
exclude_fields=(),
200+
connection=None,
201+
connection_class=None,
202+
use_connection=None,
203+
interfaces=(),
204+
id=None,
205+
batching=False,
206+
connection_field_factory=None,
207+
_meta=None,
208+
**options
209209
):
210210
# Make sure model is a valid SQLAlchemy model
211211
if not is_mapped_class(model):

graphene_sqlalchemy/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def sort_argument_for_model(cls, has_default=True):
140140
)
141141

142142
from graphene import Argument, List
143+
143144
from .enums import sort_enum_for_object_type
144145

145146
enum = sort_enum_for_object_type(

setup.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@
4141
"Intended Audience :: Developers",
4242
"Topic :: Software Development :: Libraries",
4343
"Programming Language :: Python :: 3",
44-
"Programming Language :: Python :: 3.6",
4544
"Programming Language :: Python :: 3.7",
4645
"Programming Language :: Python :: 3.8",
46+
"Programming Language :: Python :: 3.9",
47+
"Programming Language :: Python :: 3.10",
4748
"Programming Language :: Python :: Implementation :: PyPy",
4849
],
4950
keywords="api graphql protocol rest relay graphene",
@@ -52,8 +53,8 @@
5253
extras_require={
5354
"dev": [
5455
"tox==3.7.0", # Should be kept in sync with tox.ini
55-
"pre-commit==1.14.4",
56-
"flake8==3.7.9",
56+
"pre-commit==2.19",
57+
"flake8==4.0.0",
5758
],
5859
"test": tests_require,
5960
},

tox.ini

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[tox]
2-
envlist = pre-commit,py{36,37,38,39}-sql{12,13,14}
2+
envlist = pre-commit,py{37,38,39,310}-sql{12,13,14}
33
skipsdist = true
44
minversion = 3.7.0
55

66
[gh-actions]
77
python =
8-
3.6: py36
98
3.7: py37
109
3.8: py38
1110
3.9: py39
11+
3.10: py310
1212

1313
[gh-actions:env]
1414
SQLALCHEMY =
@@ -27,14 +27,14 @@ commands =
2727
pytest graphene_sqlalchemy --cov=graphene_sqlalchemy --cov-report=term --cov-report=xml {posargs}
2828

2929
[testenv:pre-commit]
30-
basepython=python3.9
30+
basepython=python3.10
3131
deps =
3232
.[dev]
3333
commands =
3434
pre-commit {posargs:run --all-files}
3535

3636
[testenv:flake8]
37-
basepython = python3.9
37+
basepython = python3.10
3838
deps = -e.[dev]
3939
commands =
4040
flake8 --exclude setup.py,docs,examples,tests,.tox --max-line-length 120

0 commit comments

Comments
 (0)