semvec/pypi-packages huggingface dataset:
mailing-backend 1.0.5
Django app for an endpoint mailing.
Requires Python: >=3.11

# Mailing backend

Проект для интеграции МС рассылки с другими Django МС.

## Подготовка

Скачать через pip:

```pip
pip install mailing-backend==1.0.5
```

### settings.py

Добавить проект в INSTALLED_APPS

```python
# File: settings.py

INSTALLED_APPS = [
    ...
    "mailing_backend",
]
```

Установить переменную EMAIL_ENDPOINT_URL

```python
# File: settings.py

EMAIL_ENDPOINT_URL = "http://127.0.0.1:8000/api/v1/mailing/message-send/"
```

Установить переменную EMAIL_BACKEND

```python
# File: settings.py

EMAIL_BACKEND = "mailing_backend.backend.EndpointEmailBackend"
```

## Пример использования:

### serializers.py

```python

#serializers.py
from rest_framework import serializers

class SendUserMSSerializer(serializers.Serializer):

    subject = serializers.CharField()
    body = serializers.CharField()
    email_list = serializers.ListField(child=serializers.CharField(max_length=254))
    from_message = serializers.CharField(required=False, allow_blank=True)
```

### views.py

```python

#views.py
from typing import Any
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.request import Request
from django.core.mail import EmailMessage
from ma_apps.serializers import SendUserMSSerializer

class MessageSendMSView(APIView):
    serializer_class = SendUserMSSerializer #пример обращения к сериализатору
    def post(
        self, request: Request, *args: Any, **kwargs: Any
    ) -> Response:  
      
        message_serializer = SendUserMSSerializer(data=request.data)
        message = EmailMessage()
        message.subject = message_serializer.initial_data.get("subject", '') #string
        message.body = message_serializer.initial_data.get("body", '') #string
        message.to = message_serializer.initial_data.get("email_list", []) #list
        message.from_email = message_serializer.initial_data.get("from_message", '') #string

        result = message.send()
        return Response(result) 
```

### urls.py

```python
#urls.py

from appms import views
from django.urls import path

urlpatterns = [
	path("message-ms-send/", views.MessageSendMSView.as_view(), name="send"),
]
```

## Пример запроса

```JSON
{
    "subject": "Тема сообщения",
    "body": "Содержание сообщения",
    "email_list": ["example1@mail.ru", "example2.@mail.ru"],
    "from_message": "Sender"
}
```

## Сборка

Как собрать проект локально

```bash
python3 -m pip install build
python3 -m build 
```

### Проверка собранного пакета

```bash
python3 -m pip install twine
twine check dist/*
```

### Выкладывание проекта в PYPI

```bash
twine upload dist/*
```
sessiongpt 0.1.1
Generates an AWS IAM session policy given a description of the tasks the user needs to perform.
Requires Python: >=3.8

# sessionGPT

Just for fun utility to generate AWS IAM session policies using GPT-4.

### Install
```
pip install sessiongpt
```

### Example Usage

```sh
sessiongpt --description "I want to create and manage S3 buckets, update my Lambda memory configuration. I also need to perform all database actions, but I don't want to delete any by accident." --pretty
```
gpu-queuer 0.0.5
Deep learning tools
Requires Python: >=3.6
Keywords: gpu,queuer


### GPU 自动选择、排队
- gpu_queue(config: Union[DictConfig, dict] = {})：设置处理器
    ```
    支持自动选择和手动选择、排队和不排队

    Args:
        config (dict, optional): Defaults to {}.
            queuing: 是否排队，依赖 Redis，默认为 True
            visible_devices: 可见的 GPU 序号，用逗号分隔，默认为 -1, 表示全部可见
            memo: 备注
    Returns:
        Union[DictConfig, dict]: config
    ```
anynotify 0.0.1
Backend-independent error notification library
Requires Python: >=3.8

# anynotify

anynotify is a flexible, backend-independent error notification system for Python applications. It enables developers to seamlessly integrate error reporting with various notification channels such as Discord.

## Features

- **Backend Independent**: Choose your preferred notification channel.
- **Easy Integration**: Simple setup process for Python applications.
- **Rate-limiting**: Prevent flooding notification channels.

## Quick Start
```python
import anynotify
import logging

anynotify.init(
    integrations=[anynotify.LoggingIntegration()],
    client=anynotify.DiscordClient(webhook_url='https://...'),
)
logging.warning('This will be sent to the Discord channel')
```
trio-mongodb 0.5.0
Trio pymongo wrapper for async operations using threads or processes.
Requires Python: >=3.8

# trio-mongodb

Trio-mongodb was created because motor is coded in the most stupid + complex way possible I just cba

This creates a AsyncMongoClient that starts a seperate python process
The process will use trio's to_sync to execute queries using pymongo

Ultimately, this results in a 100% nonblocking GIL bypassed trio lib for mongodb

Using threads only can potentially result in a massive slow down for your main process, code is provided for both, below is an example using process+threads

```
import trio

from trio_mongodb.process import AsyncMongoClient

async def main():
    client = AsyncMongoClient("mongodb://localhost:27017/", "your_database")
    collection = client.get_collection('your_collection')

    # Perform operations
    result = await collection.insert_one({"name": "Alice", "age": 30})
    print(f"Inserted ID: {result.inserted_id}")
    
    updateResult = await collection.update_one({"name": "Alice"}, {"$set": {"age": 31}})
    print(f"Updated count: {updateResult.modified_count} | Matched count: {updateResult.matched_count}")

    # Don't forget to close the client
    client.close()

if __name__ == "__main__":
    trio.run(main)
```