Skip to content

Commit fb59eba

Browse files
authored
Add More Classifiers & Fix Typo ✨ (#3)
* FIx FastAPI-Class * Create a Config File * Bump Version to 1.1.0
1 parent 87807fe commit fb59eba

File tree

7 files changed

+32
-13
lines changed

7 files changed

+32
-13
lines changed

Diff for: .github/ISSUE_TEMPLATE/config.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Security Contact
4+
about: Please report security vulnerabilities to [email protected]

Diff for: README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def parse_arg() -> argparse.Namespace:
3232
class UserRoutes(Routable):
3333
"""Inherits from Routable."""
3434

35-
# Note injection here by simply passing values to the constructor. Other injection frameworks also
35+
# Note injection here by simply passing values to the constructor.
36+
# Other injection frameworks also work.
3637
# supported as there's nothing special about this __init__ method.
3738
def __init__(self, pong: pong) -> None:
3839
"""Constructor. The pong is injected here."""
@@ -50,7 +51,7 @@ class UserRoutes(Routable):
5051

5152
def main():
5253
args = parse_args()
53-
# Configure the pomg per command line arguments
54+
# Configure the pong per command line arguments
5455
pong = pong(args.url, args.user, args.password)
5556
# Simple intuitive injection
5657
user_routes = UserRoutes(pong)
@@ -78,6 +79,7 @@ __Note:__ that `app` is a global. Furthermore, [FastAPI's suggested way of doing
7879
app = FastAPI()
7980

8081
class ValueToInject:
82+
# Value to inject into the function.
8183
def __init__(self, y: int) -> None:
8284
self.y = y
8385

Diff for: Setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.0.0
2+
current_version = 1.1.0
33
commit = True
44
tag = True
55

Diff for: fastapi_class/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FastAPI_Class : contains classes and decorators to use FastAPI with "class based routing".
33
"""
44

5-
__version__ = "1.0.0"
5+
__version__ = "1.1.0"
66

77
from fastapi_class import args, decorators, routable
88

Diff for: fastapi_class/routable.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
This module contains the `Routable` class, which is used to define a class
1414
1515
Returns:
16-
[type] -- [description]
16+
[Routable]: A class that can be used to define a routable class
17+
1718
"""
1819

1920

@@ -24,7 +25,9 @@ class member called _endpoints that the Routable constructor then uses to add th
2425
def __new__(
2526
cls: Type[type], name: str, bases: Tuple[Type[Any]], attrs: Dict[str, Any]
2627
) -> "RoutableMeta":
27-
endpoints: List[EndpointDefinition] = []
28+
endpoints: List[EndpointDefinition] = [
29+
# This is a list of all the endpoints that were defined on the class
30+
]
2831
# Loop through all the methods in the class
2932
for v in attrs.values():
3033
if inspect.isfunction(v) and hasattr(v, "_endpoint"):
@@ -43,7 +46,9 @@ class Routable(metaclass=RoutableMeta):
4346
router.
4447
"""
4548

46-
_endpoints: List[EndpointDefinition] = []
49+
_endpoints: List[EndpointDefinition] = [
50+
# This is a list of all the endpoints that the class has
51+
]
4752

4853
def __init__(self) -> None:
4954
# Create a router for the class

Diff for: setup.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import setuptools
22

3-
__version__ = "1.0.0"
3+
__version__ = "1.1.0"
44

55
with open("README.md", "r", encoding="utf-8") as fh:
66
long_description = fh.read()
@@ -13,15 +13,23 @@
1313
description="Generate Class & Decorators for your FastAPI project",
1414
long_description=long_description,
1515
long_description_content_type="text/markdown",
16-
url="https://github.com/yezz123/fastapi-class",
16+
project_urls={
17+
"Source Code": "https://github.com/yezz123/fastapi-class",
18+
"Bug Tracker": "https://github.com/yezz123/fastapi-class/issues",
19+
},
1720
packages=setuptools.find_packages(
1821
exclude=["tests", "tests.*", "*.tests", "*.tests.*"],
1922
),
2023
include_package_data=True,
2124
classifiers=[
22-
"Programming Language :: Python :: 3",
2325
"License :: OSI Approved :: MIT License",
2426
"Operating System :: OS Independent",
27+
"Intended Audience :: Developers",
28+
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: 3 :: Only",
31+
"Topic :: Utilities",
32+
"Typing :: Typed",
2533
],
2634
python_requires=">=3.8",
2735
install_requires=["fastapi==0.68.1", "pydantic==1.8.2"],

Diff for: tests/test_routable.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def sub(self, x: int) -> int:
3232
async def do_async(self) -> int:
3333
return self.__injected + 1
3434

35-
@get(path="/aecho/{val}", response_class=PlainTextResponse)
36-
async def aecho(self, val: str) -> str:
35+
@get(path="/echo/{val}", response_class=PlainTextResponse)
36+
async def echo(self, val: str) -> str:
3737
return f"{val} {self.__injected}"
3838

3939

@@ -99,6 +99,6 @@ def test_async_methods_with_args_work() -> None:
9999

100100
client = TestClient(app)
101101

102-
response = client.get("/aecho/hello")
102+
response = client.get("/echo/hello")
103103
assert response.status_code == 200
104104
assert response.text == "hello 2"

0 commit comments

Comments
 (0)