semvec/pypi-packages huggingface dataset:
l1m-dot-io 0.1.6
Python SDK for L1M
Requires Python: >=3.8

# L1M Python SDK

Python SDK for the [l1m API](https://l1m.io), enabling you to extract structured, typed data from text and images using LLMs.

By default, the [managed l1m](https://l1m.io) service is used, [self-hosting details are available here](https://github.com/inferablehq/l1m/blob/main/local.md).

## Installation

```bash
pip install l1m-dot-io
```

## Usage

```python
from pydantic import BaseModel
from l1m import L1M, ClientOptions, ProviderOptions

class ContactDetails(BaseModel):
  email: str
  phone: str

class UserProfile(BaseModel):
  name: str
  company: str
  contactInfo: ContactDetails


client = L1M(
  options=ClientOptions(
    #base_url: "http://localhost:10337", Optional if self-hosting l1m server
    provider=ProviderOptions(
      model="gpt-4",
      url="https://api.openai.com/v1/chat/completions",
      key="your-openai-key"
    )
  )
)

# Generate a structured response
user_profile = client.structured(
  input="John Smith was born on January 15, 1980. He works at Acme Inc. as a Senior Engineer and can be reached at john.smith@example.com or by phone at (555) 123-4567.",
  # OR   input="<BASE64_ENCODED_IMAGE>",
  schema=UserProfile,
  instruction="Extract details from the provided text.", # Optional
  options=RequestOptions(cache_ttl=100) # Optional
)
```

## Development

```bash
# Run tests
pytest
```
streamlit-vizzu 0.2.1
Bidirectional streamlit component for interacting with vizzu animations
Requires Python: >=3.7

# streamlit-vizzu

Bidirectional streamlit component for interacting with [vizzu](https://vizzuhq.com/)
animations. This package builds on the excellent
[ipyvizzu](https://github.com/vizzuhq/ipyvizzu) library and adds some streamlit-specific
code to allow you to interact with an ipyvizzu chart within a streamlit app without
the chart being redrawn on every interaction.

[![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://intro-to-vizzu-in.streamlit.app/)

## Installation instructions

```sh
pip install streamlit-vizzu
```

## Documentation

### [How to Get Started](docs/TUTORIAL.md)

### [How To Guides](docs/HOW_TO.md)

### [Streamlit-Vizzu API](docs/REFERENCE.md)

### [More about Streamlit-Vizzu(Under construction)](docs/EXPLANATION.md)
openapi-markdown 0.4.3
Generates API documentation from an OpenAPI specification file
Requires Python: >=3.7

# OpenAPI Documentation Generator

This is a Python script that generates API documentation from an OpenAPI specification file.

## Usage

`pip install openapi-markdown`

### CLI

You can use `openapi2markdown` command as follows:

```
% openapi2markdown --help                
Usage: openapi2markdown [OPTIONS] INPUT_FILE [OUTPUT_FILE]

  Convert OpenAPI spec to Markdown documentation.

  INPUT_FILE: Path to OpenAPI specification file (JSON or YAML) OUTPUT_FILE:
  Path where markdown file will be generated (optional, defaults to INPUT_FILE
  with .md extension)

Options:
  -t, --templates-dir DIRECTORY  Custom templates directory path
  -f, --filter-paths TEXT        Only generate apis that start with the given
                                 path, multiple paths are allowed
```

### Library

```python
from openapi_markdown.generator import to_markdown

apiFile = "./tests/openapi.json"
outputFile = "api_doc.md"
templatesDir = "templates"
options = {
    'filter_paths': ['/client']
}

to_markdown(apiFile, outputFile, templates_dir, options)
```

- If you want to use your own template, creates 'templates' directory and put [`api_doc_template.md.j2`](src/openapi_markdown/templates/api_doc_template.md.j2) file in it.
- You can change templates directory by passing it as the 3rd argument of `to_markdown`.

### Default templates

There are internal templates you can use. If not set default is used.

* templates - default
* templates/embed - prints objects hierarchially as list in every request/response

## Development

### Requirements

- Python 3.x
- json
- PyYAML
- openapi-core
- Jinja2

`pip install -r requirement.txt`

install a project in editble mode
`pip install -e ./`

run tests

`python -m unittest`

### Deploy

```
python3 -m pip install --upgrade twine
```

```
./pypi.sh
```
tls-regressor 0.1.2
Fast Total Least Squares regression using Rust backend
Requires Python: >=3.11

# tls_regressor

高速なTotal Least Squares (TLS)回帰実装

## 概要

`tls_regressor`はPythonでRustを利用した高速なTotal Least Squares (直交回帰)の実装を提供します。通常の最小二乗法(OLS)がy方向の誤差のみを最小化するのに対し、TLSは両方の変数の誤差を考慮します。

## インストール

```bash
pip install tls_regressor
```
fastapi-queue-task 1.0.4
FastAPI Queue
Requires Python: >=3.10

# FastAPI queue tasks

## Introduction

FastAPI Queue helps you add tasks to a queue and run them in parallel, supporting both **asynchronous** and **synchronous** task handlers.

## How to use

### 1. Instantiate the Queue

First, create an instance of the Queue class by providing a Redis instance and configuration options like concurrency and max retry attempts:

```python
# config/queue.py

from fastapi_queue_task import Queue
from redis.asyncio.utils import from_url

queue = Queue('main', redis, {'concurrency': QUEUE_MAX_CONCURRENCY, 'max_attempt': QUEUE_MAX_ATTEMP})

def queue_processing(task: Task):
  print('TASK_DETAIL')
  print('task name', task.get('name'))
  print('task data', task.get('data'))
  print('task attempt', task.get('attempt'))


def init_queue():
  if env.IS_ALLOW_RUN_QUEUE:
    queue.run(queue_processing)

```

```python
# bootstrap/app.py

@asynccontextmanager
async def lifespan(app: FastAPI):
  init_queue()
  yield

app = FastAPI(title='API', lifespan=lifespan)
```

### 2. Add task to queue:

You can add a task to the queue by calling the add_to_queue method, passing the task name and the data to be processed:

```python
# mail_service.py
from config import queue

await queue.add(name="TASK_NAME", data: Any = {})

async def track(channel_id: UUID, dto: TrackHotspotMediaViewDto):
    return await queue.add(
      TrackViewTaskEnum.POST,
      {
        'post_id': dto.post_id
      },
    )
```

### 3. Define a Task Handler

Define the task handler using the @task decorator. The handler will process the task asynchronously or synchronously based on its definition:

```python
# tasks/track_view.py

from fastapi_queue_task import BaseTask, task

@task(TrackViewTaskEnum.POST)
class TrackViewPostTask(BaseTask):
  def __init__(self, track_post_view_service: TrackPostViewService = Depends()):
    self.track_post_view_service = track_post_view_service

  async def handler(self, data: TrackPostViewDataType):
    await self.track_post_view_service.handle_tracking(data)
```

In this example, the task TrackViewPostTask is added to the queue, and the handler method will process the task asynchronously.
tqdm-prometheus-exporter 0.1.15
Echo tqdm progress to a prometheus endpoint
Requires Python: >=3.8

# Prometheus exporter for tqdm

Publish your pretty CLI stats for monitoring elsewhere

## Usage

There are no security or authentication mechanisms provided, be careful exposing the host more widely

### Initalise the proxy

```python
proxy = TqdmPromProxy(http_host='[::1]', http_port=3000, metric_func=metric_formatter_func)
proxy.start()
```

### Use the proxy

Replace `tqdm` initalisers with `proxy.tqdm`.

```python
for item in proxy.tqdm(range(100), desc='My first bar')
    item.doathing()

with proxy.tqdm(range(100), desc='My second bar') as f:
    f.update(50)

# etc
```

### Formatting your content

TQDM bars are a lot more verbose than prometheus metrics.
You can customise their names by passing in a function with this signature.

```python
def metric_formatter_func(metric_name: str, metric_property: str, metric_scale: str) -> str:
    pass
```

`metric_property` is one of:

- `completed` the number executions thus far in TQDM;
- `total` the configured expected maximum in TQDM as `tqdm(total=x)`;
- `active` based on the naming, how many current bars are being grouped together as this name
- `finished` based on the naming, how many bars with this name have been completely finished

The `str` that is returned must adhere to the metric naming conventions (A-Za-z0-9\_) outlined in the prometheus docs [https://prometheus.io/docs/practices/naming/](https://prometheus.io/docs/practices/naming/)

This function is called a lot, so avoid computation or cache your values

Additionally to control which properties are aggregated, provide a `bucket_func`:
This example will aggregate all bars with a description starting with upload together

```python
def bucketting_func(snapshot: TqdmSnapshot):
    if snapshot.desc.lowercase().startswith('upload'):
        return "Upload"

    return snapshot.desc
```

If you require `tqdm.write` for sticky console output,

```python
from tqdm import tqdm as tqdm_og
tqdm_og.write('Job done')
```

```sh
curl http://[::1]:3000/metrics
```

> [!WARNING]  
> For windows users ensure you add this to your `__main__` block, and before any initialisation of `TqdmPrometheusProxy`
>
> ```python
> from multiprocessing import freeze_support
> freeze_support()
> ```

## Overview

```mermaid

---
Conceptual Overview
---
flowchart LR

    Queue@{ shape: das, label: "Update buffer" }
    TQDM@{ shape: process, label: "(your) faux TQDM instance"}
    Bucketting@{ shape: process, label: "Metric extraction & aggregation"}

    TQDM -- "Periodic Updates" --> Queue
    Queue --> Bucketting
    Bucketting -- "Expose aggregate metrics" --> HttpServer

```