Skip to main content

Allow manage APScheduler with FastAPI router

Project description

fastapi-apscheduler

Build Status PyPI version License: MIT

Installation

pip install fastapi-apscheduler

Usage

from fastapi import FastAPI

from fastapi_apscheduler.utils import get_logger
from fastapi_apscheduler.routers import get_jobs_router
from fastapi_apscheduler.scheduler import lifespan

logger = get_logger(__name__)

app = FastAPI(lifespan=lifespan)

app.include_router(get_jobs_router(), prefix="/scheduler", tags=["scheduler"])


async def pytest_job():
    logger.info("test_job")

Build and publish to pypi with poetry

poetry build

Building fastapi-apscheduler (0.0.x)
  - Building sdist
  - Built fastapi_apscheduler-0.0.x.tar.gz
  - Building wheel
  - Built fastapi_apscheduler-0.0.x-py3-none-any.whl

poetry publish

Publishing fastapi-apscheduler (0.0.x) to PyPI
 - Uploading fastapi_apscheduler-0.0.x-py3-none-any.whl 100%

Run local instance of worker with uvicorn

uvicorn example.main:app --workers 1 --port 8084 --log-level debug --env-file example/.env

TODO:

  • add CI
  • add tests to CI
  • add coverage to CI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_apscheduler-0.0.5.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

fastapi_apscheduler-0.0.5-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page