Metadata-Version: 2.5
Name: fyrefly
Version: 0.12.0
Summary: A lightweight Python library to run SQL on databases & compute quant based mathematical operations.
Project-URL: Homepage, https://github.com/Ninad077/fyrefly
Project-URL: Repository, https://github.com/Ninad077/fyrefly
Project-URL: Documentation, https://ninad077.github.io/fyrefly/
Author-email: Ninad Mandavkar <ninadmandavkar28@gmail.com>
License: MIT
License-File: LICENSE
Keywords: ai,api,arithmetic,electromagnetism,fluids,http,math,mechanics,nuclear,pandas,physics,postman,quant,quantum,relativity,rest,sql,testing,thermodynamics,units,utility,visualization
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.9
Requires-Dist: duckdb
Requires-Dist: matplotlib
Requires-Dist: numpy
Requires-Dist: openpyxl
Requires-Dist: pandas
Requires-Dist: requests
Requires-Dist: seaborn
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# Fyrefly
A lightweight Python library to run SQL on databases & compute quant based mathematical operations.

📖 **[Full documentation](https://ninad077.github.io/fyrefly/)**: every function, with its formula, what each argument means, and what it returns.

```bash
pip install fyrefly
```

## A quick tour

```python
from fyrefly import *

# Math and quant
add(5, 4, 6, 10)                  # 25
ci(1000, 2, 10)                   # 210.0   compound interest
circle.area(7)                    # 153.94
eqn.q(1, 3, 4)                    # roots of x² + 3x + 4
sin(30)                           # 0.5     degrees by default
convert(10, "km", "miles")        # 6.2137

# Data, SQL, Excel-style lookups
c = load("data.csv")              # CSV, Excel, or a shared Google Sheet
d = sql("select * from c where age > 30")
vlook("Alice", "salary")          # like Excel's VLOOKUP
viz(c, "department", "salary")    # 12+ chart types, no API key

# AI (needs an API key; the provider is detected from the key)
ask(c, "total sales by region?", api_key="...")

# Test an API in a Postman-style window
api.gui()

# Physics, all in SI units
projectile.range(20, 45)                 # 40.77 m
circuit.ohm(V=12, R=4)                   # 3.0 A
lorentz.time_dilation(1, lorentz.speed(0.8))   # 1.667 s
nucleus.semf_binding(26, 56)             # 495 MeV
```

Never commit an API key. Set `GEMINI_API_KEY`, `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` as an environment variable instead.

## What's inside

| Area | Functions |
|---|---|
| **Math and quant** | `add mul div mod diff`, `si ci profit loss`, `ap gp hp`, `avg mode median`, `hyp slope dist` |
| **Mensuration** | 14 2D shapes and 10 3D shapes: `circle`, `cube`, `cylinder`, `cone`, `sphere`, ... |
| **Algebra and trig** | `eqn.l eqn.q`, `log exp sqrt curt nroot`, `sin cos tan cosec sec cot` |
| **Units and types** | `convert`, `cast`, `round` (round-half-up, like Excel) |
| **Data and SQL** | `load loadh loadc loads clean sql xtract` |
| **Excel lookups** | `vlook xlook countif sumif avgif` |
| **AI** | `ask`, `insights` |
| **Charts** | `viz` and `viz.bar .scatter .line .box .hist .pie .heatmap ...` |
| **API testing** | `api.gui()`: requests, collections, environments, secrets, Postman import/export |

### Physics

Every physics function shows its formula in the docs. Angles are in degrees unless you pass `mode="rad"`.

| Domain | Namespaces |
|---|---|
| Classical mechanics | `newton motion projectile gravity energy momentum circular friction inertia rotation shm damping orbit pulley fluid elasticity` |
| Quantum and atomic | `constants photon matter bohr box qho tunnel nuclear xray` |
| Thermodynamics | `gas heat entropy engine stat` |
| Fluid mechanics | `pipe drag surface hydro channel` |
| Electricity and magnetism | `charge capacitor circuit magnet induction ac emwave` |
| Relativity | `lorentz relmech doppler gr` |
| Nuclear and particle | `nucleus radiation reactor fusion particle` |

## Development

```bash
pip install -e ".[dev]"
pytest
```

## License

MIT