Skip to content

Commit

Permalink
Fixes Issue #216 (#217)
Browse files Browse the repository at this point in the history
* fixed missing imports to keep SavePath on the correct part of the API for backwards compat

* linted
ncilfone authored Jan 31, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 15aa79c commit 5e07103
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion spock/__init__.py
Original file line number Diff line number Diff line change
@@ -10,12 +10,13 @@
"""

from spock._version import get_versions
from spock.backend.typed import SavePath
from spock.builder import ConfigArgBuilder
from spock.config import spock

SpockBuilder = ConfigArgBuilder

__all__ = ["args", "builder", "config", "spock", "SpockBuilder"]
__all__ = ["args", "builder", "config", "SavePath", "spock", "SpockBuilder"]

__version__ = get_versions()["version"]
del get_versions
4 changes: 3 additions & 1 deletion spock/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from typing import Any, Callable, List, Optional, Tuple, Type, TypeVar, Union, overload
from typing import Any, Callable, List, Optional, Tuple, TypeVar, Union, overload

from attr import attrib, field

from spock.backend.typed import SavePath
from spock.builder import ConfigArgBuilder

_T = TypeVar("_T")
_C = TypeVar("_C", bound=type)
SavePath: SavePath

# Note: from here
# https://github.com/python-attrs/attrs/blob/main/src/attr/__init__.pyi
1 change: 1 addition & 0 deletions spock/backend/config.pyi
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ from attr import attrib, field

_T = TypeVar("_T")
_C = TypeVar("_C", bound=type)
SavePath: SavePath

# Note: from here
# https://github.com/python-attrs/attrs/blob/main/src/attr/__init__.pyi
2 changes: 2 additions & 0 deletions spock/config.py
Original file line number Diff line number Diff line change
@@ -6,10 +6,12 @@
"""Creates the spock config decorator that wraps attrs"""

from spock.backend.config import spock_attr
from spock.backend.typed import SavePath
from spock.utils import _is_spock_instance

# Simplified decorator for attrs
spock = spock_attr
SavePath = SavePath

# Public alias for checking if an object is a @spock annotated class
isinstance_spock = _is_spock_instance

0 comments on commit 5e07103

Please sign in to comment.