semvec/pypi-packages huggingface dataset:
mkdocs-fedi-comments 0.1.7
Plugin enables adding comments to mkdocs sites from the Fediverse through an external service
Requires Python: >=3.11

# mkdocs_fedi_comment

> [!NOTE]
> This plugin requires a [comments-server](https://bovine.codeberg.page/comments/)
> to work.

This plugin is meant to enable commenting from the Fediverse
on sites build with [mkdocs](https://www.mkdocs.org/). This plugin
uses the overrides provided by [mkdocs-material](https://squidfunk.github.io/mkdocs-material/).
This means that a simplest configuration would look like

```yml
theme:
  name: material

plugins:
  - fedi-comments:
      base_path: https://comments.bovine.social/
      actor:
        name: mkdocs-fedi-comments
        handle: mkdocs_fedi_comments
  - search
```

The `fedi-comments` plugin provided by this package requires
some configuration. `base_path` is where your comments server is located. This is
used to determine the location of the ActivityPub objects via
`{base_path}/pages/{encoded_url}` and for the API endpoint to
retrieve comments from, i.e. `{base_path}/comments/{encoded_url}`.

Second the values under `actor` are used to create the used ActivityPub
actor. In addition to `name` and `handle`, which are required,
one currently can also specify `summary` and `icon`.

## The sample site

The sample site is deployed to [https://bovine.codeberg.page/mkdocs_fedi_comments/](https://bovine.codeberg.page/mkdocs_fedi_comments/) and the corresponding installation
of comments is configured with

```toml
[[pages]]
url = "https://bovine.codeberg.page/mkdocs_fedi_comments"
name = "mkdocs_fedi_comments"
```

## Development

There are some python tests that can be run via

```bash
uv run pytest
```

Similarly one can check that the sample_site builds via

```bash
cd sample_site
uv run mkdocs build
```

This executes the plugin, which is included in the sample site
as an editable dependency.

### JavaScript component

The replies are displayed through a JavaScript component. It
is automatically build with the python package. One can manually run
this step via

```bash
uv run hatch build --hooks-only --target wheel
```

### Development

First enter the `js` directory.

To visually develop the component run, you have to first
generate the [MSW service worker](https://storybook.js.org/addons/msw-storybook-addon)
and the [MSW Docs](https://mswjs.io/docs/best-practices/managing-the-worker#generating-the-worker-script).

```bash
npx msw init public/ --save
```

then you can run storybook via

```bash
npm run storybook
```
django-light-auth 0.2.3
Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.
Requires Python: >=3.10
Keywords: django, auth

# django-light-auth

[![PyPI - Version](https://img.shields.io/pypi/v/django-light-auth.svg)](https://pypi.org/project/django-light-auth/)
![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https://raw.githubusercontent.com/rexzhang/django-light-auth/main/pyproject.toml)
[![PyPI - Django Version](https://img.shields.io/pypi/djversions/django-light-auth)](https://pypi.org/project/django-light-auth/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/django-light-auth.svg)](https://pypi.org/project/django-light-auth/)

> Django Lightweight Authentication without models and databases, only depend on the signed cookies and the Django's SessionMiddleware.

## Install

```shell
pip3 install -U django-light-auth
```

## Usage

### Basic Usage

#### `settings.py`

```python
INSTALLED_APPS = [
    # ...
    # 'django.contrib.auth',
    'django_light_auth.apps.DjangoLightAuthConfig',

    # ...
]

MIDDLEWARE = [
    # ...

    'django.contrib.sessions.middleware.SessionMiddleware',
    # 'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django_light_auth.LightAuthMiddleware'

    # ...
]

# Session
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'

# django-light-auth
LIGHT_AUTH_VALIDATE_FUNC = 'your_app.auth.validate_func'
```

#### `urls.py`

```python
from django.urls import path

from django_light_auth import LoginView, LogoutView

urlpatterns = [
    # ...
    path('login', LoginView.as_view(), name='login'),
    path('logout', LogoutView.as_view(), name='logout'),
]
```

#### `your_app/auth/validate_func.py`

```python
#
# example at django_light_auth.light_auth_validate_func
#

from typing import Dict, Any

from your_app.config import config

def light_auth_validate_func(data: Dict[str, Any]) -> bool:
    if data.get('username', None) == config.Auth.username and data.get(
        'password', None
    ) == config.Auth.password:
        return True

    return False
```

### Custom Login View

`your_login_view.py`

```python
from django_light_auth import LoginView as LoginViewAbs


class LoginView(LoginViewAbs):
    template_name = 'your_app/login.html'
```

## History

### 0.2.3 - 20251112

- Maintenance release

### v0.2.2 - 20220809

- Compatible Django 4.1+