semvec/pypi-packages huggingface dataset:
pydantic-ai-mlx 0.2.5
Run MLX compatible HuggingFace models with Pydantic AI locally
Requires Python: >=3.12

<div align="center">
	<h1 align="center">pydantic-ai-mlx</h1>
	<p align="center">MLX local inference for <a href="https://github.com/pydantic/pydantic-ai" target="_blank">Pydantic AI</a> through <a href="https://github.com/lmstudio-ai/mlx-engine" target="_blank">LM Studio</a> or <a href="https://github.com/ml-explore/mlx-examples/blob/main/llms" target="_blank">mlx-lm</a> directly.</p>
  <br/>
</div>

<p align="center">
  <a href="https://pypi.org/project/pydantic-ai-mlx">
    <img src="https://img.shields.io/pypi/pyversions/pydantic-ai-mlx" alt="pydantic-ai-mlx" />
  </a>
  <a href="https://pypi.org/project/pydantic-ai-mlx">
    <img src="https://img.shields.io/pypi/dm/pydantic-ai-mlx" alt="PyPI download count">
  </a>
</p>

Run MLX compatible HuggingFace models on Apple silicon locally with Pydantic AI.

Two options are provided as backends;
- LM Studio backend (OpenAI compatible server that can also utilize mlx-lm, model runs on a separate background process)
- mlx-lm backend (direct integration with Apple's library, model runs within your applicaiton, *experimental support*)

*STILL IN DEVELOPMENT, NOT RECOMMENDED FOR PRODUCTION USE YET.*

Contributions are welcome!

### Features
- [x] LM Studio backend, should be fully supported
- [x] Streaming text support for mlx-lm backend
- [ ] Tool calling support for mlx-lm backend

_Apple's MLX seems more performant on Apple silicon than llama.cpp (Ollama), as of January 2025._

## Installation

```bash
uv add pydantic-ai-mlx
```

## Usage

### LM Studio backend
```python
from pydantic_ai import Agent
from pydantic_ai.messages import ModelMessage
from pydantic_ai_lm_studio import LMStudioModel

model = LMStudioModel(model_name="mlx-community/Qwen2.5-7B-Instruct-4bit") # supports tool calling
agent = Agent(model, system_prompt="You are a chatbot.")

async def stream_response(user_prompt: str, message_history: list[ModelMessage]):
    async with agent.run_stream(user_prompt, message_history) as result:
        async for message in result.stream():
            yield message
```

### mlx-lm backend
```python
from pydantic_ai import Agent
from pydantic_ai.messages import ModelMessage
from pydantic_ai_mlx_lm import MLXModel

model = MLXModel(model_name="mlx-community/Llama-3.2-3B-Instruct-4bit")
# See https://github.com/ml-explore/mlx-examples/blob/main/llms/README.md#supported-models
# also https://huggingface.co/mlx-community

agent = Agent(model, system_prompt="You are a chatbot.")

async def stream_response(user_prompt: str, message_history: list[ModelMessage]):
    async with agent.run_stream(user_prompt, message_history) as result:
        async for message in result.stream():
            yield message
```
biliffm4s 1.5
biliffm4s: A tool to merge Bilibili cached .m4s files into .mp4
Requires Python: >=3.6

# biliffm4s: Android哔哩哔哩缓存视频合并  

## 简介  

`biliffm4s`是`bilibili-ffmpeg-m4s(to-mp4)`的缩写.顾名思义,该项目提供了一个Python库,将Android手机哔哩哔哩缓存的视频(为`.m4s`)格式转化为`.mp4`格式.文件转化功能由`ffmpeg`实现,见[github链接](https://github.com/FFmpeg/FFmpeg)    
项目已经发布在PyPi上.因此,使用`pip install biliffm4s`即可使用.`biliffm4s`是即开即用的,不需要安装第三方依赖(如配置`ffmpeg`环境等).    
> 仅适配Windows 64位平台  

## 使用  

`biliffm4s`的使用非常简单:按需使用提供的`convert()`和`combine()`即可.  
具体使用见下:  

### `convert()`  
`convert`函数接受输入的音视频`.m4s`文件,合并并输出为`.mp4`.  
- 参数  
    - `video`: 输入的视频路径.后缀`.m4s`可以省略.缺省值为`video.m4s`  
    - `audio`: 输入的音频路径.后缀`.m4s`可以省略.缺省值为`audio.m4s`  
    - `output`: 输出的视频路径.后缀`.mp4`可以省略.缺省值为`output.mp4`  
- 返回值: `bool` 合并成功与否  

### `combine()`  
`convert`函数需要手动找到对应的`.m4s`,有时这并不够方便.`combine`函数提供了一种更简单的方式:只需要提供包含对应`video.m4s`和`audio.m4s`(哔哩哔哩的缓存视频文件夹始终是这两个名称)的文件夹路径即可,其会自动的进行查找并合并.  
> 在使用`combine()`时,确保路径下只有唯一的`video.m4s`和`audio.m4s`  
- 参数  
    - `directory`: 包含`video.m4s`和`audio.m4s`的文件夹路径  
    - `output`: 输出的视频路径.后缀`.mp4`可以省略.缺省值为`output.mp4`  
- 返回值: `bool` 合并成功与否  

*示例:*  
```python
import biliffm4s

biliffm4s.convert('video.m4s', 'audio.m4s', 'result.mp4') # 将video.m4s和audio.m4s合并为result.mp4  
biliffm4s.convert(output='result2') # 将video.m4s和audio.m4s合并为result2.mp4 
biliffm4s.convert() # 将video.m4s和audio.m4s合并为output.mp4  
biliffm4s.combine('sample') # 自动读取sample文件夹下的video.m4s和audio.m4s并合并为output.mp4
```

## 如何获取Android设备缓存的`.m4s`文件  

按照以下步骤进行操作:  

1. 将视频缓存到你的Android设备上  
2. 使用数据线将其链接至电脑,并进入`USB文件传输`模式  
3. 访问`\Android\data\tv.danmaku.bili\download`路径  
4. 你会看到一堆以数字命名的文件夹,每个文件夹都是一个缓存的视频.通过文件大小和时间判断对应的缓存视频  
5. 至对应文件夹的最深层次处,你会看到`video.m4s`,`audio.m4s`,`index.json`文件,分别对应哔哩哔哩视频的视频,音频和弹幕.拷贝两个`.m4s`到你的电脑上  

> 如果你使用的是哔哩哔哩概念版,那路径为`\Android\data\com.bilibili.app.blue\download`  
> 如果你使用的是`combine()`,直接复制\download路径下的对应子文件夹即可
npm2rez 0.3.0
Convert npm packages to rez packages
Requires Python: <4.0,>=3.8

# npm2rez

<div align="center">
    <img src="https://raw.githubusercontent.com/loonghao/npm2rez/master/logo.svg" alt="npm2rez Logo" width="200"/>
</div>

A tool to convert Node.js packages to rez packages for VFX and animation pipeline integration.

[![PyPI version](https://badge.fury.io/py/npm2rez.svg)](https://badge.fury.io/py/npm2rez)
[![Python Version](https://img.shields.io/pypi/pyversions/npm2rez.svg)](https://pypi.org/project/npm2rez/)
[![Downloads](https://static.pepy.tech/badge/npm2rez)](https://pepy.tech/project/npm2rez)
[![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![codecov](https://codecov.io/gh/loonghao/npm2rez/branch/master/graph/badge.svg)](https://codecov.io/gh/loonghao/npm2rez)

[English](README.md) | [中文](README_zh.md)

## Features

- Support for installing Node.js packages from npm or GitHub
- Automatically create rez-compliant package structure
- Configure correct environment variables and paths
- Support for executable creation and configuration
- Generate detailed documentation and changelogs

## Installation

```bash
# Install from PyPI
pip install npm2rez
# Or use uv to install
uv pip install npm2rez

# Or install from source
git clone https://github.com/loonghao/npm2rez.git
cd npm2rez
uv pip install -e .
```

## Usage

### Basic Usage

```bash
# Run with uvx (recommended)
uvx npm2rez --name typescript --version 4.9.5 --source npm --node-version 16.14.0

# Or run directly
npm2rez --name typescript --version 4.9.5 --source npm --node-version 16.14.0

# Create package from GitHub
uvx npm2rez --name typescript --version 4.9.5 --source github --repo microsoft/TypeScript
```

### Command Line Arguments

| Parameter | Description | Default |
|-----------|-------------|--------|
| `--name` | Package name | (required) |
| `--version` | Package version | (required) |
| `--source` | Package source (npm or github) | npm |
| `--repo` | GitHub repository (format: user/repo), required when source=github | None |
| `--output` | Output directory | ./rez-packages |
| `--node-version` | Node.js version requirement | 16 |
| `--global` | Install package globally | False |
| `--install` | Install package after creation | False |

## Examples

### Creating a TypeScript Package

```bash
npm2rez --name typescript --version 4.9.5
```

This will create a rez package for TypeScript version 4.9.5.

### Using the Created Package

```bash
# Activate the package environment
rez env typescript-4.9.5

# Or directly run the executable
rez env typescript-4.9.5 -- tsc --version
```

## Development

```bash
# Clone the repository
git clone https://github.com/loonghao/npm2rez.git
cd npm2rez

# Install development dependencies
uv pip install -e ".[dev]"

# Run tests
uvx nox -s pytest

# Run real package tests
uvx nox -s pytest-real-packages

# Run linting
uvx nox -s lint
```

## License

MIT