--- id: bencode-py version: "4.1.0" license: BitTorrent Open Source License license_treatment: unclear maintenance: active --- # bencode.py — Simple bencode parser (for Python 2, Python 3 and PyPy) License: unclear · Maintenance: active · Downloads: 203.9K/mo ## What it is and what it does bencode.py is a parser for the bencode format, the binary encoding scheme used in BitTorrent and related peer-to-peer protocols. It provides both encoding (Python objects to bencode strings) and decoding (bencode strings back to Python objects) with configurable handling of string encoding, dictionary ordering, and nesting depth limits. The package offers a simple functional API (encode/decode) for quick use, plus a class-based API (Bencode, BencodeEncoder, BencodeDecoder) for fine-grained control over encoding behavior, fallback strategies, and file I/O. It has no runtime dependencies and works across Python 2, Python 3, and PyPy, making it portable for legacy and modern codebases alike. Use it for: - Parse and extract metadata from .torrent files or BitTorrent protocol messages - Serialize Python data structures into bencode format for peer-to-peer applications - Build tools that interact with BitTorrent clients or DHT (Distributed Hash Table) networks - Handle bencode-encoded configuration or data interchange in legacy systems - Decode bencode strings with custom encoding fallback strategies for mixed or corrupted data ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Encodes and decodes bencode format, the binary encoding used in BitTorrent and related protocols, supporting Python 2, Python 3, and PyPy. Yes, if you need bencode support. Low install friction, no dependencies, active maintenance, and no known vulnerabilities make it a straightforward choice. The main caveat is the unclear license status—verify BitTorrent Open Source License compatibility with your project's constraints before committing to production use. ## Install pip install bencode-py uv add bencode-py poetry add bencode-py ## Installing bencode.py Before you install: Low install friction with no runtime dependencies. Actively maintained as of 2026-07-07 with recent release history. License in practice: Licensed under BitTorrent Open Source License (license_treatment: unclear). The license status is not mapped to a standard SPDX identifier, so review the raw license terms before use in proprietary or restricted contexts. Quickstart: pip install bencode.py import bencodepy # Encode bencodepy.encode({'title': 'Example'}) # b'd5:title7:Examplee' # Decode bencodepy.decode('d5:title7:Examplee') # {b'title': b'Example'} Verify before relying: - Whether BitTorrent Open Source License permits use in closed-source or commercial projects without restrictions - Specific Python version support (requires_python field is unspecified in metadata) ## Package facts - License: BitTorrent Open Source License (unclear) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 203.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags bencode encoder decoder, bittorrent bencode parser, bencode python library, encode decode bencode, torrent metadata parsing, bencode serialization, bittorrent, serialization [View on SkillFed](https://skillfed.io/packages/bencode-py) · [View on PyPI](https://pypi.org/project/bencode-py/)