{"id":2787,"library":"standard-chunk","title":"Standard-chunk","description":"Standard-chunk is a Python library that redistributes modules, often referred to as 'dead batteries,' that have been removed from the Python standard library as per PEP 594 and PEP 632. It allows projects to continue using these modules (such as `aifc`, `asynchat`, `chunk`, `cgi`, etc.) by making them installable via pip. The library focuses on providing minimal compatibility support for these removed modules, rather than active development of new features, with releases typically aligning with Python's major version cycles.","status":"active","version":"3.13.0","language":"en","source_language":"en","source_url":"https://github.com/youknowone/python-deadlib","tags":["standard library","compatibility","deprecated modules","python 3.13","chunk","dead batteries"],"install":[{"cmd":"pip install standard-chunk","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The `chunk` module was removed from the standard library in Python 3.13. For Python 3.13 and later, `standard-chunk` must be installed to use `import chunk`.","wrong":"import chunk # on Python 3.13+","symbol":"chunk","correct":"import chunk"}],"quickstart":{"code":"import io\nimport chunk\n\n# Simulate a file-like object with some IFF-like data\n# (simplified for demonstration, actual IFF files are more complex)\niff_data = b'FORM\\x00\\x00\\x00\\x18TESTCHANKS\\x00\\x00\\x00\\x08DATA\\x00\\x00\\x00\\x04abcd'\nf = io.BytesIO(iff_data)\n\ntry:\n    # Create a Chunk object from a file-like object\n    ck = chunk.Chunk(f)\n\n    print(f\"Chunk ID: {ck.getname().decode('ascii')}\")\n    print(f\"Chunk Size: {ck.getsize()}\")\n\n    # Read some data from the chunk\n    data_read = ck.read(4)\n    print(f\"Data read: {data_read}\")\n\n    # Seek within the chunk\n    ck.seek(0)\n    data_read_again = ck.read(4)\n    print(f\"Data read again after seek: {data_read_again}\")\n\n    ck.close()\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n\n# Example for another 'dead battery' module, asyncore\n# try:\n#     import asyncore\n#     print(\"asyncore imported successfully.\")\n# except ImportError:\n#     print(\"asyncore not found, install standard-asyncore if needed.\")","lang":"python","description":"After installing `standard-chunk`, modules like `chunk` can be imported and used as if they were still part of the Python standard library. This example demonstrates basic usage of the `chunk` module to read simulated IFF-like data."},"warnings":[{"fix":"Install `standard-chunk` via `pip install standard-chunk` in your environment.","message":"The primary `chunk` module was officially removed from the Python standard library in Python 3.13. Without `standard-chunk` installed, `import chunk` will raise an `ImportError` on Python 3.13 and newer versions.","severity":"breaking","affected_versions":"Python >=3.13"},{"fix":"For `distutils`, avoid its use on Python 3.13+ or seek alternative modern packaging solutions like `setuptools`.","message":"The `distutils` module, also redistributed by `python-deadlib` (the upstream project for `standard-chunk`), is explicitly noted as 'Not working on Python 3.13'. While `standard-chunk` provides the `chunk` module, users depending on other dead batteries should check specific compatibility notes.","severity":"gotcha","affected_versions":"Python 3.13.0 and newer for `distutils`"},{"fix":"Treat this library as a 'polyfill' for legacy code. For new development or enhanced functionality, seek actively maintained alternatives.","message":"This library is intended for compatibility with removed standard library modules. It explicitly states it does NOT accept new features or anything beyond minimal compatibility work. Attempting to contribute new features or significant changes will likely be rejected.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Evaluate if an alternative, actively developed library exists for your use case before relying on a 'dead battery' module for new development.","message":"As 'dead batteries', the modules provided by `standard-chunk` are not actively maintained for new features or modern best practices. They are provided as-is for compatibility and might not integrate well with contemporary Python ecosystems.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}