# pymatgraph
pymatgraph is a Python package that provides a multiprocess-safe buffer for PyTorch tensors, specifically designed for rendering RGB matrices and tables using Pygame. This package allows for efficient sharing of tensor data between processes, making it suitable for applications that require real-time rendering and updates.
## Features
- **Multiprocess Safe**: Utilizes shared memory and locks to ensure safe access to tensor data across multiple processes.
- **Flexible Modes**: Supports both numerical and RGB modes for tensor data.
- **Table Rendering**: Built-in utilities to render structured tabular data directly on the screen.
- **Easy Integration**: Designed to work seamlessly with Pygame for rendering visual data.
## Installation
You can install the pymatgraph package using pip:
```bash
pip install pymatgraph
```
## Usage
Here is a simple example of how to use the pymatgraph package:
```python
width, height = 640, 480
buffer = MultiprocessSafeTensorBuffer(n=height, m=width, mode="rgb")
buffer.write_matrix(torch.zeros((height,width,3), dtype=torch.uint8))
g = Graphics(width=width, height=height, bg_color=(30,30,30))
text1 = Text("Custom Rendering Engine!", x=50, y=50, font_size=32, color=(255,255,0))
table1 = Table(
data=[["Name","Age"], ["Alice","24"], ["Bob","30"]],
x=50, y=120, cell_width=120, cell_height=40,
bg_color=(50,50,100), grid_color=(255,255,255)
)
text1.render_to_tensor(buffer)
table1.render_to_tensor(buffer)
g.run(buffer)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pymatgraph",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "GPU, CPU, graphics, tensor, rendering, tables, text, images, pygame, kivy, high-performance",
"author": null,
"author_email": "Alec Candidato <aleccandidato@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/2d/20/6c2d31c15f7a5ac1081ed64ace2a29b2471ae6dd17a63a6b89afa3c0e1f9/pymatgraph-0.3.3.tar.gz",
"platform": null,
"description": "# pymatgraph\n\npymatgraph is a Python package that provides a multiprocess-safe buffer for PyTorch tensors, specifically designed for rendering RGB matrices and tables using Pygame. This package allows for efficient sharing of tensor data between processes, making it suitable for applications that require real-time rendering and updates.\n\n## Features\n\n- **Multiprocess Safe**: Utilizes shared memory and locks to ensure safe access to tensor data across multiple processes.\n- **Flexible Modes**: Supports both numerical and RGB modes for tensor data.\n- **Table Rendering**: Built-in utilities to render structured tabular data directly on the screen.\n- **Easy Integration**: Designed to work seamlessly with Pygame for rendering visual data.\n\n## Installation\n\nYou can install the pymatgraph package using pip:\n\n```bash\npip install pymatgraph\n```\n\n## Usage\nHere is a simple example of how to use the pymatgraph package:\n```python\nwidth, height = 640, 480\nbuffer = MultiprocessSafeTensorBuffer(n=height, m=width, mode=\"rgb\")\nbuffer.write_matrix(torch.zeros((height,width,3), dtype=torch.uint8))\n\ng = Graphics(width=width, height=height, bg_color=(30,30,30))\n\ntext1 = Text(\"Custom Rendering Engine!\", x=50, y=50, font_size=32, color=(255,255,0))\ntable1 = Table(\n data=[[\"Name\",\"Age\"], [\"Alice\",\"24\"], [\"Bob\",\"30\"]],\n x=50, y=120, cell_width=120, cell_height=40,\n bg_color=(50,50,100), grid_color=(255,255,255)\n)\n\ntext1.render_to_tensor(buffer)\ntable1.render_to_tensor(buffer)\n\ng.run(buffer)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for high-performance tensor-based GPU/CPU buffer rendering, supporting tables, text, images, and graphics.",
"version": "0.3.3",
"project_urls": {
"Documentation": "https://github.com/0202alcc/pymatgraph#readme",
"Homepage": "https://github.com/0202alcc/pymatgraph",
"Repository": "https://github.com/0202alcc/pymatgraph"
},
"split_keywords": [
"gpu",
" cpu",
" graphics",
" tensor",
" rendering",
" tables",
" text",
" images",
" pygame",
" kivy",
" high-performance"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "7ab9b334a3a6f1455102eed46714ab414bc9858f3bdbe1651e079de52827accb",
"md5": "9d07d359737361210d1aef384e92893d",
"sha256": "e601b0900c9caf1c84ff9ec37b60f46ee81408154f8f347d928ed3503870790f"
},
"downloads": -1,
"filename": "pymatgraph-0.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9d07d359737361210d1aef384e92893d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 13042,
"upload_time": "2025-09-04T01:40:40",
"upload_time_iso_8601": "2025-09-04T01:40:40.933657Z",
"url": "https://files.pythonhosted.org/packages/7a/b9/b334a3a6f1455102eed46714ab414bc9858f3bdbe1651e079de52827accb/pymatgraph-0.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2d206c2d31c15f7a5ac1081ed64ace2a29b2471ae6dd17a63a6b89afa3c0e1f9",
"md5": "9cd99e595ae54265c5f06be8eb1db8f0",
"sha256": "92c97eed060ac213b22245e0b708dafba589c1a7bd6d3e23c7884ead98a7918c"
},
"downloads": -1,
"filename": "pymatgraph-0.3.3.tar.gz",
"has_sig": false,
"md5_digest": "9cd99e595ae54265c5f06be8eb1db8f0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 12439,
"upload_time": "2025-09-04T01:40:42",
"upload_time_iso_8601": "2025-09-04T01:40:42.339573Z",
"url": "https://files.pythonhosted.org/packages/2d/20/6c2d31c15f7a5ac1081ed64ace2a29b2471ae6dd17a63a6b89afa3c0e1f9/pymatgraph-0.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-04 01:40:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "0202alcc",
"github_project": "pymatgraph#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pymatgraph"
}