Releases: yezz123/authx
0.9.0
Fixes 🐛
Dependencies 🔨
- ⬆ Update email-validator requirement from <1.3.1,>=1.1.0 to >=1.1.0,<1.3.2 by @dependabot in #347
- ⬆ Bump pymdown-extensions from 9.9.1 to 9.9.2 by @dependabot in #346
- ⬆ Bump pre-commit from 2.21.0 to 3.0.0 by @dependabot in #348
- ⬆ Update sqlalchemy requirement from <1.4.47,>=1.4.37 to >=1.4.37,<2.0.1 by @dependabot in #350
- ⬆ Bump pre-commit from 3.0.0 to 3.0.1 by @dependabot in #349
- ⬆ Bump pre-commit from 3.0.1 to 3.0.4 by @dependabot in #354
- ⬆ Update sqlalchemy requirement from <2.0.1,>=1.4.37 to >=1.4.37,<2.0.2 by @dependabot in #353
- ⬆ Update starlette requirement from <0.23.2,>=0.14.02 to >=0.14.02,<0.24.1 by @dependabot in #356
- ⬆ Update sqlalchemy requirement from <2.0.2,>=1.4.37 to >=1.4.37,<2.0.3 by @dependabot in #357
- ⬆ Bump cryptography from 39.0.0 to 39.0.1 by @dependabot in #358
- ⬆ Update redis requirement from <4.4.3,>=4.3.3 to >=4.3.3,<4.5.1 by @dependabot in #359
- ⬆ Bump markdown-include from 0.8.0 to 0.8.1 by @dependabot in #360
- ⬆ Update fastapi requirement from <0.90.0,>=0.65.2 to >=0.65.2,<0.91.0 by @dependabot in #361
- ⬆ Update redis requirement from <4.5.1,>=4.3.3 to >=4.3.3,<4.5.2 by @dependabot in #362
- ⬆ Update sqlalchemy requirement from <2.0.3,>=1.4.37 to >=1.4.37,<2.0.4 by @dependabot in #363
- ⬆ Update fastapi requirement from <0.91.0,>=0.65.2 to >=0.65.2,<0.92.0 by @dependabot in #364
- ⬆ Update starlette requirement from <0.24.1,>=0.14.02 to >=0.14.02,<0.25.1 by @dependabot in #366
- ⬆ Update fastapi requirement from <0.92.0,>=0.65.2 to >=0.65.2,<0.93.0 by @dependabot in #367
- ⬆ Bump pydantic from 1.10.4 to 1.10.5 by @dependabot in #368
- ⬆ Bump starlette from 0.17.1 to 0.25.0 in /tests/middleware/example by @dependabot in #365
Full Changelog: 0.8.3...0.9.0
🎨 0.8.3 - Support Ruff for Linting
Fixes 🐛
- Fixes a few imports in the documentation by @alobbs in #343
- ✨ Use Ruff for linting by @yezz123 in #344
Docs 📝
- docs: add @alobbs as a contributor for doc by @allcontributors in #345
Dependencies 🔨
- ⬆ Bump pymdown-extensions from 9.9 to 9.9.1 by @dependabot in #338
- ⬆ Update redis requirement from <4.4.2,>=4.3.3 to >=4.3.3,<4.4.3 by @dependabot in #337
- ⬆ Bump requests from 2.28.1 to 2.28.2 by @dependabot in #339
- ⬆ Bump pytz from 2022.7 to 2022.7.1 by @dependabot in #340
- ⬆ Bump pytest from 7.2.0 to 7.2.1 by @dependabot in #341
New Contributors
Full Changelog: 0.8.2...0.8.3
🔖 release 0.8.2
What's Changed
- ⬆ Bump jinja2 from 3.0.3 to 3.1.2 by @dependabot in #268
- ⬆ Bump databases from 0.6.0 to 0.6.1 by @dependabot in #270
- ⬆ Update email-validator requirement from <1.2.1,>=1.1.0 to >=1.1.0,<1.3.1 by @dependabot in #271
- ⬆ Bump pytz from 2022.1 to 2022.6 by @dependabot in #273
- ⬆ Update pyinstrument requirement from <4.2.0,>=4.1.1 to >=4.1.1,<4.4.0 by @dependabot in #274
- ⬆ Bump pymdown-extensions from 9.5 to 9.7 by @dependabot in #275
- ⬆ Bump pytest-cov from 3.0.0 to 4.0.0 by @dependabot in #276
- ⬆ Update redis requirement from <4.3.4,>=4.3.3 to >=4.3.3,<4.3.5 by @dependabot in #277
- ⬆ Bump pytest from 7.1.3 to 7.2.0 by @dependabot in #278
- ⬆ Update fastapi requirement from <=0.81.0,>=0.65.2 to >=0.65.2,<0.87.0 by @dependabot in #279
- ⬆ Bump bcrypt from 3.2.2 to 4.0.1 by @dependabot in #281
- ⬆ Bump pytest-asyncio from 0.19.0 to 0.20.1 by @dependabot in #280
- ⬆ Bump pydantic from 1.9.1 to 1.10.2 by @dependabot in #282
- ⬆ Update sqlalchemy requirement from <=1.4.40,>=1.4.37 to >=1.4.37,<1.4.43 by @dependabot in #283
- ⬆ Bump aiosmtplib from 1.1.6 to 2.0.0 by @dependabot in #285
- ⬆ Update pyinstrument requirement from <4.4.0,>=4.1.1 to >=4.1.1,<4.5.0 by @dependabot in #286
- ⬆ Bump pymdown-extensions from 9.7 to 9.8 by @dependabot in #287
- ⬆ Update python-socketio requirement from <5.7.1,>=4.6.0 to >=4.6.0,<5.7.3 by @dependabot in #288
- ⬆ Bump databases from 0.6.1 to 0.6.2 by @dependabot in #289
- ⬆ Update starlette requirement from <0.20.4,>=0.14.02 to >=0.14.02,<0.21.1 by @dependabot in #290
- ⬆ Update sqlalchemy requirement from <1.4.43,>=1.4.37 to >=1.4.37,<1.4.44 by @dependabot in #291
- ⬆ Bump cryptography from 37.0.4 to 38.0.3 by @dependabot in #292
- ⬆ Bump uvloop from 0.16.0 to 0.17.0 by @dependabot in #293
- ⬆ Bump websockets from 10.3 to 10.4 by @dependabot in #294
- ⬆ Bump pyjwt from 2.4.0 to 2.6.0 by @dependabot in #296
- ⬆ Bump motor from 3.0.0 to 3.1.1 by @dependabot in #297
- ⬆ Bump pytest-asyncio from 0.20.1 to 0.20.2 by @dependabot in #300
- ⬆ Update sqlalchemy requirement from <1.4.44,>=1.4.37 to >=1.4.37,<1.4.45 by @dependabot in #298
- ⬆ Update starlette requirement from <0.21.1,>=0.14.02 to >=0.14.02,<0.22.1 by @dependabot in #301
- ⬆ Bump httpx from 0.23.0 to 0.23.1 by @dependabot in #303
- ⬆ Bump uvicorn from 0.18.3 to 0.20.0 by @dependabot in #302
- ⬆ Update redis requirement from <4.3.5,>=4.3.3 to >=4.3.3,<4.3.6 by @dependabot in #304
- ⬆ Bump pymdown-extensions from 9.8 to 9.9 by @dependabot in #305
- ⬆ Bump markdown-include from 0.7.0 to 0.8.0 by @dependabot in #306
- ⬆ Bump cryptography from 38.0.3 to 38.0.4 by @dependabot in #307
- ⬆ Bump pypa/gh-action-pypi-publish from 1.5.1 to 1.6.1 by @dependabot in #312
- ⬆ Bump jsmrcaga/action-netlify-deploy from 1.1.0 to 1.8.1 by @dependabot in #309
- Revert "⬆ Bump jsmrcaga/action-netlify-deploy from 1.1.0 to 1.8.1" by @yezz123 in #314
- ⬆ Update redis requirement from <4.3.6,>=4.3.3 to >=4.3.3,<4.4.1 by @dependabot in #311
- ⬆ Update starlette requirement from <0.22.1,>=0.14.02 to >=0.14.02,<0.23.1 by @dependabot in #315
- ⬆ Bump pypa/gh-action-pypi-publish from 1.6.1 to 1.6.4 by @dependabot in #318
- ⬆ Bump pytest-asyncio from 0.20.2 to 0.20.3 by @dependabot in #319
- ⬆ Update sqlalchemy requirement from <1.4.45,>=1.4.37 to >=1.4.37,<1.4.46 by @dependabot in #320
- ⬆ Update starlette requirement from <0.23.1,>=0.14.02 to >=0.14.02,<0.23.2 by @dependabot in #321
- ⬆ Bump databases from 0.6.2 to 0.7.0 by @dependabot in #324
- ⬆ Bump pytz from 2022.6 to 2022.7 by @dependabot in #323
- ⬆ Bump pre-commit from 2.20.0 to 2.21.0 by @dependabot in #325
- ⬆ Bump pydantic from 1.10.2 to 1.10.3 by @dependabot in #326
- ⬆ Bump cryptography from 38.0.4 to 39.0.0 by @dependabot in #328
- ⬆ Bump pydantic from 1.10.3 to 1.10.4 by @dependabot in #327
- ⬆ Update mkdocs-material requirement from <9.0.0,>=8.1.4 to >=8.1.4,<10.0.0 by @dependabot in #330
- ⬆ Bump httpx from 0.23.1 to 0.23.2 by @dependabot in #329
- ⬆ Update sqlalchemy requirement from <1.4.46,>=1.4.37 to >=1.4.37,<1.4.47 by @dependabot in #331
- ⬆ Update fastapi requirement from <0.87.0,>=0.65.2 to >=0.65.2,<0.89.0 by @dependabot in #308
- ⬆ Bump httpx from 0.23.2 to 0.23.3 by @dependabot in #332
- ⬆ Bump aiosmtplib from 2.0.0 to 2.0.1 by @dependabot in #334
- ⬆ Update redis requirement from <4.4.1,>=4.3.3 to >=4.3.3,<4.4.2 by @dependabot in #335
- ⬆ Update fastapi requirement from <0.87.0,>=0.65.2 to >=0.65.2,<0.90.0 by @dependabot in #336
Full Changelog: 0.8.1...0.8.2
🔖 release 0.8.1
What's Changed
- increment postfix to find the possible username to use by @iftenet in #266
- docs: add iftenet as a contributor for bug by @allcontributors in #267
New Contributors
- @iftenet made their first contribution in #266
Full Changelog: 0.8.0...0.8.1
🔖 release 0.8.0
🔖 Release 0.8.0
Implementation in FastAPI applications
That's Work by adding a Middleware to your FastAPI application, working on collecting Prometheus metrics for each request, and then to handle that we need a function get_metrics
to work on handling exposing the Prometheus metrics into the /metrics
endpoint.
from fastapi import FastAPI
from authx.middleware import MetricsMiddleware, get_metrics
app = FastAPI()
app.add_middleware(MetricsMiddleware)
app.add_route("/metrics", get_metrics)
What's Changed
Full Changelog: 0.7.0...0.8.0
0.7.0
🔖 release 0.6.1
🔖 0.6.0 - Supporting Profiling
Idea
Profiling is a technique to figure out how time is spent in a program. With
these statistics, we can find the “hot spot” of a program and think about ways
of improvement. Sometimes, a hot spot in an unexpected location may also hint at
a bug in the program.
Pyinstrument is a Python profiler. A profiler is a tool to help you optimize
your code - make it faster.
Profile a web request in FastAPI
To profile call stacks in FastAPI, you can write a middleware extension for
pyinstrument
.
Create an async function and decorate it with app.middleware('http')
where the
app is the name of your FastAPI application instance.
Make sure you configure a setting to only make this available when required.
from pyinstrument import Profiler
PROFILING = True # Set this from a settings model
if PROFILING:
@app.middleware("http")
async def profile_request(request: Request, call_next):
profiling = request.query_params.get("profile", False)
if profiling:
profiler = Profiler(interval=settings.profiling_interval, async_mode="enabled")
profiler.start()
await call_next(request)
profiler.stop()
return HTMLResponse(profiler.output_html())
else:
return await call_next(request)
To invoke, make any request to your application with the GET parameter
profile=1
and it will print the HTML result from pyinstrument
.
AuthX's Support
With AuthX the abstract of profiling is easy, it's just about calling the
ProfilerMiddleware
's class and calling it in
add_middleware(ProfilerMiddleware)
func that FastAPI provides.
Example
import os
import uvicorn
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from authx import ProfilerMiddleware
app = FastAPI()
app.add_middleware(ProfilerMiddleware)
@app.get("/test")
async def normal_request():
return JSONResponse({"retMsg": "Hello World!"})
if __name__ == '__main__':
app_name = os.path.basename(__file__).replace(".py", "")
uvicorn.run(app=f"{app_name}:app", host="0.0.0.0", port=8080, workers=1)
References
What's Changed
- 👷 Support Profiling for checking service performance by @yezz123 in #240
- 👷 chore(fix): Fix Failed tests for Oauth2 by @yezz123 in #241
- 🔖 Clean codebase from unread Docstrings by @yezz123 in #242
- 📝 Docs: Upgrade pre-commit and add new markdown's linter by @yezz123 in #243
- 🔧 Upgrade all Github Actions by @yezz123 in #249
- Chore(deps): Bump jsmrcaga/action-netlify-deploy from 1.1.0 to 1.8.0 by @dependabot in #250
- Add license scan report and status by @fossabot in #253
- 🔖 release 0.6.0 - Supporting Profiling by @yezz123 in #255
New Contributors
Full Changelog: 0.5.1...0.6.0
0.5.1
0.5.1
Fix Wrong username
validation UserInRegister
model #237, Thanks to @YogeshUpdhyay 🙏🏻
What's Changed
- Username Validation Fixed by @YogeshUpdhyay in #238
New Contributors
- @YogeshUpdhyay made their first contribution in #238
Full Changelog: 0.5.0...0.5.1
0.5.0
0.5.0
Supporting SocketIO that's allows bi-directional communication between client and server. Bi-directional communications are enabled when a client has Socket.IO in the browser, and a server has also integrated the Socket.IO package. While data can be sent in a number of forms, JSON is the simplest.
Usage
To add SocketIO support to FastAPI all you need to do is import AuthXSocket
and pass it FastAPI
object.
from fastapi import FastAPI
from authx import AuthXSocket
app = FastAPI()
socket = AuthXSocket(app=app)
you can import AuthXSocket
object that exposes most of the SocketIO functionality.
@AuthXSocket.on('leave')
async def handle_leave(sid, *args, **kwargs):
await AuthXSocket.emit('lobby', 'User left')
Working with distributed applications
When working with distributed applications, it is often necessary to access the functionality of the Socket.IO from multiple processes. As a solution to the above problems, the Socket.IO server can be configured to connect to a message queue such as Redis
or RabbitMQ
, to communicate with other related Socket.IO servers or auxiliary workers.
Refer this link for more details using-a-message-queue
import socketio
from fastapi import FastAPI
from authx import AuthXSocket
app = FastAPI()
redis_manager = socketio.AsyncRedisManager('redis://')
socket_manager = AuthXSocket(app=app, client_manager=redis_manager)
What's Changed
- chore(ref): Improve API and refactor users management code by @yezz123 in #222
- chore: Fix Issue of Missing requirements by @yezz123 in #225
- chore(deps): update dependencies by @yezz123 in #233
- 🔧 change domain from
.codes
to.me
by @yezz123 in #235 - chore(feat): support SocketIO in authx ✨ by @yezz123 in #234
Full Changelog: 0.4.0...0.5.0