Skip to main content

Bitmap manipulation and operations.

Project description

bitmapy

CI

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitmapy-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bitmapy-0.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file bitmapy-0.1.0.tar.gz.

File metadata

  • Download URL: bitmapy-0.1.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for bitmapy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eb2edcc3f0546683b399c49bb8302050a80ed1d7ba1bcf902e0b22b20332af37
MD5 3a710f4634b7038d8fa18f447555ac21
BLAKE2b-256 46d52d148c514c696c7c0b6b9d91cec9b79c376c2fb6e39afc3f51da861bd6e7

See more details on using hashes here.

File details

Details for the file bitmapy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bitmapy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for bitmapy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e01f5fa8fb763b6e7281d8c59f34d1f85f72864810f50e7b9df08d8042f4ed9
MD5 1c186834e636efc7b6b7a9d04855e883
BLAKE2b-256 dfadda7264deda5e1b5cc40157c92d116dc012a99d20525a68847f9f257602a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page