Metadata-Version: 2.5
Name: pyrule
Version: 0.0.3
Summary: Order-preserving, type-aware deduplication for mixed lists.
Project-URL: Homepage, https://pypi.org/project/pyrule/
Author-email: lqxnjk <lqxnjk@qq.com>
License: MIT
License-File: LICENSE
Keywords: dedupe,hashable,list,records,unique
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# pyrule

[English](#english) | 中文

保序且区分类型的列表去重。

## 安装

```console
pip install pyrule
```

## 用法

```python
from pyrule import dedupe, dedupe_key

dedupe(["b", "a", "b"])                  # ['b', 'a']
dedupe([1, 1.0, True])                   # [1, 1.0, True]
dedupe([{"a": 1}, {"a": 1}, {"a": 2}])   # two dicts kept
dedupe_key(1), dedupe_key(1.0)           # ('int', '1'), ('float', '1.0')
```

## 说明

标量按 `(类型名, 值)` 判重，所以 `1`、`1.0`、`True` 保持三条——从 CSV / JSON / 数据库出来的就是这样；其余类型按规范化 JSON 判重，字段顺序不同视为同一条。

## 许可证

MIT

---

<a id="english"></a>
## English

Order-preserving, type-aware deduplication for mixed lists.

## Install

```console
pip install pyrule
```

## Usage

```python
from pyrule import dedupe, dedupe_key

dedupe(["b", "a", "b"])                  # ['b', 'a']
dedupe([1, 1.0, True])                   # [1, 1.0, True]
dedupe([{"a": 1}, {"a": 1}, {"a": 2}])   # two dicts kept
dedupe_key(1), dedupe_key(1.0)           # ('int', '1'), ('float', '1.0')
```

## Notes

Scalars are keyed by `(type name, repr)` so `1`, `1.0` and `True` stay distinct — that is how they arrive from CSV, JSON and SQL. Other values are keyed by canonical JSON, so key order does not matter.

## License

MIT
