semvec/pypi-packages huggingface dataset:
drf-pydantic-openapi 0.6.4
OpenAPI (v3) schema generation via Pydantic models using Django REST Framework.
Requires Python: <4.0,>=3.10

Generate OpenAPI schema with DRF code using pydantic models. Supports referencing other service's components.

# Usage

# Add urls to the project

```python
 urlpatters = [
    path("openapi/", include("drf_pydantic_openapi.urls")),
 ]
 ```

 - Available endpoints
    - `/schema.json`
    - `/docs`
    - `/redoc`

# Reference OpenAPI source

Add the following setting to your projects `settings.py`. This will allow the module to access to the other OpenAPI components defined in seperate projects.
```python
# settings.py

DRF_PYDANTIC_OPENAPI = {
    "REF_SOURCES": {
        "service_B": "http://localhost:8000/openapi",
        "service_C": "http://localhost:8001/openapi",
    }
}
```

# Using a component defined in another service

```python
# views.py
from drf_pydantic_openapi.ref_utils import RefType

BookModel = RefType("service_B", "BookModel")

class BookView(ApiView):
    def get(self, request) -> BookModel:
        ...

# More complex example

class CustomBookModel(RefType("service_B", "BookModel")):
    # add new field
    read_count: int

    class Config:
        # Remove field from referenced type
        ref_exclude = ("author",)
        # Rename field
        ref_rename = (("book_name", "name"),)

class PaginatedBookModel(BaseModel):
    total: int
    next: str
    prev: str
    data: list[CustomBookModel]

class BookView(ApiView):
    def get(self, request) -> PaginatedBookModel:
        ...
```

# Using the `@docs`

- Parameters
    - body: Request body model
    - errors: List of error models
    - query: Query model
    - path: Api path parameter model

```python
from pydantic import BaseModel
from drf_pydantic_openapi.errors import BadRequestError, NotFoundError

class RetrieveQuery(BaseModel):
    book_id: str

class Path(BaseModel):
    book_id: str = Field(description="Book id to retrieve")


class BookView(ApiView):
    @docs(errors=[NotFoundError], query=RetrieveQuery, path=Path)
    def get(self, request):
        ...
...
```

# Typed exception handler

Assign the `typed_exception_handler` to rest framework. This will catch any ValidationError and the custom HttpError and return the response as json.
```python
# settings.py

REST_FRAMEWORK = {
    "EXCEPTION_HANDLER": "drf_pydantic_openapi.exception_handler.typed_exception_handler"
}


```


```python
# Example
from drf_pydantic_openapi.errors import BadRequestError
class SomeView(ApiView):
    @docs(errors=[BadRequestError])
    def post(self, request):
        raise BadRequestError()

```

###  Response
```json
{
	"detail": {
		"message": "Bad request"
	}
}
```
umipy 2.2.2
api wrapper for umi.top crypto
Requires Python: ~=3.12
Keywords: api, crypto, umi, wrapper

# UMIPY
[![codecov](https://codecov.io/github/kesha1225/PyUmi/graph/badge.svg?token=PZ12EHSKAH)](https://codecov.io/github/kesha1225/PyUmi)

Interaction with umi blockchain


### Install

for stable version

`pip install umipy`

for dev version

`pip install https://github.com/RoyFractal/PyUmi/archive/master.zip` 


### Usage

You can find more examples - [examples/](examples/)

#### simple getting a address data

```python3
import asyncio
import aiohttp

from umipy import UmiPy


async def main():
    umi = UmiPy(session=aiohttp.ClientSession())
    balance = await umi.get_balance(
        "umi17ymaed9h9hq7s5pc2f5fhmlzpmsk3qtc6g2cgm360zysz0uvq44qnxlsuz"
    )
    print(balance)

    trans = await umi.get_transactions(
        "umi17ymaed9h9hq7s5pc2f5fhmlzpmsk3qtc6g2cgm360zysz0uvq44qnxlsuz"
    )
    print(trans)

    await umi.close()


asyncio.run(main())
```
simple-pbar 0.1.1
A simple progress bar
Requires Python: >=3.6

# Simple Progress Bar

> Simplicity is the ultimate sophistication.
> 
> —— Leonardo da Vinci

A simple and elegant progress bar library for Python, built on top of Rich.

## Installation

```bash
pip install simple-pbar
```

## Usage

### Basic Usage

```python
from simple_pbar import simple_pbar, SimpleTask
import time

with simple_pbar(
    SimpleTask(desc="Time consuming task", total=5),
) as pbar:
    for i in range(5):
        time.sleep(1)
        pbar.go()
```

![Basic Usage](https://github.com/00INDEX/simple_pbar/raw/main/pics/basic_usage.gif)

### Multiple Tasks

```python
from simple_pbar import simple_pbar, SimpleTask
import time

with simple_pbar(
    SimpleTask(name="epoch", desc="Epoch Iteration", total=5),
    SimpleTask(name="batch", desc="Batch Iteration", total=5),
) as pbar:
    for i in range(5):
        for j in range(5):
            time.sleep(1)
            pbar.go(name="batch", advance=1)
        pbar.go(name="epoch", advance=1)
        pbar.reset(name="batch")
```

![Multiple Tasks](https://github.com/00INDEX/simple_pbar/raw/main/pics/multiple_tasks.gif)

### Customize Columns

```python
from simple_pbar import simple_pbar, SimpleTask, SimpleColumn
import time

with simple_pbar(
    SimpleTask(name="epoch", desc="Epoch Iteration", total=5),
    SimpleTask(name="batch", desc="Batch Iteration", total=5),
    columns=[
        SimpleColumn(name="current", desc="Current Index"),
    ]
) as pbar:
    for i in range(5):
        pbar.update_column(name="epoch", column_name="current", value=i)
        for j in range(5):
            pbar.update_column(name="batch", column_name="current", value=j)
            time.sleep(1)
            pbar.go(name="batch", advance=1)
        pbar.go(name="epoch", advance=1)
        pbar.reset(name="batch")
```

![Customize Columns](https://github.com/00INDEX/simple_pbar/raw/main/pics/customize_columns.gif)

### Log

```python
from simple_pbar import simple_pbar, SimpleTask
import time

with simple_pbar(
    SimpleTask(desc="Time consuming task", total=5),
) as pbar:
    for i in range(5):
        pbar.log(f"Iteration {i} started")
        time.sleep(1)
        pbar.go()
```

![Log](https://github.com/00INDEX/simple_pbar/raw/main/pics/log.gif)