Skip to content

Commit 82a5a01

Browse files
committed
chore: Remove dependency on attrs
1 parent 356fd38 commit 82a5a01

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ repos:
6363
- id: mypy
6464
exclude: ^(docs/|test/).*$
6565
args: ["--ignore-missing-imports"]
66-
additional_dependencies: [types-attrs]
6766

6867
- repo: https://github.com/pre-commit/mirrors-pylint
6968
rev: v3.0.0a4

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Removed
66

77
- Python 3.6 support.
8+
- Dependency on `attrs`.
89

910
## [0.9.2] - 2022-11-07
1011

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ include = ["src/hypothesis_graphql/py.typed"]
2929
python = "^3.7"
3030
hypothesis = ">=5.8.0,<7.0"
3131
graphql-core = ">=3.1.0,<3.3.0"
32-
attrs = ">20.3.0,<=22.1.0"
3332

3433
[tool.poetry.dev-dependencies]
3534
pytest = "^6.2.0"
@@ -44,7 +43,7 @@ multi_line_output = 3
4443
default_section = "THIRDPARTY"
4544
include_trailing_comma = true
4645
known_first_party = "hypothesis_graphql"
47-
known_third_party =["attr", "graphql", "hypothesis", "hypothesis_graphql", "pytest"]
46+
known_third_party =["graphql", "hypothesis", "hypothesis_graphql", "pytest"]
4847

4948
[build-system]
5049
requires = ["poetry-core>=1.0"]

src/hypothesis_graphql/_strategies/strategy.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# pylint: disable=unused-import
2+
import dataclasses
23
import operator
34
from functools import reduce, wraps
45
from operator import or_
56
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
67

7-
import attr
88
import graphql
99
from graphql import is_equal_type
1010
from hypothesis import strategies as st
@@ -40,15 +40,15 @@ def wrapped(self: "GraphQLStrategy", *args: Any, **kwargs: Any) -> st.SearchStra
4040
return decorator
4141

4242

43-
@attr.s(slots=True)
43+
@dataclasses.dataclass
4444
class GraphQLStrategy:
4545
"""Strategy for generating various GraphQL nodes."""
4646

47-
schema: graphql.GraphQLSchema = attr.ib()
48-
custom_scalars: CustomScalarStrategies = attr.ib(factory=dict)
47+
schema: graphql.GraphQLSchema
48+
custom_scalars: CustomScalarStrategies = dataclasses.field(default_factory=dict)
4949
# As the schema is assumed to be immutable, there are a few strategy caches possible for internal components
5050
# This is a per-method cache without limits as they are proportionate to the schema size
51-
_cache: Dict[str, Dict] = attr.ib(factory=dict)
51+
_cache: Dict[str, Dict] = dataclasses.field(default_factory=dict)
5252

5353
def values(
5454
self, type_: graphql.GraphQLInputType, default: Optional[graphql.ValueNode] = None

test/test_corpus.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import json
22
import pathlib
3+
from dataclasses import dataclass
4+
from typing import Optional
35

4-
import attr
56
import graphql
67
import pytest
78
from hypothesis import HealthCheck, Phase, Verbosity, given, settings
@@ -22,10 +23,10 @@
2223
}
2324

2425

25-
@attr.s(slots=True)
26+
@dataclass
2627
class Schema:
27-
raw = attr.ib()
28-
custom_scalars = attr.ib()
28+
raw: dict
29+
custom_scalars: Optional[dict]
2930

3031

3132
PLACEHOLDER_STRATEGY = st.just("placeholder").map(nodes.String)

0 commit comments

Comments
 (0)