Metadata-Version: 2.4
Name: cl-forge
Version: 1.0.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python
Classifier: Programming Language :: Rust
Classifier: Typing :: Typed
Classifier: Topic :: Utilities
Classifier: Topic :: Software Development :: Libraries
Requires-Dist: orjson>=3.11.7
Requires-Dist: pydantic>=2.12.5
Requires-Dist: cl-forge[interop] ; extra == 'all'
Requires-Dist: cl-forge[excel] ; extra == 'all'
Requires-Dist: cl-forge[notebook] ; extra == 'all'
Requires-Dist: cl-forge[polars] ; extra == 'analytics'
Requires-Dist: cl-forge[calamine] ; extra == 'analytics'
Requires-Dist: cl-forge[xlsxwriter] ; extra == 'analytics'
Requires-Dist: fastexcel>=0.19.0 ; extra == 'calamine'
Requires-Dist: cl-forge[calamine] ; extra == 'excel'
Requires-Dist: cl-forge[xlsxwriter] ; extra == 'excel'
Requires-Dist: cl-forge[openpyxl] ; extra == 'excel'
Requires-Dist: cl-forge[polars] ; extra == 'interop'
Requires-Dist: cl-forge[pandas] ; extra == 'interop'
Requires-Dist: ipykernel>=7.1.0 ; extra == 'notebook'
Requires-Dist: ipywidgets>=8.1.8 ; extra == 'notebook'
Requires-Dist: notebook>=7.5.3 ; extra == 'notebook'
Requires-Dist: openpyxl>=3.1.5 ; extra == 'openpyxl'
Requires-Dist: cl-forge[pyarrow] ; extra == 'pandas'
Requires-Dist: pandas-stubs>=3.0.0.260204 ; extra == 'pandas'
Requires-Dist: pandas[performance]>=3.0.0 ; extra == 'pandas'
Requires-Dist: cl-forge[pyarrow] ; extra == 'polars'
Requires-Dist: polars>=1.38.0 ; extra == 'polars'
Requires-Dist: pyarrow>=23.0.0 ; extra == 'pyarrow'
Requires-Dist: xlsxwriter>=3.2.9 ; extra == 'xlsxwriter'
Provides-Extra: all
Provides-Extra: analytics
Provides-Extra: calamine
Provides-Extra: excel
Provides-Extra: interop
Provides-Extra: notebook
Provides-Extra: openpyxl
Provides-Extra: pandas
Provides-Extra: polars
Provides-Extra: pyarrow
Provides-Extra: xlsxwriter
License-File: LICENSE
Summary: Simple yet powerful Chilean and other tools written in Rust and Python.
Keywords: chile,cl,utils,tools,rut,run,validators,api,python,rust
Author-email: Matías Schiaffino Tyrer <matias.scht@gmail.com>
Requires-Python: >=3.12
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://mschiaff.github.io/cl-forge/
Project-URL: Homepage, https://mschiaff.github.io/cl-forge/
Project-URL: Issues, https://github.com/mschiaff/cl-forge/issues
Project-URL: Repository, https://github.com/mschiaff/cl-forge.git

# Welcome to CL Forge!

<img style="border-radius: 25px;" alt="banner" src="docs/assets/banner.png"/>

<h2 style="text-align: center;">
   Simple yet powerful Chilean tools written in Rust and Python.
</h2>

<br>

<div align="center" style="text-align: center; text-decoration: none;">
   <a href="https://pypi.org/project/cl-forge/" style="text-decoration: none;">
      <img src="https://img.shields.io/pypi/v/cl-forge.svg" alt="pypi">
   </a>
   <a href="https://mschiaff.github.io/cl-forge/" style="text-decoration: none;">
      <img src="https://img.shields.io/badge/Pages-Docs-blue?logo=github" alt="docs">
   </a>

   <br>

   <a href="https://github.com/mschiaff/cl-forge/actions/workflows/python-package.yml" style="text-decoration: none;">
      <img src="https://github.com/mschiaff/cl-forge/actions/workflows/python-package.yml/badge.svg?branch=main" alt="python package">
   </a>
   <a href="https://github.com/mschiaff/cl-forge/actions/workflows/release-python.yml" style="text-decoration: none;">
      <img src="https://github.com/mschiaff/cl-forge/actions/workflows/release-python.yml/badge.svg" alt="python release">
   </a>
   <a href="https://github.com/mschiaff/cl-forge/actions/workflows/pages/pages-build-deployment" style="text-decoration: none;">
      <img src="https://github.com/mschiaff/cl-forge/actions/workflows/pages/pages-build-deployment/badge.svg?branch=gh-pages" alt="pages build deployment">
   </a>
</div>

<br>

`cl-forge` provides a collection of high-performance utilities for common Chilean data formats and API integrations. The core logic is implemented in Rust for maximum speed, with a clean and easy-to-use Python interface.

## Features

- **High Performance**: Core logic written in Rust.
- **Verify**: Efficiently validate Chilean RUT/RUN and PPU (License Plates).
- **API Integrations**: Simple clients to interact with the [CMF](https://api.cmfchile.cl) and [Public Market](https://api.mercadopublico.cl) APIs.
- **Type Safety**: Full type hints and `.pyi` stubs for excellent IDE support.

## Examples

### Validate

You can validate if a verifier digit is correct for a given numeric part of a RUT/RUN.

```python
from cl_forge import verify

is_valid = verify.validate_rut(8750720, "3")

print(f"RUT is valid: {is_valid}")
# RUT is valid: True
```

... Or you can calculate the verifier digit yourself.

```python
from cl_forge import verify

dv = verify.calculate_verifier(8750720)

print(f"Verifier digit: {dv}")
# Verifier digit: 3
```

### Generate

Need to generate a bunch of random, unique and valid RUTs? No problem! And you can even specify a random seed, so you can reproduce the same results every time.

```python
from cl_forge import verify

ruts = verify.generate(
   n=100,
   min=1_000_000,
   max=20_000_000,
   seed=42
)

print(ruts)
# [{'correlative': 8750720, 'verifier': '3'}, ...]
```

### API Clients

The CMF API client allows you to easily interact with the [CMF](https://api.cmfchile.cl) API.

```python
from cl_forge.cmf import CmfClient

client = CmfClient(api_key="your-api-key")

# Get latest IPC data
ipc_data = client.get(path="/ipc")

print(ipc_data)
# {'IPCs': [{'Valor': '-0,2', 'Fecha': '2025-12-01'}]}
```

> [!NOTE]
> To use the CMF API, you need an API key. You can request one at [CMF Chile](https://api.cmfchile.cl/api_cmf/contactanos.jsp).

See the [CMF API documentation](https://api.cmfchile.cl/documentacion/index.html) for details about the available endpoints.

## Contributing

Pull requests are welcome. For changes and reporting bugs, please open an issue first to discuss it. Read our [Contributing Guide](CONTRIBUTING.md) for more details.

## License

This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
