semvec/pypi-packages huggingface dataset:
kuromon 0.2.0
Convert a list of dict, dataclass, Pydantic or POPO objects into a string represented table
Requires Python: >=3.7,<4.0

# kuromon

[![PyPI version](https://badge.fury.io/py/kuromon.svg)](https://badge.fury.io/py/kuromon)
[![Python CI](https://github.com/ninoseki/kuromon/actions/workflows/test.yml/badge.svg)](https://github.com/ninoseki/kuromon/actions/workflows/test.yml)

Convert a list of dict, dataclass, Pydantic or POPO objects into a string represented table.

## Requirements

- Python 3.7+

## Installation

```bash
pip install kuromon
# or if you want to use Pydantic along with kuromon
pip install kuromon[pydantic]
```

## Usage

```py
from kuromon import to_table

dict_data = [
    {"id": 1, "name": "foo", "tags": None},
    {"id": 2, "name": "bar", "tags": ["a"]},
]
print(to_table(dict_data))
# |    |   id | name   | tags   |
# |----|------|--------|--------|
# |  0 |    1 | foo    |        |
# |  1 |    2 | bar    | ['a']  |

# Disable indexing by setting index=False
print(to_table(dict_data, index=False))
# |   id | name   | tags   |
# |------|--------|--------|
# |    1 | foo    |        |
# |    2 | bar    | ['a']  |

# Change the table format via tablefmt
# NOTE: You can use the following tabulate formats
#       https://github.com/astanin/python-tabulate#table-format
print(to_table(dict_data, tablefmt="plain"))
# 0     1  foo
# 1     2  bar     ['a']
```

The above example uses a list of dict objects. You can also use a list of dataclass or Pydantic objects.

```py
from dataclasses import dataclass
from typing import List, Optional

from dacite import from_dict
from pydantic import BaseModel

from kuromon import to_table


class TestModel(BaseModel):
    id: int
    name: str
    tags: Optional[List[str]]


@dataclass
class TestDataClass:
    id: int
    name: str
    tags: Optional[List[str]]


dict_data = [
    {"id": 1, "name": "foo", "tags": None},
    {"id": 2, "name": "bar", "tags": ["a"]},
]
pydantic_data = [TestModel.parse_obj(obj) for obj in dict_data]
dataclass_data = [from_dict(data_class=TestDataClass, data=obj) for obj in dict_data]

print(to_table(pydantic_data))
print(to_table(dataclass_data))
```
explainable-transformer 0.2.0
Software for debugging transformers
Requires Python: >=3.7

# Explainable Transformers

Install by running following command:

```
pip install explainable-transformers==0.2.0
```

## Usage

```
from explainable_transformers.text_classification import TextClassificationExplainer

model_path = "cardiffnlp/twitter-roberta-base-sentiment-latest"
explainer = TextClassificationExplainer(model_path=model_path)

inp = ["I like you. I love you."]
shap_values = explainer.get_shap_values(inp)

print(shap_values.base_values)
print(shap_values.values)
```

## Future Scope:

-   Want to give an option to enter either a single example or an entire dataset!

    For single example:

    -   Output is for local
    -   Text Plot is enough

    Entire Dataset:
    _ Reason: To explain model outputs on a global scale
    _ Output:

    1.  A plot for global values (Required): Waterfall Plot!
    2.  Download option for shap values of dataset

-   Support for multiple model types and NLP tasks!
asynchrony 0.2.0
Collection of utilities to write safe asyncio code.
Requires Python: >=3.8
Keywords: async,asyncio,aiohttp,framework

# asynchrony

Python [asyncio](https://docs.python.org/3/library/asyncio.html) framework for writing safe and fast concurrent code.

Features:

+ Type annotated and type safe
+ Makes it easy to work with cancellation, errors, and scheduling.
+ Well tested and well documented.
+ Zero dependency.
+ Based on real world experience and pain.

## Installation and usage

```bash
python3 -m pip install asynchrony
```

A simple example of starting concurrent tasks for all URLs (maximum 100 tasks at the same time) and waiting for all of them to finish:

```python
from asynchrony import Tasks

async def download_page(url: str) -> bytes:
    ...

urls = [...]
tasks = Tasks[bytes](timeout=10, max_concurrency=100)
tasks.map(urls, download_page)

try:
    pages = await tasks
except Exception:
    failed = sum(t.failed for t in tasks)
    print(f'{failed} tasks failed')
    cancelled = sum(t.cancelled for t in tasks)
    print(f'{cancelled} tasks cancelled')
else:
    print(f'finished {len(tasks)} tasks')
```

See [tutorial](./tutorial) for runnable usage examples.