semvec/pypi-packages huggingface dataset:
django-htmx-modal-redirect 0.1.1
`django-htmx-modal-redirect` is a Django middleware that intercepts direct URL requests intended for HTMX modals, rendering a fallback view with injected HTMX code to automatically open the modal, such as opening a user profile modal when a user visits `/user/123/` directly, briefly showing the home page before the modal opens.
License: MIT
Requires Python: <4.0,>=3.12

# django-htmx-modal-redirect

`django-htmx-modal-redirect` is a Django middleware that seamlessly handles direct access to URLs intended for HTMX modal views. It ensures a smooth user experience by automatically opening the modal content when a user directly visits a URL meant to be displayed in a modal.

## Features

- Automatically detects non-HTMX requests to modal views
- Renders a fallback view (e.g., your main page) with injected HTMX code
- Triggers the modal to open automatically after the page loads
- Easy to configure and integrate into existing Django projects

## Installation

Install the package using pip:

```bash
pip install django-htmx-modal-redirect
```

## Configuration

1. Add `'htmx_modal_redirect.middleware.HTMXModalRedirectMiddleware'` to your `MIDDLEWARE` setting in `settings.py`:

```python
MIDDLEWARE = [
    # ...
    'django_htmx_modal_redirect.middleware.HTMXModalRedirectMiddleware',
    # ...
]
```

2. Configure the required settings in your `settings.py`:

```python
# List of URL names that should be treated as modal views
MODAL_VIEWS = ['user_profile', 'item_details']

# Path to the view function to be used for redirection (fallback view)
MODAL_REDIRECT_VIEW = 'myapp.views.home_page'
```

## How it works

1. When a user directly accesses a URL that's meant to be displayed in a modal (as defined in `MODAL_VIEWS`):
   - The middleware intercepts the request
   - It renders the fallback view specified in `MODAL_REDIRECT_VIEW`
   - It injects HTMX code to automatically trigger the modal

2. For HTMX requests or non-modal views, the middleware does nothing, allowing normal request handling.

## Example

Let's say you have a modal view for user profiles:

```python
# urls.py
urlpatterns = [
    path('user/<int:user_id>/', views.user_profile, name='user_profile'),
    # ...
]

# settings.py
MODAL_VIEWS = ['user_profile']
MODAL_REDIRECT_VIEW = 'myapp.views.home_page'
```

Now, if a user visits `/user/123/` directly:
1. The middleware detects this is a modal view
2. It renders the `home_page` view
3. It injects HTMX code to automatically open the user profile modal

The user sees the home page briefly before the modal with the user profile opens automatically.

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License.
silabi-tokenizer 0.5.0
A custom tokenizer for Swahili text using syllabic vocabulary with byte fallback.
License: MIT
Requires Python: >=3.6

# Swahili Syllabic Tokenizer
This repository hosts a custom tokenizer for Swahili text, designed to tokenize text into syllables using a syllabic vocabulary. The tokenizer is compatible with the Hugging Face transformers library, making it easy to integrate into NLP pipelines and models.

## Features
- Syllabic Tokenization: Tokenizes Swahili text into syllables based on a predefined syllabic vocabulary.
- Byte Fallback: Handles UTF-8 byte fallback for out-of-vocabulary tokens.
- Customizable: Easily extendable and adaptable for specific NLP tasks.

## Usage
### Installation
```
pip install -r requirements.txt
```
### Example
```
from hf_tokenizer import SilabiTokenizer

# Initialize the tokenizer
tokenizer = SilabiTokenizer()
# Encode a sample text
encoded_input = tokenizer("Hii ni mfano wa maandishi.")

# Decode the token ids back to text
decoded_text = tokenizer.decode(encoded_input['input_ids'])

print("Encoded Input:", encoded_input)
print("Decoded Text:", decoded_text)

```

### Contributions
Contributions and suggestions are welcome! Feel free to open an issue or submit a pull request.
stack-gen 0.0.19
A CLI tool to generate code base from any cookiecutter template
License: MIT
Requires Python: >=3.7

# Stack Generator

A CLI tool to generate a code base from any cookiecutter template

## Installation

```bash
pip install stack-gen
```

## CLI Usage

```bash
sg [OPTIONS] [ARGS]...

Options:
  -r,   --repository TEXT        Name of github repository containing the template to generate
  -u    --user TEXT              Name of github's user owning the repository
  -gac  --access_token TEXT      Write GITHUB_ACCESS_TOKEN env variable into .env file (Optional)

  --help                         Show this message and exit.
```

## Example

To clone [this](https://github.com/hourlier96/fastapi-generator) cookiecutter template:

```bash
sg -r fastapi-generator -u hourlier96
```

## Informations

Specified repository MUST respect [cookiecutter template format](https://cookiecutter.readthedocs.io/en/stable/overview.html).

Specified user MUST owned the repository specified.

## License

[MIT](https://choosealicense.com/licenses/mit/)