Skip to main content

MatrixCore

MatrixCore is a small, general-purpose Python library for creating and manipulating two-dimensional matrices. It is suitable for grids, tilemaps, simulations, spatial data, and other applications that need an ordinary 2D data structure. It is not a graphics or game engine and does not aim to replace NumPy.

Installation

python -m pip install matrixcore

MatrixCore supports Python 3.10 and newer, uses only the standard library at runtime, and runs on Windows, macOS, and Linux.

Quick start

from matrixcore import Matrix

matrix = Matrix.from_list([
    [1, 2, 3],
    [4, 5, 6],
])

matrix[1, 0] = 20
area = matrix.region(0, 0, 2, 2)
area.fill(0)
print(matrix.to_list())
print(matrix.rotated().shape)

Coordinates are always (x, y), where x is the column, y is the row, and (0, 0) is the top-left cell. Matrix shape is (width, height). Zero-sized dimensions are supported; negative dimensions are rejected.

Features

  • List, text, and factory-based construction, with checked tuple indexing.
  • Auto, fixed-width numeric, and Python-object storage.
  • Live rectangular regions, copying, filling, and replacement.
  • Rotation, reflection, transpose, resize, and translation.
  • Search, neighbors, functional mapping, and shape-checked combination.
  • Iterative flood fill, BFS/DFS, connected components, pathfinding, boundaries, and rectangular pattern matching.
  • Change events, event batching, rollback transactions, and opt-in undo/redo.
  • Ordered matrix layers with explicit transparency values.
  • Explicitly installed plugins that cannot replace native methods.
  • Versioned .matrix, JSON, CSV, and plain-text import/export.

Storage

storage="auto" selects compact array.array numeric storage when the values fit a supported type, and promotes to list-backed object storage when a write cannot be represented. Fixed dtype choices are int8, int16, int32, int64, float32, and float64; integer bounds and array widths are checked. Floating point values follow the precision of the chosen array format. Object storage accepts arbitrary Python values. memory_usage() is an estimate and excludes the Matrix instance and referenced object graphs.

Examples and documentation

Executable examples are in examples/. Detailed guides are in docs/:

Development and tests

python -m pip install -e ".[dev]"
python -m pytest -v
python -m pytest --cov=matrixcore --cov-report=term-missing

Build and publish

To prepare a release locally:

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*

The upload command publishes the distributions and is intentionally not run by this project setup. Review the files and configure your PyPI credentials before running it yourself.

License

MatrixCore is distributed under the MIT License. See LICENSE.

Contributions are described in CONTRIBUTING.md.

Metadata

Release files for matrixcore-tool 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for matrixcore-tool 0.1.0
File Size Uploaded Provenance Actions
matrixcore_tool-0.1.0.tar.gz 33.0 kB Without provenance Details for matrixcore_tool-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for matrixcore-tool 0.1.0
File Interpreter ABI Platform Actions
matrixcore_tool-0.1.0-py3-none-any.whl Python 3 none any Details for matrixcore_tool-0.1.0-py3-none-any.whl

Total release size: 66.1 kB

Release files / matrixcore_tool-0.1.0.tar.gz

Download URL matrixcore_tool-0.1.0.tar.gz
Size 33.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7410fddbe1544c226c162164203009e366180bb8ae63d0553d92fd9410383259
BLAKE2b-256 checksum
How to use checksums
bff404a80c5dfb59ce4ae60ff514909dd95889f82a29e5e5467a0f89c1aaffaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / matrixcore_tool-0.1.0-py3-none-any.whl

Download URL matrixcore_tool-0.1.0-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c39f30a5fb644ef590482d0dcbe705d68ec631f941f1fb53705bff8d838f99aa
BLAKE2b-256 checksum
How to use checksums
9042a80a3b74b1d2051446fc64a5d218deb8e1746babc50bf295ea04fde36dfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for matrixcore-tool 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page