commoncode is a collection of essential utilities for Python, originally split from the ScanCode project. It provides robust tools for file system operations, hashing, system information, command execution, and more. It is actively maintained with frequent minor releases to support new Python versions and address bug fixes. The current version is 32.4.2.
pip install commoncodeVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `commoncode.fileutils.file_sha1` to compute a file's SHA1 checksum and `commoncode.system.get_system_info` to retrieve basic system details. It creates a temporary file and cleans it up afterward.
Upgrade your Python environment to 3.10 or newer, or pin commoncode to an older version (<32.4.0) if you must use Python 3.9.
Upgrade commoncode to version 32.3.0 or newer to ensure compatibility with recent 'click' versions. (Fixed in 32.3.0, further fixes in 32.4.0).
Upgrade to commoncode 32.4.0 or newer to ensure robust handling of non-UTF-8 paths. For older versions, ensure all paths are UTF-8 compliant.
Upgrade commoncode to version 32.2.0 or newer to ensure compatibility with `bs4` 4.13+ when using `as_unicode`.