Multidimensional Data Structures for Python.
Project description
pycells_mds
Multidimensional Data Structures for Python
🔍 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
pip install pycells_mds
Requirements
Python 3.9+
SQLAlchemy
NumPy
Redis (optional, used for CursorManager)
🚀 Quick Start
1) Initialize database
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
user = pc.safe_register_user("user1", "pw123", "user1@example.com")
user_id = user.id
3) Create table and sheet
tbl = pc.ctable("Finance", user_id)
sheet = pc.get_or_create_list("Finance", "Main", user_id)
4) Work with cells
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:
pc.write("Finance", "Main", "B1", "=SUM(A1:A10)", user_id)
pc.write("Finance", "Main", "B2", "=A1^A2", user_id)
🎯 Groups
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:
sheet.update_group_style("Totals", "background:yellow;")
Delete group:
sheet.delete_group("Totals")
🖱 CursorManager (Redis + SQL)
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
pc.recalc("Finance", "Main", user_id)
📄 Select cells
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycells_mds-0.2.9.tar.gz.
File metadata
- Download URL: pycells_mds-0.2.9.tar.gz
- Upload date:
- Size: 130.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48db9367c3246a8a0e6464044256a3a83d941e71db89704c3a5f27a24b5c0337
|
|
| MD5 |
5a29c14e1d5a3a0766d5e95113239da6
|
|
| BLAKE2b-256 |
9d78e65feab297683ed3efce5718a063fdc39cfc0682fa011318ff914ff07d16
|
File details
Details for the file pycells_mds-0.2.9-py3-none-any.whl.
File metadata
- Download URL: pycells_mds-0.2.9-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e4db23a2367b4bc3316cce9d2d97ceb8172f7e1702afd4553989c228e252050
|
|
| MD5 |
3fc58b3e7a8ab4fc5a080d67fad595c2
|
|
| BLAKE2b-256 |
d1673ae67f922f3dc891cc8d5f6d4ebd8d42de1c8bdc7271aa44b30a2b0c1936
|