Skip to main content

BSON codec for Python - modernized fork with Python 3.9+ support (drop-in replacement for bson)

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: bson_modern-1.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 8e04d46db5498018db92b787f75730058c09c207e7ae9875e866a87be47e3f06
MD5 69082b910c62d0a3de2f554d15b1bdcf
BLAKE2b-256 85947b0d65f1ca797b8290acf455c971e271303904934e073dd492894160d662

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bson_modern-1.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80bc582f4618db44eb3dd0c98271f9031a6360b4e642a4da926c9c3628aa4c5e
MD5 8628bbdc4ce20d15f7848ea1c5dc6aad
BLAKE2b-256 2c8df22a4f203319a98ecbd62f7e53563122cb1b9d081244f1f7315ee39f0fca

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