{"id":23668,"library":"endec","title":"Endec","description":"A web-compatible encoding and decoding library for Python, leveraging a Rust backend via PyO3 for performance. Current version 0.5.4 supports Python >=3.8. Releases are frequent, with minor patches and version bumps. It provides encoding/decoding for base64, base32, base16, hex, and other formats.","status":"active","version":"0.5.4","language":"python","source_language":"en","source_url":"https://github.com/fluxth/endec","tags":["encoding","decoding","base64","web","rust"],"install":[{"cmd":"pip install endec","lang":"bash","label":"Install endec from PyPI"}],"dependencies":[],"imports":[{"note":"Direct import from endec is correct; submodule imports may not work.","wrong":"from endec.codecs import Base64","symbol":"Base64","correct":"from endec import Base64"},{"note":"Top-level import is the intended API.","wrong":"from endec.coder import encode","symbol":"encode","correct":"from endec import encode"},{"note":"Using module-level decode is fine but direct import is cleaner.","wrong":"import endec; endec.decode(...)","symbol":"decode","correct":"from endec import decode"}],"quickstart":{"code":"from endec import encode, decode, Base64\n\n# Encode bytes to base64 string\ndata = b\"hello world\"\nencoded = encode(data, Base64)\nprint(encoded)  # aGVsbG8gd29ybGQ=\n\n# Decode back\ndecoded = decode(encoded, Base64)\nprint(decoded)  # b'hello world'","lang":"python","description":"Basic usage: encode and decode bytes using the Base64 codec."},"warnings":[{"fix":"Upgrade to PyPy 3.11+ or pin endec to <0.4.0.","message":"In v0.4.0, dropped support for PyPy 3.9 and 3.10. If you use PyPy, ensure you are on PyPy 3.11+.","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Ensure input is bytes: encode(b'text') not encode('text').","message":"The encode function expects bytes input. Passing a string will raise a TypeError.","severity":"gotcha","affected_versions":"*"},{"fix":"Use .decode() on the result to get a string: decode(encoded, Base64).decode('utf-8').","message":"The decode function returns bytes, not a string. Many users expect a string for base64.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Call encode(b'your_string') or encode('your_string'.encode('utf-8')).","cause":"Passing a string to encode() instead of bytes.","error":"TypeError: a bytes-like object is required, not 'str'"},{"fix":"Use from endec import Base64 instead of from endec.codecs import Base64.","cause":"Trying to import from a submodule that is not exposed.","error":"ModuleNotFoundError: No module named 'endec.codecs'"},{"fix":"Use from endec import Base64; encode(data, Base64).","cause":"Passing a string like 'base64' instead of the codec object.","error":"ValueError: Unsupported codec: 'base64' (string)"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}