Releases: adhamsalama/simpleapi
v0.1.5
What's Changed
- fix(validation): Fix return type hint validation by @adhamsalama in #47
Full Changelog: v0.1.3...v0.1.5
Add support for Query type hint validation
Now you can do this!
@app.get("/query-type-hint")
def query(
age: Query,
name: Query = "adhom",
):
...
where
Query = str | list[str]
Lists were supported in the previous release.
https://github.com/adhamsalama/simpleapi/releases/tag/v.0.1.3
What's Changed
- add query type hint support by @adhamsalama in #46
Full Changelog: v.0.1.3...v0.1.4
Support for multiple values for the same query parameter
What's Changed
- Support multiple values for the same query parameter as a list by @adhamsalama in #44
Full Changelog: v0.1.2...v.01.3
v0.1.2
Minor-updates, nothing to worry about.
SimpleAPI is WSGI-compliant!
This is a huge release!
I have rewritten SimpleAPI as a WSGI-compliant framework! You can run it with gunicorn!
I have also added Pydantic models to automatic validation, and added more tests!
And added documentation at https://adhamsalama.github.io/simpleapi/index.html
What's Changed
- Add pydantic to dependencies by @adhamsalama in #17
- Use Poetry for managing the package and publishing it by @adhamsalama in #18
- Use relative imports by @adhamsalama in #19
- 20 make view function request parameter optional by @adhamsalama in #21
- Allow view functions to return strings numbers dicts and pydantic classes and auto serialize them by @adhamsalama in #23
- Add request body to all methods and add handling for DELETE and HEAD methods by @adhamsalama in #25
- Add simple dependency injection for request body by @adhamsalama in #26
- Add tests by @adhamsalama in #28
- Rewrite the framework as wsgi app by @adhamsalama in #31
- Add Routers functionality by @adhamsalama in #32
- Validate dependency injection using pydantic by @adhamsalama in #35
- Add classes for errors by @adhamsalama in #36
- Fix middleware by @adhamsalama in #37
- Add middleware to app by @adhamsalama in #38
- Add headers and cookies to request by @adhamsalama in #40
- Add docs by @adhamsalama in #42
Full Changelog: v0.3...v0.1.0
Package SimpleAPI to PyPI
In this release, I packaged SimpleAPI and upload it to PyPI.
https://pypi.org/project/simplestapi/0.0.3/
Now the SimpleAPI can be install via pip install simplestapi
.
I choose the package name "simplestapi" instead of "simpleapi" because it was already taken, but importing it should still be python import simpleapi
What's Changed
- Add dynamic routing by @adhamsalama in #13
- Adjust ViewFunction Callable parameter type to Request by @adhamsalama in #14
- Package the project and upload it to pypi by @adhamsalama in #16
Full Changelog: v0.2...v0.3
Dynamic Routing
In this release, I added dynamic routing capabilites to SimpleAPI.
Here is an example.
@app.get("/greet/{name}")
def greet(request: Request):
"""Dynamic route that greets users"""
return JSONResponse(message={"greetings": request.params["name"]})
@app.get("/greet/{first_name}/{last_name}")
def greet_fullname(request: Request):
"""Multiple dynamic route that greets users"""
fullname = request.params["first_name"] + " " + request.params["last_name"]
return JSONResponse(message={"fullname": fullname})
v0.0.1
This is the initial release of SimpleAPI, a simple, unopinionated Python web framework inspired by FastAPI and Flask. So far it doesn't have any third-party dependencies.
As the name suggests, SimpleAPI is simple to use.
Here is a quick example.
from simpleapi import SimpleAPI, Request, JSONResponse
app = SimpleAPI()
@app.get("/hello")
def hello(request: Request):
"""Returns hello world in JSON format"""
return JSONResponse(message={"hello": "world"})
app.run(port=8000)
SimpleAPI is not production-ready. I am making it only for educational purposes.
I will add more features to hopefully to the point where it has most of the features modern web frameworks have, and maybe one day improve it enough to become a production-ready framework.
What's Changed
- Add Response class by @adhamsalama in #1
- Refactor the code by @adhamsalama in #5
- Add method for accessing request body by @adhamsalama in #6
- Add support for middleware by @adhamsalama in #9
- Rename the project SimpleAPI by @adhamsalama in #10
- Parse query params and put post request parsing back in handle_request by @adhamsalama in #11
- Add example to show how to use query params by @adhamsalama in #12
New Contributors
- @adhamsalama made their first contribution in #1
Full Changelog: https://github.com/adhamsalama/simpleapi/commits/v0.1