Registry / serialization / standard-chunk

standard-chunk

JSON →
library3.13.0pypypi✓ verified 33d ago

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.

pip install standard-chunk
INSTALL
IMPORT
SIG · STANDARD-CHUNK
S
standard-chunk
serializationpythonv3.13.0
Install
1.5s avg
Import
10ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.13.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.002s · 17.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.002s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

chunk
✓ import chunk
✗ import chunk # on Python 3.13+
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`.

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.

import io import chunk # Simulate a file-like object with some IFF-like data # (simplified for demonstration, actual IFF files are more complex) iff_data = b'FORM\x00\x00\x00\x18TESTCHANKS\x00\x00\x00\x08DATA\x00\x00\x00\x04abcd' f = io.BytesIO(iff_data) try: # Create a Chunk object from a file-like object ck = chunk.Chunk(f) print(f"Chunk ID: {ck.getname().decode('ascii')}") print(f"Chunk Size: {ck.getsize()}") # Read some data from the chunk data_read = ck.read(4) print(f"Data read: {data_read}") # Seek within the chunk ck.seek(0) data_read_again = ck.read(4) print(f"Data read again after seek: {data_read_again}") ck.close() except Exception as e: print(f"An error occurred: {e}") # Example for another 'dead battery' module, asyncore # try: # import asyncore # print("asyncore imported successfully.") # except ImportError: # print("asyncore not found, install standard-asyncore if needed.")
Debug
Known issues
breakingThe 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.
fix
Install `standard-chunk` via `pip install standard-chunk` in your environment.
affects: Python >=3.13
gotchaThe `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.
fix
For `distutils`, avoid its use on Python 3.13+ or seek alternative modern packaging solutions like `setuptools`.
affects: Python 3.13.0 and newer for `distutils`
gotchaThis 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.
fix
Treat this library as a 'polyfill' for legacy code. For new development or enhanced functionality, seek actively maintained alternatives.
affects: All versions
gotchaAs '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.
fix
Evaluate if an alternative, actively developed library exists for your use case before relying on a 'dead battery' module for new development.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aifc'
The `aifc` module was removed from the Python standard library in Python 3.11 as per PEP 594.
fix
pip install standard-chunk
import aifc
ModuleNotFoundError: No module named 'cgi'
The `cgi` module was removed from the Python standard library in Python 3.11 as per PEP 632.
fix
pip install standard-chunk
import cgi
ModuleNotFoundError: No module named 'asynchat'
The `asynchat` module was removed from the Python standard library in Python 3.11 as per PEP 594.
fix
pip install standard-chunk
import asynchat
ModuleNotFoundError: No module named 'chunk'
The `chunk` module was removed from the Python standard library in Python 3.11 as per PEP 594.
fix
pip install standard-chunk
import chunk
Upgrade
Version history
3.13.0latest on PyPI · released Oct 30, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Resources
standard-chunk — pip install standard-chunk · libregistry