Logilab Common

raw JSON →
2.1.0 verified Fri May 01 auth: no python

A collection of low-level Python packages and modules used by Logilab projects, including utilities for date manipulation, configuration, caching, and more. Current version is 2.1.0, with a maintenance release cadence.

pip install logilab-common
error ModuleNotFoundError: No module named 'logilab.common.graph'
cause The graph module has been deprecated and removed in recent versions.
fix
Use an alternative library like networkx: pip install networkx and use networkx instead.
error ImportError: cannot import name 'Date' from 'logilab.common'
cause Date is not exported from the top-level package; it must be imported from the submodule.
fix
Use: from logilab.common.date import Date
error TypeError: 'module' object is not callable when trying to instantiate Date directly
cause The import from top-level gives a module, not the class.
fix
Use: from logilab.common.date import Date
deprecated The `logilab.common.graph` module has been deprecated and will be removed in a future version.
fix Use networkx or another graph library instead.
gotcha Import paths for submodules may change between versions. Always check the submodule path.
fix Use explicit import from submodules, e.g., `from logilab.common.date import Date` instead of relying on top-level imports.
breaking Python 2 support was dropped starting from version 2.0.0.
fix Upgrade to Python 3.6+ and use logilab-common >=2.0.0.

Basic usage: create a Date object and a Configuration object

from logilab.common.date import Date
d = Date.today()
print(d)

from logilab.common.configuration import Configuration
config = Configuration()
print(config)