Plaster is a loader interface designed to abstract away multiple configuration file formats. It provides a common API for applications to load settings, supporting pluggable loaders discovered via entrypoints. The library focuses on providing a basic interface, leaving specific constraints and implementations to these pluggable loaders. The current version is 1.1.2, released in November 2022, and it is actively maintained by the Pylons Project.
pip install plasterVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load configuration settings from a URI and configure standard logging using `plaster.get_settings()` and `plaster.setup_logging()`. It shows how to specify a configuration file (like 'development.ini') and a specific section ('myapp') to retrieve settings. To run this, you would typically need a loader plugin (e.g., `pip install plaster_pastedeploy`) and a corresponding config file.
Upgrade Python to 3.7+ or pin `plaster<1.1`.
Review any custom entry point handling to ensure compatibility with `importlib.metadata`.
Disambiguate the lookup by appending the package name to the scheme in the `config_uri` (e.g., `ini+myapp://config.ini` to use the 'ini' loader from the 'myapp' package).
Upgrade to `plaster>=1.1.2` to receive a `LoaderNotFound` exception instead of an unhandled crash.
Ensure `config_uri`s are formatted according to current specifications, especially for older configurations. Explicitly use `package+scheme` for package-specific loaders.
Install the appropriate `plaster` plugin for the configuration file format you intend to use (e.g., `pip install plaster_pastedeploy` for INI files).
Install the appropriate `plaster` loader plugin for your configuration format, such as `plaster_pastedeploy` for INI files with WSGI applications: `pip install plaster_pastedeploy`
Ensure the `config_uri` adheres to `plaster`'s expected format, which typically includes a scheme (e.g., `ini://`, `file://`), a path, and optionally a fragment or query parameters (e.g., `development.ini#myapp`, `pastedeploy+ini:///path/to/development.ini`). Double-check for typos or missing components.
To resolve the ambiguity, append the package name of the desired loader to the scheme in your `config_uri`. For example, if 'ini' is ambiguous, specify `ini+myapp` to use the 'ini' loader from the 'myapp' package.
Install the missing loader package using pip: `pip install plaster_pastedeploy`. Replace `plaster_pastedeploy` with the correct package name if a different loader is missing.
Ensure that the `name` parameter passed to the `get_wsgi_` function correctly matches a defined WSGI component in your configuration file (e.g., a section name in an INI file). If `name` is `None`, verify that a default can be derived from the `PlasterURL.fragment` if applicable.