semvec/pypi-packages huggingface dataset:
ninetoothed 0.23.0
A domain-specific language based on Triton but providing higher-level abstraction.
Requires Python: >=3.10

# NineToothed

![NineToothed Logo](https://github.com/InfiniTensor/ninetoothed/raw/master/docs/source/_static/ninetoothed-logo.png)

[![Document](https://img.shields.io/badge/Document-ready-blue)](https://ninetoothed.org/)
[![PyPI Version](https://img.shields.io/pypi/v/ninetoothed?color=cyan)](https://pypi.org/project/ninetoothed/)
[![License](https://img.shields.io/badge/license-Apache--2.0-green)](LICENSE)

NineToothed is a Triton-based domain-specific language (DSL). By introducing **tensor-oriented meta-programming (TOM)**, it makes writing high-performance GPU kernels easier.

## Installation

We can use `pip` to install `ninetoothed`.

```shell
pip install ninetoothed
```

After successfully running the above command, `ninetoothed` will be installed. However, to fully utilize its capabilities, you also need to install a deep learning framework supported by `ninetoothed`. For trial purposes, we recommend installing `torch`.

## Usage

Thanks to tensor-oriented meta-programming, NineToothed can be written using the **arrange-and-apply** paradigm, which involves separately defining `arrangement`, `application`, and `tensors`, and then integrating them using `ninetoothed.make` to generate the kernel.

### Matrix Multiplication

Here is the code we need for matrix multiplication:

```python
import ninetoothed
import ninetoothed.language as ntl
from ninetoothed import Tensor, block_size

BLOCK_SIZE_M = block_size()
BLOCK_SIZE_N = block_size()
BLOCK_SIZE_K = block_size()


def arrangement(input, other, output):
    output_arranged = output.tile((BLOCK_SIZE_M, BLOCK_SIZE_N))

    input_arranged = input.tile((BLOCK_SIZE_M, BLOCK_SIZE_K))
    input_arranged = input_arranged.tile((1, -1))
    input_arranged = input_arranged.expand((-1, output_arranged.shape[1]))
    input_arranged.dtype = input_arranged.dtype.squeeze(0)

    other_arranged = other.tile((BLOCK_SIZE_K, BLOCK_SIZE_N))
    other_arranged = other_arranged.tile((-1, 1))
    other_arranged = other_arranged.expand((output_arranged.shape[0], -1))
    other_arranged.dtype = other_arranged.dtype.squeeze(1)

    return input_arranged, other_arranged, output_arranged


def application(input, other, output):
    accumulator = ntl.zeros(output.shape, dtype=ntl.float32)

    for k in range(input.shape[0]):
        accumulator += ntl.dot(input[k], other[k])

    output = accumulator


tensors = (Tensor(2), Tensor(2), Tensor(2))

kernel = ninetoothed.make(arrangement, application, tensors)
```

## Useful Links

- [NineToothed Documentation](https://ninetoothed.org/)
- [NineToothed Operators](https://github.com/InfiniTensor/ntops)
- [NineToothed Examples](https://github.com/InfiniTensor/ninetoothed-examples)

## License

This project is distributed under the Apache-2.0 license. See the included [LICENSE](LICENSE) file for details.
otsu2D 0.1.0
Numba-accelerated local 2D Otsu thresholding for 3D images.
Requires Python: >=3.9

# 🧠 Local 2D Otsu Thresholding

**Local 2D Otsu Thresholding** is a **Numba-accelerated** implementation of a *local* 2D Otsu thresholding method for 3D images.

This algorithm adapts the 2D Otsu threshold within a sliding 3D window, enabling robust segmentation in datasets with spatially varying intensity distributions.

---

## ⚙️ Installation

Install the latest stable version from PyPI:

```bash
pip install otsu2D
```

## 🚀 Example Usage

```python
import numpy as np
from otsu2D import getBinary

# Create sample 3D image
img = np.random.randint(0, 256, size=(10, 10, 10), dtype=np.uint8)

# Get threshold map and binary image
binary = getBinary(img, window_size=(3, 3, 3),  mean_window_size =(3,3,3))
```

## 🖥️ Command Line Usage

You can execute the script with custom parameters:

```bash
python runner.py --shape 10 10 10 --window 3 3 3 --mean_window 3 3 3
```

## 📦 Dependencies

- NumPy
- Numba
- Matplotlib

Install dependencies with:

```bash
pip install numpy numba matplotlib
```

## 📜 License

This project is licensed under the MIT License. See the LICENSE file for details.

## 🤝 Contributing

Contributions are welcome! If you'd like to fix a bug, add a feature, or improve performance, please open a pull request or contact the maintainers.

## 💬 Contact

For questions, issues, or feedback, open an issue on GitHub.
modifiedOtsu 0.1.0
Numba-accelerated local modified Otsu thresholding for 3D images.
Requires Python: >=3.9

# 🧠 Local Modified Otsu Thresholding

**Local Modified Otsu Thresholding** is a **Numba-accelerated** implementation of a *local, contrast-adaptive* Otsu thresholding method for 3D images.

This algorithm adapts the Otsu threshold within a sliding 3D window, enabling robust segmentation in datasets with spatially varying intensity distributions.

The method is inspired by the segmentation approach described in **Subsection 2.2.2** of the article:

> *Segmentation-based tracking of macrophages in 2D + time microscopy movies inside a living animal*
> 
> *Computers in Biology and Medicine, 153 (2023), 106499*
> 
> [https://doi.org/10.1016/j.compbiomed.2022.106499](https://doi.org/10.1016/j.compbiomed.2022.106499)

If you use this implementation in your research, please cite the original work that inspired this algorithm.

---

## ⚙️ Installation

Install the latest stable version from PyPI:

```bash
pip install modifiedOtsu
```

## 🚀 Example Usage

```python
import numpy as np
from modifiedOtsu import getMask

# Create sample 3D image
img = np.random.randint(0, 256, size=(10, 10, 10), dtype=np.uint8)

# Get threshold map and binary image
threshold, binary = getMask(img, window_size=(3, 3, 3), delta=0.2)
```

## 🖥️ Command Line Usage

You can execute the script with custom parameters:

```bash
python runner.py --shape 10 10 10 --window 3 3 3 --delta 0.2
```

## 📦 Dependencies

- NumPy
- Numba
- Matplotlib

Install dependencies with:

```bash
pip install numpy numba matplotlib
```

## 📜 License

This project is licensed under the MIT License. See the LICENSE file for details.

## 🤝 Contributing

Contributions are welcome! If you'd like to fix a bug, add a feature, or improve performance, please open a pull request or contact the maintainers.

## 💬 Contact

For questions, issues, or feedback, open an issue on GitHub.
nonebot-adapter-qq 1.6.6
QQ adapter for nonebot2
Requires Python: <4,>=3.9
Keywords: bot, qq, qqbot, qqguild

<p align="center">
  <a href="https://nonebot.dev/"><img src="https://raw.githubusercontent.com/nonebot/adapter-qq/master/assets/logo.png" width="200" height="200" alt="nonebot-adapter-qq"></a>
</p>

<div align="center">

# NoneBot-Adapter-QQ

_✨ QQ 协议适配 ✨_

</div>

## 配置

修改 NoneBot 配置文件 `.env` 或者 `.env.*`。

### Driver

如果使用 WebSocket 连接方式，请参考 [driver](https://nonebot.dev/docs/appendices/config#driver) 配置项，添加 `HTTPClient` 和 `WebSocketClient` 支持。如：

```dotenv
DRIVER=~httpx+~websockets
DRIVER=~aiohttp
```

如果使用 WebHook 连接方式，则添加 `ASGIServer` 支持。如：

```dotenv
DRIVER=~fastapi
```

### QQ_IS_SANDBOX

是否为沙盒模式，默认为 `False`。

```dotenv
QQ_IS_SANDBOX=true
```

### QQ_BOTS

配置机器人帐号 `id` `token` `secret`，intent 需要根据机器人类型以及需要的事件进行配置。

#### Webhook / WebSocket

通过配置项 `use_websocket` 来选择是否启用 WebSocket 连接，当前默认为 `True`。如果关闭 WebSocket 连接方式，则可以通过 WebHook 方式来连接机器人，请在 QQ 开放平台中配置机器人回调地址：`https://host:port/qq/webhook`。

#### Intent

Intent 仅对 WebSocket 连接方式生效。以下为所有 Intent 配置项以及默认值：

```json
{
  "guilds": true,
  "guild_members": true,
  "guild_messages": false,
  "guild_message_reactions": true,
  "direct_message": false,
  "open_forum_event": false,
  "audio_live_member": false,
  "c2c_group_at_messages": false,
  "interaction": false,
  "message_audit": true,
  "forum_event": false,
  "audio_action": false,
  "at_messages": true
}
```

#### 示例

私域频道机器人示例

```dotenv
QQ_BOTS='
[
  {
    "id": "xxx",
    "token": "xxx",
    "secret": "xxx",
    "intent": {
      "guild_messages": true,
      "at_messages": false
    },
    "use_websocket": false
  }
]
'
```

公域群机器人示例

```dotenv
QQ_BOTS='
[
  {
    "id": "xxx",
    "token": "xxx",
    "secret": "xxx",
    "intent": {
      "c2c_group_at_messages": true
    },
    "use_websocket": false
  }
]
'
```
librenmsapi 0.0.1
Python client for the LibreNMS API

# librenmsapi

**librenmsapi** is Python client library for the [LibreNMS API](https://docs.librenms.org/API/). 

The Python code (``librenmsapi.py``) is auto-generated from the Markdown files for the LibreNMS API documentation. 
It should therefore be complete, assuming that the LibreNMS API documentation is complete. 

```python
import librenmsapi

URL = 'http://192.168.1.1'
TOKEN = '3231554f57c1d0d05c5c3c0a2da3ba8f6a1b67f2'

client = librenmsapi.LibreNMS(URL, TOKEN):
```

The endpoint categories (Devices, Inventory, Locations, etc.) are available as attributes of the ``LibreNMS`` class
(in lower-case) and the actual endpoints as their methods().

Required inputs must be provided as arguments, optional inputs can be supplied as keyword arguments.

All methods return a Python dictionary, equivalent to the JSON output shown in the [LibreNMS API](https://docs.librenms.org/API/) documentation.

Any API calls that result in an error will raise ``librenmsapi.ApiException``.

```python

result = client.devices.add_device(hostname='localhost', community='public')
print(result)
# {'count': 1,
# 'devices': [{'agent_uptime': 0,
#              'authalgo': None,
#              'authlevel': None,
#              'authname': None,
#              'authpass': None,
#              ...
#              'transport': 'udp',
#              'type': '',
#              'uptime': None,
#              'version': None}],
# 'status': 'ok'}

result = client.devices.get_device('localhost')
print(result)
# {
#    "status": "ok",
#    "devices": [
#        {
#            "device_id": "1",
#            "hostname": "localhost",
#            ...
#            "serial": null,
#            "icon": null
#        }
#    ]
# }
```
callme-gate 0.1.0
一个简单的低负载联网网关，提供HTTP请求路由和处理功能
Requires Python: >=3.10

# CallMe Gate 

编写这个组件的初衷，是我希望有一个 内网穿透 服务，而且可以相当灵活地发布自己的个人 service 服务。

网络上有一些 SaaS 平台，都支持进行 回调（事件）这个特性，假如我们有一个稳定的服务器，接受这些回调，会让我们的 Service 多很多的扩展。

同时，要部署一个稳定的服务器，需要在线上一直部署一个 ECS，但对个人来说，这个非常浪费。因此我在构思，如何用一种比较低成本的方案，将我们的服务提供到公网进行服务呢？可以做一个非常简单的低负载联网网关，提供一个非常便宜及简洁的 Service 服务器。

技术调研上，我们可以将 gate 打包成一个**函数计算**程序包，可以发布到 aliyun 函数计算产品中，再使用一个 redis 实例保存状态，通过本地进程消费 redis 中状态进行计算服务。也就是说：gate 节点保存在线上， worker 节点可以保存在任意的进程中，甚至是你的移动设备。

因此我花了一点时间，编写了这个 gate 框架。

## 核心功能

- **HTTP请求路由**: 将客户端请求路由到合适的工作节点处理
- **动态路由注册**: 工作节点可以动态注册API路由
- **服务发现**: 支持工作节点的自动注册和发现
- **高可用设计**: 支持多工作节点横向扩展

## TODO
- [ ] 注册时通过分布式锁，避免路由状态错误
- [x] 测试请求实际网络延迟 (阿里云深圳地区的函数计算接受一个 counter 的计数处理，worker 在广州家里。rtt 约 150ms )
- [ ] 实现一个简单的鉴权处理
- [ ] worker 的心跳机制, 避免强杀进程导致路由状态错误。

## 系统架构

```
客户端 -> 网关(gate.py) -> Redis队列 -> 工作节点(worker.py) -> Redis存储 -> 网关响应客户端
```

## 核心模块说明

### 网关 (gate.py)

网关是系统的入口点，负责接收所有客户端请求，并将请求转发给适当的工作节点处理。网关通过装饰器 `@process_via_gateway` 将API请求转换为HttpJob对象并推送到Redis队列。

### 工作节点 (worker.py)

工作节点从Redis队列中获取作业并处理。工作节点通过 `@register_handler` 装饰器将处理函数注册到特定路由路径和HTTP方法。

### 应用工作节点 (callme/app_worker.py)

实现了工作节点的核心逻辑，包括任务队列处理、路由处理器注册、以及处理结果的返回。

### HTTP作业 (callme/model/http_job.py)

表示一个HTTP请求作业，包含请求和响应的所有相关信息，支持序列化和反序列化。

### 路由系统 (callme/router/)

- **http_job_router.py**: HTTP路由处理
- **route_registry.py**: 路由注册管理
- **job_dispatcher.py**: 任务分发和结果处理
- **route_strategy.py**: 路由策略实现（如轮询、随机等）

### 计数器示例 (exmaples/counter.py)

提供了一个完整的计数器API实现，演示如何使用网关-工作节点架构构建功能。

## 环境要求

- Python 3.7+
- Redis服务器
- 可选依赖库：Flask, redis, tabulate, python-dotenv

## 环境变量

在 `.env` 文件中配置：

```
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_DB=0
REDIS_PASSWORD=
REDIS_USE_SSL=false
```

## 快速开始

1. 安装依赖

```bash
pip install -r requirements.txt
```

2. 启动Redis服务器

3. 运行工作节点

```bash
python worker.py
```

4. 运行网关服务

```bash
python gate.py
```

网关默认在 http://localhost:9000 启动。

## API端点

### 系统API

- `GET /health`: 健康检查
- `GET /routes`: 获取所有已注册路由信息

### 计数器API示例

- `POST /api/counter/increment`: 增加计数器，参数 `{"name": "计数器名", "amount": 数量}`
- `POST /api/counter/decrement`: 减少计数器，参数 `{"name": "计数器名", "amount": 数量}`
- `POST /api/counter/reset`: 重置计数器，参数 `{"name": "计数器名"}`
- `GET /api/counter/get?name=计数器名`: 获取计数器值

## 工作节点扩展

系统支持多工作节点并行处理请求。可以通过启动多个工作节点实例来扩展系统处理能力：

```bash
python worker.py --version worker-1
python worker.py --version worker-2
...
```

## 使用示例

### 增加计数器

```bash
curl -X POST http://localhost:9000/api/counter/increment \
     -H "Content-Type: application/json" \
     -d '{"name": "visitors", "amount": 1}'
```

### 获取计数器值

```bash
curl http://localhost:9000/api/counter/get?name=visitors
```

## 单元测试
* 本地启动一个 redis 服务
```
./run.sh test
```
clippers 0.1.5
A package to do text, Markdown and HTML conversions and replacements
Requires Python: >=3.8
Keywords: python, packaging, example

# Clippers

Clippers is a Python library that allows you to convert Markdown to HTML and vice-versa, as well as Markdown-ifying and HTML-ifying text.

## The `Clippers` class
The library comes with 1 class, the `Clippers` class. This holds the following methods.

### Class methods