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
sixpackage 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
sixdependency - No longer needed for Python 2/3 compatibility - Modern packaging - Uses
pyproject.tomlandhatchling - Fixed build system - No longer uses deprecated
pkgutil.find_loader()
License
BSD-3-Clause (same as original)
Credits
- Original
bsonpackage by Kou Man Tong and Ayun Park - Modernization by James Westover
Release files for bson-modern 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bson_modern-1.1.0.tar.gz | 10.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bson_modern-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / bson_modern-1.1.0.tar.gz
| Download URL | bson_modern-1.1.0.tar.gz |
|---|---|
| Size | 10.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e04d46db5498018db92b787f75730058c09c207e7ae9875e866a87be47e3f06
|
|
BLAKE2b-256 checksum How to use checksums |
85947b0d65f1ca797b8290acf455c971e271303904934e073dd492894160d662
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / bson_modern-1.1.0-py3-none-any.whl
| Download URL | bson_modern-1.1.0-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80bc582f4618db44eb3dd0c98271f9031a6360b4e642a4da926c9c3628aa4c5e
|
|
BLAKE2b-256 checksum How to use checksums |
2c8df22a4f203319a98ecbd62f7e53563122cb1b9d081244f1f7315ee39f0fca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|