semvec/pypi-packages huggingface dataset:
TorchHook 0.2.7
TouchHook: A PyTorch hook management library
Requires Python: >=3.6

![TorchHook Logo](assets/logo.jpg)

# TorchHook

[![PyPI version](https://badge.fury.io/py/torchhook.svg)](https://badge.fury.io/py/torchhook)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://img.shields.io/pypi/dm/torchhook.svg)](https://pypi.org/project/torchhook/)
[![Python Version](https://img.shields.io/pypi/pyversions/torchhook.svg)](https://pypi.org/project/torchhook/)

[English Blog](./BLOG.md) | [中文博客](./BLOG_CN.md) | [中文文档](./README_CN.md)

TorchHook is a lightweight, easy-to-use Python library designed to simplify the process of extracting intermediate features from PyTorch models. It provides a clean API to manage PyTorch hooks for capturing layer outputs without the boilerplate code.

## Key Features

- **Easy Hook Registration**: Quickly register hooks for desired model layers by name or object.
- **Flexible Feature Extraction**: Retrieve captured features easily.
- **Highly Customizable**: Define custom hook logic or output transformations.
- **Resource Management**: Automatic cleanup of registered hooks.

## Installation

```bash
pip install torchhook
```
Or install from the local source:
```bash
git clone https://github.com/zzaiyan/TorchHook.git
cd TorchHook
pip install .
```

## Quick Start

```python
import torch
import torchvision.models as models
from torchhook import HookManager

# 1. Load your model
model = models.resnet18()
model.eval()

# 2. Initialize HookManager
hook_manager = HookManager(model, max_size=1) # Keep only the latest feature per hook

# 3. Register layers
hook_manager.add(layer_name='conv1')
hook_manager.add(layer_name='layer4.1.relu')
hook_manager.add(layer_name='fully_connected', layer=model.fc) # Optional: pass layer object

# 4. Forward pass
dummy_input = torch.randn(1, 3, 224, 224)
with torch.no_grad():
    output = model(dummy_input)

# 5. Get features
features_conv1 = hook_manager.get('conv1')
features_relu = hook_manager.get('layer4.1.relu')
all_features = hook_manager.get_all() # Get all features as a dict

print(f"Conv1 feature shape: {features_conv1[0].shape}")
print(f"Layer 4.1 ReLU feature shape: {features_relu[0].shape}")

# 6. Summary (Optional)
hook_manager.summary()

# 7. Clean up hooks (Important!)
hook_manager.clear_hooks()
```

For advanced usage like custom hooks and output transformations, please refer to the blog posts: [English](./BLOG.md) | [中文](./BLOG_CN.md)
chest-form-api-endstone 1.0.0
Chest Form API for Endstone
Requires Python: >=3.9
Keywords: endstone, chest_form_api

# ChestForm
Chest Form API for Endstone

[![PyPI - Version](https://img.shields.io/pypi/v/chest_form_api_endstone)](https://pypi.org/project/chest_form_api_endstone)
[![Python](https://img.shields.io/pypi/pyversions/chest_form_api_endstone?logo=python&logoColor=white)](https://www.python.org/)  
[![PyPI - Downloads](https://img.shields.io/pypi/dm/chest_form_api_endstone)](https://pypi.org/project/chest_form_api_endstone/)

## Install
```bash
pip install chest_form_api_endstone
```

## Quick Start 🚀
Example
```Python
from endstone import Player
from chest_form_api_endstone import ChestForm

class MyPlugin(Plugin):
    # ... (other methods)

    def on_command(self, sender: CommandSender, command: Command, _):
        match command.name:
            case "chest":
                if isinstance(sender, Player):
                    form = ChestForm(self, "Test Form")
                    form.fill_slots(
                        "minecraft:bedrock",
                        display_name="Test Item",
                        lore=["1111", "22222"],
                        enchants={"lure": 12234, "flame": 11345},
                    )

                    def call_back(player: Player, index: int):
                        player.send_message("114514")
                        form.send_to(player)

                    form.set_slot(3, "minecraft:diamond_block", call_back)
                    form.send_to(player)
                            else:
                                sender.send_error_message(
                                    "This command can only be executed by player."
                                )
                return False
        return True
```

## Used Libraries 📖
| Library                  | License  | Link                                                     |
| ------------------------ | -------- | -------------------------------------------------------- |
| RapidNBT                 | MPL-2.0  | <https://github.com/GlacieTeam/RapidNBT>                 |
| bedrock-protocol-packets | MPL-2.0  | <https://github.com/GlacieTeam/bedrock-protocol-packets> |

---


### Copyright © 2025 GlacieTeam. All rights reserved.
ragents-frontend 0.1.0
RAGents Frontend - A Python-embeddable Next.js frontend for RAG agents
Requires Python: >=3.9

# RAGents Frontend

A Python package that bundles the RAGents Next.js frontend for easy integration into Python applications.

## Installation

### Using uv (recommended)

```bash
uv pip install -e .
```

### Using pip

```bash
pip install -e .
```

## Usage

### As a Python Module

```python
from ragents_frontend import get_frontend_path, FRONTEND_DIR
from ragents_frontend.server import create_app, serve

# Get the frontend directory path
frontend_path = get_frontend_path()
print(f"Frontend is located at: {frontend_path}")

# Create a FastAPI app with the frontend
app = create_app()

# Or serve directly
serve(host="0.0.0.0", port=3000)
```

### As a CLI Tool

```bash
# Run the frontend server
python -m ragents_frontend

# With custom options
python -m ragents_frontend --host 127.0.0.1 --port 8080

# With auto-reload for development
python -m ragents_frontend --reload

# With a custom frontend directory
python -m ragents_frontend --frontend-dir /path/to/frontend
```

### Integration with Existing FastAPI Apps

```python
from fastapi import FastAPI
from ragents_frontend.server import create_app

# Your existing FastAPI app
main_app = FastAPI()

# Mount the frontend
frontend_app = create_app()
main_app.mount("/", frontend_app)

# Your API routes
@main_app.get("/api/data")
def get_data():
    return {"message": "Hello from API"}
```

## Development

### Prerequisites

- Python 3.9+
- Node.js 18+ (for building the frontend)
- uv (recommended) or pip

### Building the Package

1. Build the Next.js frontend first:
```bash
cd ../ragents-frontend
npm install
npm run build
```

2. Build the Python package:
```bash
cd ragents_frontend
uv build
```

### Development Installation

```bash
uv pip install -e ".[dev]"
```

### Running Tests

```bash
pytest
```

## Package Structure

```
ragents_frontend/
├── src/
│   └── ragents_frontend/
│       ├── __init__.py          # Package entry point
│       ├── __main__.py          # CLI entry point
│       ├── server.py            # FastAPI server implementation
│       ├── frontend/            # Bundled Next.js frontend
│       └── frontend_lib/        # Frontend library code
├── pyproject.toml               # Package configuration
└── README.md                    # This file
```

## License

MIT License

## Author

Mehran Moazeni (mehran1414@gmail.com)