semvec/pypi-packages huggingface dataset:
brainchop 0.2.1
Portable and lightweight brain segmentation using tinygrad
License: MIT
Requires Python: >=3.10

# BrainChop

BrainChop is a lightweight tool for brain segmentation that runs on pretty much everything.

---

## Installation

```bash
pip install brainchop
```

For development (includes docs, testing):

```bash
pip install -e ".[all]"
```

## CLI Usage

```bash
# Segment a brain MRI
brainchop input.nii.gz -o output.nii.gz

# List available models
brainchop --list

# Use a specific model
brainchop input.nii.gz -m subcortical -o output.nii.gz

# Skull stripping
brainchop input.nii.gz --skull-strip -o brain.nii.gz

# With BEAM optimization
brainchop input.nii.gz -m tissue_fast --beam 2 -o output.nii.gz
```

## Python API

```python
import brainchop as bc

# List available models
print(bc.list_models())

# Load, segment, save
vol = bc.load("input.nii.gz")
result = bc.segment(vol, "subcortical")
bc.save(result, "output.nii.gz")

# With BEAM optimization
bc.optimize("tissue_fast", beam=2)
result = bc.segment(vol, "tissue_fast")

# Export to WebGPU
bc.export("tissue_fast", "/tmp/export")
```

## Documentation

Serve docs locally:

```bash
mkdocs serve -w brainchop/
```

## Docker

```bash
git clone git@github.com:neuroneural/brainchop-cli.git
cd brainchop-cli
docker build -t brainchop .
```

Then to run:

```bash
docker run --rm -it --device=nvidia.com/gpu=all -v [[output directory]]:/app brainchop [[input nifti file]] -o [[output nifti file]]
```

## Requirements

- Python 3.10+
- tinygrad
- numpy
- requests

## License

MIT License
fastapi-bootstrap 0.2.5
🚀 Easy FastAPI Setup Kit - Production-ready FastAPI boilerplate with logging, error handling, metrics, security headers, and more
License: MIT
Requires Python: >=3.12
Keywords: fastapi, logging, error-handling, api, web, framework, production, metrics, security, opentelemetry

# FastAPI Bootstrap

Production-ready FastAPI boilerplate with batteries included.

[한국어](./README.ko.md) | English

## Features

- **📝 Structured Logging** — Loguru-based logging with request tracking and trace IDs
- **🛡️ Exception Handling** — Centralized error handling with consistent responses
- **📊 Prometheus Metrics** — Built-in `/metrics` endpoint with request statistics
- **🔒 Security Headers** — HSTS, CSP, X-Frame-Options middleware
- **🔐 OIDC Authentication** — Optional JWT/JWKS validation
- **⚡️ Type Safety** — Pydantic V2 integration with enhanced BaseModel

## Installation

```bash
pip install fastapi-bootstrap
```

## Quick Start

```python
from fastapi import APIRouter
from fastapi_bootstrap import create_app, LoggingAPIRoute

router = APIRouter(route_class=LoggingAPIRoute)

@router.get("/hello")
async def hello():
    return {"message": "Hello, World!"}

app = create_app([router], title="My API", version="1.0.0")
```

Run with: `uvicorn app:app --reload`

## Core Components

### Application Factory

```python
from fastapi_bootstrap import create_app

app = create_app(
    routers=[router],
    title="My API",
    version="1.0.0"
)
```

### Logging

```python
from fastapi_bootstrap import get_logger, LoggingAPIRoute

logger = get_logger(__name__)
router = APIRouter(route_class=LoggingAPIRoute)

@router.get("/users/{user_id}")
async def get_user(user_id: int):
    logger.info("Fetching user", user_id=user_id)
    return {"user_id": user_id}
```

### Exception Handling

```python
from fastapi_bootstrap.exception import NotFoundException

@router.get("/users/{user_id}")
async def get_user(user_id: int):
    user = db.get(user_id)
    if not user:
        raise NotFoundException(detail="User not found")
    return user
```

Error response:
```json
{
  "error": {
    "code": "NOT_FOUND",
    "message": "User not found"
  }
}
```

### Metrics

```python
from fastapi_bootstrap import MetricsMiddleware, get_metrics_router

app.add_middleware(MetricsMiddleware)
app.include_router(get_metrics_router())  # GET /metrics
```

## Documentation

For advanced features, see [ADVANCED.md](./ADVANCED.md):
- Security Headers Configuration
- Request ID & Timing Middleware
- Max Request Size Limits
- OIDC Authentication Setup
- CORS Configuration
- Health Checks
- Complete Examples

## Examples

See [examples/](./examples/) directory for complete working examples.

## License

MIT License - see [LICENSE](./LICENSE)