Skip to content

Commit 920ab61

Browse files
authored
Merge pull request #132 from awtkns/126_py_typed
⚗️ Add py.typed file
2 parents 95eee89 + 95c9123 commit 920ab61

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

fastapi_crudrouter/py.typed

Whitespace-only changes.

tests/dev.requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ async-exit-stack; python_version=='3.6'
44

55
# Backends
66
ormar
7-
tortoise-orm
7+
tortoise-orm==0.17.8; python_version>='3.7'
88
databases
99
aiosqlite
1010
sqlalchemy==1.3.22
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import pathlib
2+
3+
file = pathlib.Path(__file__)
4+
root_dir = file.parent.parent.parent
5+
package_src = root_dir / "fastapi_crudrouter"
6+
7+
8+
def test_py_typed_file_exists():
9+
assert (package_src / "py.typed").exists()
10+
assert (package_src / "py.typed").is_file()
11+
12+
13+
def test_virtualenv(virtualenv):
14+
assert (root_dir).exists()
15+
assert (root_dir / "setup.py").exists()
16+
17+
virtualenv.run(f"pip install -e {root_dir}")
18+
virtualenv.run(f"pip install mypy")
19+
virtualenv.run(f"mypy {file}")
20+
21+
22+
if __name__ == "__main__":
23+
from pydantic import BaseModel
24+
from fastapi import FastAPI
25+
26+
import fastapi_crudrouter
27+
28+
class User(BaseModel):
29+
id: int
30+
name: str
31+
email: str
32+
33+
router = fastapi_crudrouter.MemoryCRUDRouter(schema=User)
34+
app = FastAPI()
35+
app.include_router(router)

0 commit comments

Comments
 (0)