Metadata-Version: 2.4
Name: pycells_mds
Version: 0.2.9
Summary: Multidimensional Data Structures for Python.
Author-email: Zhandos Mambetali <zhandos.mambetali@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Zhandos Mambetali
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://pycells.com
Project-URL: Issues, https://pycells.com/issues
Project-URL: Contact, https://wa.me/77014577360
Keywords: database,multidimensional,data structures,sqlalchemy,pycells
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
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: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sqlalchemy
Requires-Dist: numpy
Requires-Dist: redis
Requires-Dist: fastapi
Requires-Dist: uvicorn
Requires-Dist: typer
Dynamic: license-file

[![PyCells](PyCells_mds.png)](https://pycells.com)



# pycells_mds

**Multidimensional Data Structures for Python**

[Homepage](https://pycells.com) • [Issues](https://pycells.com/issues)

---

## 🔍 Overview

PyCells is a library for working with spreadsheet-like data structures similar to Excel or Google Sheets, but fully implemented inside Python.

- It supports:

- tables and sheets

- formula-based cells

- ranges (A1:A10)

- functions (SUM, IF, UPPER, DATE, ETEXT, and more)

- cell groups

- automatic recalculation

- cursors (Redis + SQL)

- NumPy for range operations 

---

## 🛠 Installation

```bash
pip install pycells_mds
```
## Requirements
Python 3.9+

SQLAlchemy

NumPy

Redis (optional, used for CursorManager)

## 🚀 Quick Start
### 1) Initialize database

```bash
from pycells_mds.session import init_db

from pycells_mds.core import PyCells

db = init_db({
    "engine": "sqlite",
    "path": "my_cells.db"
})

pc = PyCells()

print("Database connected.")
```


### 2) Register user

```bash
user = pc.safe_register_user("user1", "pw123", "user1@example.com")

user_id = user.id
```

### 3) Create table and sheet

```bash
tbl = pc.ctable("Finance", user_id)

sheet = pc.get_or_create_list("Finance", "Main", user_id)
```

### 4) Work with cells

```bash
pc.write("Finance", "Main", "A1", "10", user_id)
pc.write("Finance", "Main", "A2", "20", user_id)
pc.write("Finance", "Main", "A3", "=A1+A2", user_id)

print(pc.read("Finance", "Main", "A3", user_id))
# → 30.0
```

## 🔢 Formulas
### Supported operators:

 (+), (-), (*), (/), (^)

### ranges: A1:A10

## Functions:

* SUM, MAX, MIN, AVERAGE
* ABS, ROUND, POWER
* INT, VALUE
* UPPER, LOWER, CONCAT, TEXTJOIN
* IF
* TODAY, NOW, DATE, YEAR, MONTH, DAY
* ETEXT — formatting numbers and dates
* np — NumPy access

## Examples:

```bash
pc.write("Finance", "Main", "B1", "=SUM(A1:A10)", user_id)

pc.write("Finance", "Main", "B2", "=A1^A2", user_id)
```

## 🎯 Groups

```bash
sheet = pc.get_or_create_list("Finance", "Main", user_id)

sheet.add_group("Totals", ["A1", "A2", "A3"], style="color:red;")

cells = sheet.get_group_cells("Totals")

print([c.name for c in cells])

# result → ['A1', 'A2', 'A3']
```

## Update style:

```bash
sheet.update_group_style("Totals", "background:yellow;")
```

## Delete group:

```bash
sheet.delete_group("Totals")
```


## 🖱 CursorManager (Redis + SQL)

```bash
from pycells_mds.managers import CursorManager

CursorManager.set_cursor(
    user_id=user_id,
    table_id=sheet.model.table_id,
    list_id=sheet.model.id,
    cells=["A1", "A2"]
)
```

# Get active cursor:

```
CursorManager.get_active(user_id)
```

## 🔄 Recalculation

```bash
pc.recalc("Finance", "Main", user_id)
```

## 📄 Select cells

```bash
cells = pc.select("Finance", "Main", ["A1", "A2", "A3"], user_id)
print(cells)
```

## 🌐 Website & Contacts
📌 Homepage: https://pycells.com
✉️ Email: zhandos.mambetali@gmail.com
☎️ WhatsApp: +7 701 457 7360

## 📜 License
MIT


---
