Skip to content

Commit

Permalink
feat: Create an empty py.typed file to add mypy type hint support (#61)
Browse files Browse the repository at this point in the history
* Create py.typed

* add __all__

* Inherit ObjectIdField from ObjectId

* Update __init__.py
  • Loading branch information
Jylpah authored Jan 4, 2024
1 parent a850ea7 commit 10e58de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions pydantic_mongo/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from .abstract_repository import AbstractRepository # noqa
from .fields import ObjectIdField # noqa
from .version import __version__ # noqa
from .abstract_repository import AbstractRepository as AbstractRepository
from .fields import ObjectIdField as ObjectIdField
from .version import __version__ as __version__

__all__ = [ "fields", "version", "abstract_repository" ]
2 changes: 1 addition & 1 deletion pydantic_mongo/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pydantic_core import core_schema


class ObjectIdField(str):
class ObjectIdField(ObjectId):
@classmethod
def __get_pydantic_core_schema__(
cls, _source_type: Any, _handler: Any
Expand Down
1 change: 1 addition & 0 deletions pydantic_mongo/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 10e58de

Please sign in to comment.