semvec/pypi-packages huggingface dataset:
typedjson 0.10.4
JSON decoding for Python with type hinting (PEP 484)
License: MIT
Requires Python: >=3.6,<4.0

# typedjson

[![License][license-badge]][license]
[![Pypi][pypi-badge]][pypi]
[![CI][ci-badge]][ci]

JSON decoding for Python with type hinting (PEP 484).


## Requirements and Restrictions

- Python >= 3.6
- Mypy <= 0.770
- Use non-generic or parameterized class to decode JSON.
- Use type hints without forward references.


## Features

- Support decoding types as below:
    - primitive types like `str`, `int`, `float`, `bool` and `None`.
    - `Union` and `Optional`.
    - homogeneous and heterogeneous `Tuple` and `List`.
    - variable-length `Tuple`.
    - non-generic and parameterized dataclasses.
- Support API like `json.load` and `json.loads`.


## Example


```python
from typing import Optional

import typedjson
from dataclasses import dataclass


@dataclass(frozen=True)
class NameJson:
    first: str
    last: Optional[str]


@dataclass(frozen=True)
class CatJson:
    id: str
    age: int
    name: Optional[NameJson]


json = {
    'id': 'test-cat',
    'age': 13,
    'name': {
        'first': 'Jiji',
    },
}

print(typedjson.decode(CatJson, json))  # Output: CatJson(id='test-cat', age=13, name=NameJson(first='Jiji', last=None))

print(typedjson.decode(CatJson, {}))  # Output: DecodingError(TypeMismatch(('id',)))
```

Please refer to [test codes](/tests/) for more detail.


## Contributions

Please read [CONTRIBUTING.md](/CONTRIBUTING.md).


## TODO

- Prohibit decoding `Set` and `Dict` explicitly.
- Provide the API document.
- Explain why typedjson uses undocumented APIs.
- Explain what typedjson resolves.
- Improve API to dump like `json.dump` and `json.dumps`.
    - Provide mypy plugin to check whether the class is encodable as JSON or not with `@typedjson.encodable` decorator.
- Improve the peformance of `typedjson.decode`.
- Support type hints with forward reference.
- Support `TypedDict`.


[license-badge]: https://img.shields.io/badge/license-MIT-yellowgreen.svg?style=flat-square
[license]: LICENSE
[pypi-badge]: https://img.shields.io/pypi/v/typedjson.svg?style=flat-square
[pypi]: https://pypi.org/project/typedjson/
[ci-badge]: https://img.shields.io/travis/mitsuse/typedjson-python/master.svg?style=flat-square
[ci]: https://travis-ci.org/mitsuse/typedjson-python
[pep-563]: https://www.python.org/dev/peps/pep-0563/
korsubset 0.1.2
An easy font subsetting tool for Korean fonts.
License: MIT
Keywords: font,Korean,Hangul,subset

# KorSubset

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

An easy font subsetting tool for Korean fonts.

## Overview

Korean fonts usually take massive size because it needs about 17,388 glyphs to display them. Therefore, Korean web developers used to make subsets for reducing loading times. KS X 1001 subset is the most popular subset of Korean, only supporting 2,350 glyphs, so it cannot cover all usages. Also, the subset cannot be used for some areas that can take users' input.

In 2018, Google released [Google Fonts + Korean](https://googlefonts.github.io/korean/) project to solve the problems. It generates Korean font subsets into 120 groups via machine learning. It uses the `unicode-range` property of CSS to download subsets on-demand, reduce loading times. However, there is a limitation that developers only allowed to use fonts provided by Google.

This project generates Korean font subsets and a CSS file similar to Google Fonts + Korean project's ones. It also converts given font to .woff and .woff2 extension to reduce the size and the user can fully control CSS's font properties via arguments.

## Installation

```shell
pip install korsubset
```

## Usage

```shell
korsubset {font_name}
```

### Example

```shell
korsubset my_font.otf --output-dir=./my_font/ --font-url=/my_font/
```

### Options

| Name             | Description                                     | Default                     |
| ---------------- | ----------------------------------------------- | --------------------------- |
| `-h`, `--help`   | Display help                                    |                             |
| `-q`, `--quiet`  | Do not print log messages                       |                             |
| `--output-dir=`  | A directory that subsets should be generated    | `./output/`                 |
| `--noexport-css` | Do not make CSS file with this flag             |                             |
| `--font-url=`    | A path for `src` properties of the CSS file     | `/`                         |
| `--family=`      | A value for `family` properties of the CSS file | The family of the font file |
| `--style=`       | A value for `style` properties of the CSS file  | The style of the font file  |
| `--weight=`      | A value for `weight` properties of the CSS file | `400`                       |
| `--format=`      | Output formats. `woff`, `woff2` or `woff,woff2` | `woff2`                     |

## Note

This script transforms fonts to generate subsets. Please check the fonts' license before use. Also, this script includes Unicode ranges for general Korean fonts. Ligatures, emojis, and Chinese characters may not be included in output files.

## TODO

- [ ] Add testing.
- [ ] Supports .woff and .woff2 inputs.
- [ ] ~~Supports .eot, .ttf, or .otf outputs.~~
- [ ] Supports all CSS `@font-face` properties.