Bitmap manipulation and operations.
Project description
bitmapy
A lightweight Python library for bitmap manipulation and operations.
Features
- Create and manage bitmaps in Python
- Set, clear, and toggle bits
- Efficient bitwise operations
- Type-annotated for better development experience
- Well-tested with pytest
Installation
You can install bitmapy using pip:
pip install bitmapy
Or, for local development:
git clone https://github.com/oparsons22/bitmapy.git
cd bitmapy
uv sync --all-extras --dev
Usage Example
Full functionality is available when using generic enum.IntFlag.
from enum import IntFlag, auto
from bitmapy import Bitmap
class Permission(IntFlag):
READ = auto()
WRITE = auto()
EXECUTE = auto()
# Create a bitmap with no permissions
bitmap = Bitmap[Permission]()
# Check if WRITE permission is set
if bitmap.is_set(Permission.WRITE):
print("WRITE permission is enabled.")
# Add EXECUTE permission
bitmap.set(Permission.EXECUTE)
# Remove READ permission
bitmap.clear(Permission.READ)
# Toggle WRITE permission
bitmap.toggle(Permission.WRITE)
# Get the current value
print(f"Current permissions: {bitmap.value}")
Testing
To run tests:
uv run pytest
Contributing
Contributions are welcome! Please open issues or submit pull requests on GitHub.
License
This project is licensed under the MIT License. See the LICENSE file for details.
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 bitmapy-1.0.1.tar.gz.
File metadata
- Download URL: bitmapy-1.0.1.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7875ac702ea2663bc87169ca6eef8f1d449682a41ca2cd04fcecadf7c29160c
|
|
| MD5 |
9ce464dc71506d8d905efddc9488efc2
|
|
| BLAKE2b-256 |
0afecf963ae017b16c4fe11c0d48478f4958c7b8552ab56ca5696ee0c35f74ee
|
File details
Details for the file bitmapy-1.0.1-py3-none-any.whl.
File metadata
- Download URL: bitmapy-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b0a89c1cd48965e14cbb82c0f9d0bce02254202ae330d54223e42e5ec20a1d5
|
|
| MD5 |
a849a9af4691064a70995460619fc605
|
|
| BLAKE2b-256 |
05811a07df54dbd1f1347d7656bcc0c37dbb6618245e3a6ed9ba08409501b373
|