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

fix: remove extra plugin parameter #3

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions litestar_htmx/__metadata__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

from __future__ import annotations

import importlib.metadata
from importlib.metadata import PackageNotFoundError, metadata, version

__all__ = ["__version__", "__project__"]
__all__ = ("__version__", "__project__")

__version__ = importlib.metadata.version("litestar_htmx")
"""Version of the project."""
__project__ = importlib.metadata.metadata("litestar_htmx")["Name"]
"""Name of the project."""
try:
__version__ = version("litestar_htmx")
"""Version of the project."""
__project__ = metadata("litestar_htmx")["Name"]
"""Name of the project."""
except PackageNotFoundError: # pragma: no cover
__version__ = "0.0.0"
__project__ = "Litestar HTMX"
finally:
del version, PackageNotFoundError, metadata
18 changes: 2 additions & 16 deletions litestar_htmx/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

from dataclasses import dataclass
from typing import TYPE_CHECKING

from litestar.plugins import InitPluginProtocol
Expand All @@ -23,26 +22,13 @@

if TYPE_CHECKING:
from litestar.config.app import AppConfig
from litestar.template import TemplateConfig


@dataclass
class HtmxConfig:
"""Configuration for Flash messages."""

template_config: TemplateConfig


class HTMXPlugin(InitPluginProtocol):
"""Flash messages Plugin."""

def __init__(self, config: HtmxConfig):
"""Initialize the plugin.

Args:
config: Configuration for flash messages, including the template engine instance.
"""
self.config = config
def __init__(self):
"""Initialize the plugin."""

def on_app_init(self, app_config: AppConfig) -> AppConfig:
"""Register the message callable on the template engine instance.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ maintainers = [
name = "litestar-htmx"
readme = "README.md"
requires-python = ">=3.8, <4.0"
version = "0.2.1"
version = "0.2.2"

[build-system]
build-backend = "hatchling.build"
Expand Down
Loading