Skip to content

Commit

Permalink
Merge pull request #132 from awtkns/126_py_typed
Browse files Browse the repository at this point in the history
⚗️ Add py.typed file
  • Loading branch information
awtkns authored Jan 6, 2022
2 parents 95eee89 + 95c9123 commit 920ab61
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
Empty file added fastapi_crudrouter/py.typed
Empty file.
2 changes: 1 addition & 1 deletion tests/dev.requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions tests/test_integration/test_typing.py
Original file line number Diff line number Diff line change
@@ -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)

1 comment on commit 920ab61

@vercel
Copy link

@vercel vercel bot commented on 920ab61 Jan 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.