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-1.0.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-1.0.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bitmapy-1.0.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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ebef2d4025bf01f338cc691cbdc7e510b07b1696d0d455ea995b14dc23701293
MD5 11c568e71cacdb31849ae49d9aab6ef9
BLAKE2b-256 f20dccbcc73beeaca3c7c2b170b3168c5f2f1a7d6d3ce391b66c45d36e737e6c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bitmapy-1.0.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-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a46530f3b3cce5e914bfee1606d586f70ac41ae2bdfe991b251009642e87daf
MD5 d08ec72cd0d62ba8f376c1efafbeed5c
BLAKE2b-256 f1933a4c014091f2e1488268ae87065455653fb033b1ff8bf0bbc112cdda4773

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