{"id":8160,"library":"firebird-base","title":"Firebird Base Modules","description":"Firebird-base provides foundational modules for working with Firebird databases in Python, offering utilities for logging, configuration, buffering, event handling, and protobuf integration. It is actively maintained with regular patch and minor releases, typically quarterly, and had a major version bump to 2.0.0 in late 2023, raising the minimum Python version to 3.11. The current version is 2.0.2.","status":"active","version":"2.0.2","language":"en","source_language":"en","source_url":"https://github.com/FirebirdSQL/python3-base","tags":["firebird","database","utility","logging","configuration","protobuf","buffer"],"install":[{"cmd":"pip install firebird-base","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Used for configuration and data serialization, explicitly required by the library.","package":"protobuf","optional":false}],"imports":[{"symbol":"MemoryBuffer","correct":"from firebird.base.buffer import MemoryBuffer"},{"note":"The firebird.base.logging module was completely reworked in v2.0.0. Use get_logger() instead of directly importing Logger or LogManager for basic logging.","wrong":"from firebird.base.logging import Logger","symbol":"get_logger","correct":"from firebird.base.logging import get_logger"},{"symbol":"Config","correct":"from firebird.base.config import Config"}],"quickstart":{"code":"from firebird.base.buffer import MemoryBuffer\nimport io\n\n# Create a MemoryBuffer with an initial capacity of 1KB\nbuffer = MemoryBuffer(1024)\n\n# Write some bytes to the buffer\ntest_data = b\"This is a test string to be written into the buffer.\"\nbuffer.write(test_data)\n\n# Move the cursor to the beginning to read\nbuffer.seek(0, io.SEEK_SET)\n\n# Read all data from the buffer\nread_data = buffer.read()\n\n# Get the raw underlying buffer content (new in v2.0.0)\nraw_content = buffer.get_raw()\n\nprint(f\"Original data: {test_data}\")\nprint(f\"Read data: {read_data}\")\nprint(f\"Raw buffer content (up to written length): {raw_content[:len(test_data)]}\")\n\n# Verify data\nassert read_data == test_data\nassert raw_content[:len(test_data)] == test_data\nprint(\"Buffer operations successful!\")","lang":"python","description":"Demonstrates basic usage of MemoryBuffer, a core utility for managing binary data, including the `get_raw` method introduced in v2.0.0."},"warnings":[{"fix":"Upgrade your Python environment to 3.11 or later, or pin `firebird-base` to a version `<2.0.0` (e.g., `firebird-base<2.0.0`).","message":"Version 2.0.0 and above require Python 3.11 or newer. Running on older Python versions will result in installation failures or runtime errors.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Update your logging implementation to use the new API, primarily `firebird.base.logging.get_logger()` and its associated configuration methods.","message":"The `firebird.base.logging` module was completely reworked in v2.0.0. Existing code that directly imports `Logger` or `LogManager` classes, or relies on previous configuration methods, will break.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure you are running `firebird-base` v2.0.1 or newer, especially when using Python 3.11+.","message":"Internal `_decompose` logic in `firebird.base.types` was adjusted in v1.4.3 and fixed again in v2.0.1 due to changes in Python 3.11's `enum` module. Using older versions of `firebird-base` (e.g., <1.4.3 or between 1.4.3 and 2.0.1) on Python 3.11 might lead to incorrect behavior with certain enum-like types.","severity":"gotcha","affected_versions":"<2.0.1"},{"fix":"Review configuration files to ensure explicit handling of 'env' sections or rename environment variables if conflicts arise. Be aware of this feature when designing configuration.","message":"The `firebird.base.config` module's `EnvExtendedInterpolation` extends `configparser.ExtendedInterpolation` to automatically resolve 'env' section variables from environment variables. This might cause unexpected configuration values if environment variables with matching names exist but are not intended to be used.","severity":"gotcha","affected_versions":">=1.8.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Upgrade `firebird-base` to version 2.0.1 or newer to resolve the signature mismatch.","cause":"An issue with signature matching in the `eventsocket` module was present in earlier versions.","error":"TypeError: __signature__ must be an instance of inspect.Signature"},{"fix":"Upgrade `firebird-base` to version 2.0.0 or newer to use the `get_raw` method.","cause":"The `get_raw` method was added to `MemoryBuffer` (and related buffer factories) in version 2.0.0.","error":"AttributeError: 'MemoryBuffer' object has no attribute 'get_raw'"},{"fix":"Adapt your logging code to the new API introduced in `firebird-base` v2.0.0. For basic usage, refer to `firebird.base.logging.get_logger()`.","cause":"The `firebird.base.logging` module was entirely rewritten in v2.0.0, changing its internal structure and API, including the removal of previous configuration modules.","error":"ModuleNotFoundError: No module named 'firebird.base.logging.config'"},{"fix":"Upgrade your Python environment to 3.11 or newer, or specify an older compatible version of `firebird-base` (e.g., `pip install 'firebird-base<2.0.0'`).","cause":"Attempting to install or run `firebird-base` v2.0.0+ on a Python version older than 3.11.","error":"distutils.errors.DistutilsPlatformError: Python 3.10.x is not supported by Firebird Base Modules 2.0.0 and above."}]}