Repository: awtkns/fastapi-crudrouter (language: python)

Issue:
Feature Request: Type Annotations
It'd be great if this library had type annotations and a `py.typed` file so it could be checked with `mypy`.

I'm just leaving this here to track it in case anyone has the interest or time.


Discussion / hints:

Fix patch:
diff --git a/fastapi_crudrouter/py.typed b/fastapi_crudrouter/py.typed
new file mode 100644
index 0000000..e69de29


Test patch:
diff --git a/tests/dev.requirements.txt b/tests/dev.requirements.txt
index 83f713b..4ecb350 100644
--- a/tests/dev.requirements.txt
+++ b/tests/dev.requirements.txt
@@ -4,7 +4,7 @@ async-exit-stack; python_version=='3.6'
 
 # Backends
 ormar
-tortoise-orm
+tortoise-orm==0.17.8; python_version>='3.7'
 databases
 aiosqlite
 sqlalchemy==1.3.22
diff --git a/tests/test_integration/test_typing.py b/tests/test_integration/test_typing.py
new file mode 100644
index 0000000..833e6c0
--- /dev/null
+++ b/tests/test_integration/test_typing.py
@@ -0,0 +1,35 @@
+import pathlib
+
+file = pathlib.Path(__file__)
+root_dir = file.parent.parent.parent
+package_src = root_dir / "fastapi_crudrouter"
+
+
+def test_py_typed_file_exists():
+    assert (package_src / "py.typed").exists()
+    assert (package_src / "py.typed").is_file()
+
+
+def test_virtualenv(virtualenv):
+    assert (root_dir).exists()
+    assert (root_dir / "setup.py").exists()
+
+    virtualenv.run(f"pip install -e {root_dir}")
+    virtualenv.run(f"pip install mypy")
+    virtualenv.run(f"mypy {file}")
+
+
+if __name__ == "__main__":
+    from pydantic import BaseModel
+    from fastapi import FastAPI
+
+    import fastapi_crudrouter
+
+    class User(BaseModel):
+        id: int
+        name: str
+        email: str
+
+    router = fastapi_crudrouter.MemoryCRUDRouter(schema=User)
+    app = FastAPI()
+    app.include_router(router)