Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable compatibility with new fastapi-slim and update examples #94

Merged
merged 9 commits into from
May 22, 2024

Conversation

azogue
Copy link
Collaborator

@azogue azogue commented May 16, 2024

cc @sabuhish

closes #91

Maintenance update, with minor changes:

  • Updated examples with lifespan usage (instead of deprecated .init_app() method)
  • Better typing for decorators
  • Increase required Python version to >=3.8 (syncing with fastAPI)
  • Adjust dependencies to work with new fastapi-slim package variant, available since fastAPI v0.111.0

Here in fastapi-mqtt we only use from fastapi import FastAPI for testing and typing, so it is not a required dependency after all.

Moving it to the dev-dependencies group, with pytest and others, enables the usage of this library in projects using only the new fastapi-slim package, remaining compatible with the 'normal' fastapi

All changes

  • 🎨 lint: pre-commit autoupdate
  • ♻️ env: Adjust linter configuration in pyproject.toml, adding mypy strict settings
  • 🎨 typing: Add missing detailed callable definitions
  • 🎨 lint: Add missing typing
  • 🎨 Validate MQTT protocol version in config
  • πŸ› examples: Fix typos (closes Error found on the example page of the documentΒ #89)
  • 🎨 Update all examples to use modern fastapi lifespan
  • 🎨 Remove import of FastAPI object inside library, as it's only used for typing inside a deprecated method
  • πŸ“¦οΈ env: Bump minor version and re-define deps and classifiers, moving fastapi to dev-dependencies, as it is used/required only for testing, and enables compatibility with fastapi-slim package, so projects using this library are not forced to install the full package. Same goes for uvicorn, which is an optional import to configure a logger

as it's only used for typing in a deprecated method
moving fastapi to dev-dependencies, as it is used/required only
for testing, and enables compatibility with `fastapi-slim` package,
so projects using this library are not forced to install the full package

Same goes for `uvicorn`, which is an optional import to configure a logger
@azogue azogue merged commit b3329c0 into sabuhish:master May 22, 2024
1 check passed
@azogue azogue deleted the env/maintenance-update branch May 22, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error found on the example page of the document
1 participant