Metadata-Version: 2.4
Name: koruspy
Version: 0.2.5.4
Summary: Uma biblioteca inspirada em Rust e Kotlin para lidar com Option, println colorido e utilitários.
Author-email: Leonardo <leoGitKotDev@gmail.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown


🦀 Koruspy

Koruspy é uma biblioteca ultra-leve que traz a segurança do Rust e a elegância do Kotlin para o ecossistema Python.

Desenvolvida inteiramente via Termux, esta biblioteca elimina a necessidade de verificações manuais de None e blocos try/except repetitivos, utilizando o poder do Pattern Matching (Python 3.10+) e programação funcional.


---

🚀 Diferenciais

Zero NoneErrors: Use Option (Some ou nothing) para lidar com valores ausentes.

Result Pattern: Trate sucessos e falhas como dados, não como exceções que quebram o código.

Estilo Kotlin: Métodos encadeáveis como .map(), .Filter(), .and_then() e o operador de navegação segura .getattr().

Pipeline seguro: option_of agora trata corretamente None e nothing, preservando valores falsy como 0 e False.

Finalização clara: .finalize() encerra pipelines que já têm valor garantido.

Fallback elegante: .unwrap_or(default) e .unwrap_or_else(func) fornecem valores quando necessário.

Terminal Colorido: Substitua o print padrão pelo println com suporte a tipos e cores ANSI.



---

📦 Instalação

Como você está desenvolvendo no Termux ou em ambiente mobile, instale via modo editável:

pip install -e .


---

📝 Exemplos 2.3
option_of trata None e nothing, preservando falsy
```python
from koruspy import Some, nothing, option_of, println


idade = option_of(0, 18)
println(idade)  # Some(0)

idade2 = option_of(None, 18)
println(idade2)  # Some(18)
```
---
# Pipeline com Filter e finalize
```python
idade_valida = (
    option_of(idade2.get_value(), 0)
    .Filter(lambda x: x >= 18)
    .on_nothing(lambda: println("valor inválido"))
    .finalize()
)
println(idade_valida)
```
---
# Fallbacks
```python
val = option_of(None).unwrap_or(42)
println(val)  # 42

val2 = option_of(None).unwrap_or_else(lambda: 99)
println(val2)  # 99
```

## English Version 🇺🇸🇬🇧:

🦀 Koruspy

Koruspy is an ultra-lightweight library that brings Rust’s safety and Kotlin’s elegance to the Python ecosystem.

Developed entirely via Termux, this library removes the need for manual None checks and repetitive try/except blocks by leveraging the power of Pattern Matching (Python 3.10+) and functional programming.


---

🚀 Highlights

Zero NoneErrors: Use Option (Some or nothing) to safely handle missing values.

Result Pattern: Handle success and failure as data, not as exceptions that break control flow.

Kotlin-style API: Chainable methods like .map(), .Filter(), .and_then(), and the safe navigation operator .getattr().

Safe pipeline: option_of now correctly handles None and nothing, while preserving falsy values such as 0 and False.

Clear finalization: .finalize() terminates pipelines when a value is guaranteed.

Elegant fallbacks: .unwrap_or(default) and .unwrap_or_else(func) provide values when needed.

Colored terminal output: Replace the standard print with println, with type-aware ANSI color support.



---

📦 Installation

If you are developing on Termux or in a mobile environment, install using editable mode:

pip install -e .


---

📝 Examples 2.3
option_of handles None and nothing, preserving falsy values
```python
from koruspy import Some, nothing, option_of, println


age = option_of(0, 18)
println(age)  # Some(0)

age2 = option_of(None, 18)
println(age2)  # Some(18)
```

---

Pipeline with Filter and finalize
```python
valid_age = (
    option_of(age2.get_value(), 0)
    .Filter(lambda x: x >= 18)
    .on_nothing(lambda: println("invalid value"))
    .finalize()
)
println(valid_age)
```

---

Fallbacks

```python
val = option_of(None).unwrap_or(42)
println(val)  # 42

val2 = option_of(None).unwrap_or_else(lambda: 99)
println(val2)  # 99
```
