Orloj
Getting started
You can use orloj simply by installing via pip on your Terminal.
pip install orloj
or alternatively when using poetry package manager as such:
poetry add orloj
And then you can begin using OrlojMiddleware in your ASGI project as such
...
from orloj import OrlojMiddleware
def action() -> None:
"""Action to be called by scheduler"""
app.add_middleware(OrlojMiddleware, interval=3, job=action, job_id="scheduled-action")
...
The following example shows you how to setup OrlojMiddleware to run scheduled tasks alongside
your FastAPI application.
from fastapi import FastAPI
from logging import Logger, getLogger
from orloj import OrlojMiddleware
from starlette.responses import PlainTextResponse, RedirectResponse
app = FastAPI()
logger: Logger = getLogger("uvicorn")
def hello_name(name: str) -> None:
logger.info(f"Hello, {name}!")
def hello_world() -> None:
logger.info("Hello, World!")
@app.get("/")
async def redirect_to_swagger_docs() -> RedirectResponse:
"""Redirects to swagger documentation
"""
return RedirectResponse("/docs")
@app.get("/health", response_class=PlainTextResponse, status_code=200)
async def health() -> str:
"""Health check
"""
return "OK"
app.add_middleware(
OrlojMiddleware, interval=3, job=hello_name, job_id="hello-igor", name="Igor"
)
app.add_middleware(
OrlojMiddleware, interval=6, job=hello_world, job_id="hello-world"
)
Dependencies
Contributions
To contribute to the project, fork the repository and clone to your local device and development dependencies including three extra libraries not included in final builds as such:
- mypy - Optional static typing for Python
- pytest - The pytest framework makes it easy to write small tests, yet scales to support complex functional testing
- ruff - An extremely fast Python linter and code formatter, written in Rust.
Use the following commands to setup your local environment with development dependencies:
pip install --user poetry
poetry install --with dev
Acknowledgements
License
This project is licensed under the terms of the MIT license.
Metadata
Release files for orloj 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| orloj-0.1.4.tar.gz | 4.4 kB | Without provenance | Details for orloj-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| orloj-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for orloj-0.1.4-py3-none-any.whl |
Total release size: 9.2 kB
Release files / orloj-0.1.4.tar.gz
| Download URL | orloj-0.1.4.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56c466eb1c3f9dd4554c3c5af8edc1f4ae06be891bfdc0ad9c30c010548eb0a6
|
|
BLAKE2b-256 checksum How to use checksums |
af097aa45b012a983ea72d422c7a60b1353b33e75351d3f906e412a8045bbac0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.0 Darwin/22.1.0
|
Release files / orloj-0.1.4-py3-none-any.whl
| Download URL | orloj-0.1.4-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d65f21de6e53dd79117e42a633745f6b6b943f8cfd9871247e6b12aee37d8ac
|
|
BLAKE2b-256 checksum How to use checksums |
4d56a5e0ebae2a3c90f3bd160eaa068e6ce448ac3a05bc22b840372937b5d1ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.0 Darwin/22.1.0
|
Security for orloj 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.