Skip to main content

BSON codec for Python - modernized fork with Python 3.12+ support

Project description

bson-modern

A modernized fork of the bson package with Python 3.12+ support.

Why this fork?

The original bson package has not been updated since 2018 and is incompatible with Python 3.12+ due to:

  • Use of deprecated pkgutil.find_loader() (removed in Python 3.12)
  • Dependency on the six package for Python 2/3 compatibility

This fork removes all Python 2 compatibility code and modernizes the package for Python 3.12+.

Installation

pip install bson-modern

Usage

import bson

# Encode a dictionary to BSON
data = {"name": "Alice", "age": 30, "active": True}
encoded = bson.dumps(data)

# Decode BSON back to dictionary
decoded = bson.loads(encoded)
print(decoded)  # {'name': 'Alice', 'age': 30, 'active': True}

Compatibility with antares-client

This package is designed to be a drop-in replacement for bson when using packages like antares-client that depend on standalone BSON support.

To use with antares-client, install bson-modern before antares-client:

pip install bson-modern antares-client

Or in your pyproject.toml:

dependencies = [
    "bson-modern>=1.0.0",
    "antares-client>=1.3.0",
]

Changes from original bson

  • Python 3.12+ only - Dropped Python 2.x and early Python 3.x support
  • Removed six dependency - No longer needed for Python 2/3 compatibility
  • Modern packaging - Uses pyproject.toml and hatchling
  • Fixed build system - No longer uses deprecated pkgutil.find_loader()

License

BSD-3-Clause (same as original)

Credits

  • Original bson package by Kou Man Tong and Ayun Park
  • Modernization by James Westover

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

bson_modern-1.0.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

bson_modern-1.0.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bson_modern-1.0.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for bson_modern-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fbf3fef31c67195a056f0c5d6dd9ce9ab83af13e76d80871e76a64a0a356bff5
MD5 ff5336343053df4de67fc0303f7247b2
BLAKE2b-256 8ab10591ec19ee968634b395762393cb87a0c67e4ae70bc83fffdf4d62b4b75c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bson_modern-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for bson_modern-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3057bf252780d8470a9d6b09708537ee737277f314a169ab4704a4d88014744
MD5 24c1fda30c80ec12e72f9ca88fbaefb2
BLAKE2b-256 774681fc295f0c06d4149083b9b96cf92ffbee81b99478c47ca24fb3f8b27d2e

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