Skip to content

Commit

Permalink
Update dependencies and drop support for Python 3.8 (#326)
Browse files Browse the repository at this point in the history
* update Pipfile.lock

* run black

* drop support for 3.8

* Update minimum version in readme
  • Loading branch information
pilleye committed Feb 6, 2024
1 parent ed060f9 commit 125e042
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 280 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ main
* Add ``RewriteMostSpecificCommonBase`` type rewriter to replace union of derived classes with common
base class (not enabled by default.) Merge of #311, fixes #298. Thanks Christoph Hansknecht.

* Drop support for Python 3.7.
* Drop support for Python 3.7 and 3.8.


23.3.0
Expand Down
384 changes: 129 additions & 255 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ For more on the motivation and design of Python type annotations, see
Requirements
------------

MonkeyType requires Python 3.7+ and the `libcst`_ library (for applying type
MonkeyType requires Python 3.9+ and the `libcst`_ library (for applying type
stubs to code files). It generates only Python 3 type annotations (no type
comments).

Expand Down
6 changes: 3 additions & 3 deletions monkeytype/stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,9 @@ class StubIndexBuilder(CallTraceLogger):

def __init__(self, module_re: str, max_typed_dict_size: int) -> None:
self.re = re.compile(module_re)
self.index: DefaultDict[
Callable[..., Any], Set[CallTrace]
] = collections.defaultdict(set)
self.index: DefaultDict[Callable[..., Any], Set[CallTrace]] = (
collections.defaultdict(set)
)
self.max_typed_dict_size = max_typed_dict_size

def log(self, trace: CallTrace) -> None:
Expand Down
4 changes: 1 addition & 3 deletions monkeytype/type_checking_imports_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ def _replace_pass_with_imports(
body=import_module.body,
)

def _split_module(
self, module: Module
) -> Tuple[
def _split_module(self, module: Module) -> Tuple[
List[Union[SimpleStatementLine, BaseCompoundStatement]],
List[Union[SimpleStatementLine, BaseCompoundStatement]],
]:
Expand Down
24 changes: 8 additions & 16 deletions monkeytype/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,36 +252,28 @@ def get_type(obj, max_typed_dict_size):

class GenericTypeRewriter(Generic[T], ABC):
@abstractmethod
def make_builtin_tuple(self, elements):
...
def make_builtin_tuple(self, elements): ...

@abstractmethod
def make_container_type(self, container_type, element):
...
def make_container_type(self, container_type, element): ...

@abstractmethod
def make_anonymous_typed_dict(self, required_fields, optional_fields):
...
def make_anonymous_typed_dict(self, required_fields, optional_fields): ...

@abstractmethod
def make_builtin_typed_dict(self, name, annotations, total):
...
def make_builtin_typed_dict(self, name, annotations, total): ...

@abstractmethod
def generic_rewrite(self, typ):
...
def generic_rewrite(self, typ): ...

@abstractmethod
def rewrite_container_type(self, container_type):
...
def rewrite_container_type(self, container_type): ...

@abstractmethod
def rewrite_malformed_container(self, container):
...
def rewrite_malformed_container(self, container): ...

@abstractmethod
def rewrite_type_variable(self, type_variable):
...
def rewrite_type_variable(self, type_variable): ...

def _rewrite_container(self, cls, container):
if container.__module__ != "typing":
Expand Down

0 comments on commit 125e042

Please sign in to comment.