semvec/pypi-packages huggingface dataset:
ensure-json 0.1.1
A <3kB, dependency-free toolkit to repair 'almost-JSON' text from LLMs and return a valid Python object—or raise JsonFixError.
License: MIT
Requires Python: >=3.7

# ensure-json

Repair and parse "almost-JSON" from LLMs (like GPT, Claude) into valid Python objects, or raise a clear error. Works in any Python 3.7+ environment. Zero dependencies (Pydantic optional for schema validation).

---

## Install

```bash
pip install ensure-json
```

---

## Usage

### As a Python Library

```python
from ensure_json import ensure_json, JsonFixError

try:
    obj = ensure_json('{ name: "Alice", age: 42, }')
    print(obj)  # {'name': 'Alice', 'age': 42}
except JsonFixError as err:
    print("Could not parse JSON:", err)
```

#### With Pydantic Schema (optional)

```python
from ensure_json import ensure_json
from pydantic import BaseModel

class User(BaseModel):
    name: str
    age: int

user = ensure_json('{ name: "Alice", age: 42 }', schema=User)
print(user)  # User(name='Alice', age=42)
```

### Command Line

```bash
echo '{ name: "Alice", age: 42, }' | ensure-json
# or
echo '{ name: "Alice", age: 42, }' | python -m ensure_py.cli
```

---

## Features

- Repairs and parses "almost-JSON" from LLMs (extra commas, unquoted keys, etc.)
- Returns a valid Python object or raises `JsonFixError`
- Optional Pydantic schema validation
- Minimal CLI for quick fixes
- No dependencies required (Pydantic optional)

---

## License

MIT
traceloggerx 0.1.8
Structured JSON logger with trace_id, user_id and colored console output.
License: MIT
Requires Python: >=3.8

# traceloggerx
✨ A Python logging utility with colorful console output and structured JSON file logging. Built for real-world debugging and traceability.

[![PyPI version](https://badge.fury.io/py/traceloggerx.svg)](https://pypi.org/project/traceloggerx/)


## Features
- Colorful console logs using `colorlog`
- JSON structured logs with `trace_id` and `user_id`
- Automatic exception capturing via `sys.excepthook`
- Easily reusable across different projects


## Installation
```bash
pip install traceloggerx
```


## Usage
```python
from logutils.logger import set_logger

# Create a logger with a default user_id
logger = set_logger("myapp", json_format=True, extra={"user_id": "anonymous"})

# Add a trace_id dynamically when logging
logger.info("User accessed dashboard", extra={"trace_id": "req-001"})
```

## Example Usage of `traceloggerx`
This directory contains example scripts demonstrating how to use the `traceloggerx` logging utility.

### Files
- **basic_usage.py**
  Shows the simplest use of the logger with no trace_id or user_id.
- **with_trace_and_user.py**
  Demonstrates how to include custom fields like `trace_id` and `user_id`.
- **fastapi_example.py**
  Integrates `traceloggerx` with a FastAPI web server using middleware.

### How to Run
You can run any script directly:
```bash
python examples/basic_usage.py
```

## License
MIT


## Maintainer
🔗 GitHub: [@darams4863](https://github.com/darams4863/traceloggerx)
📦 PyPI: [traceloggerx](https://pypi.org/project/traceloggerx/)
ensure-py 0.1.1
A <3kB, dependency-free toolkit to repair 'almost-JSON' text from LLMs and return a valid Python object—or raise JsonFixError.
License: MIT
Requires Python: >=3.7

# ensure-py

Repair and parse "almost-JSON" from LLMs (like GPT, Claude) into valid Python objects, or raise a clear error. Works in any Python 3.7+ environment. Zero dependencies (Pydantic optional for schema validation).

---

## Install

```bash
pip install ensure-py
```

---

## Usage

### As a Python Library

```python
from ensure_json import ensure_json, JsonFixError

try:
    obj = ensure_json('{ name: "Alice", age: 42, }')
    print(obj)  # {'name': 'Alice', 'age': 42}
except JsonFixError as err:
    print("Could not parse JSON:", err)
```

#### With Pydantic Schema (optional)

```python
from ensure_json import ensure_json
from pydantic import BaseModel

class User(BaseModel):
    name: str
    age: int

user = ensure_json('{ name: "Alice", age: 42 }', schema=User)
print(user)  # User(name='Alice', age=42)
```

### Command Line

```bash
echo '{ name: "Alice", age: 42, }' | ensure-json
# or
echo '{ name: "Alice", age: 42, }' | python -m ensure_py.cli
```

---

## Features

- Repairs and parses "almost-JSON" from LLMs (extra commas, unquoted keys, etc.)
- Returns a valid Python object or raises `JsonFixError`
- Optional Pydantic schema validation
- Minimal CLI for quick fixes
- No dependencies required (Pydantic optional)

---

## License

MIT