A plaster plugin to configure pyramid app with Yaml
Project description
plaster-yaml
Introduction
By default, Pyramid uses a PasteDeploy (.ini) file format for its configuration.
When the plaster-yaml
plugin is used, Pyramid applications are
instead configured with a YAML configuration file.
For example:
pserve development.yaml
Installation
With poetry
poetry add plaster-yaml
With pip
pip install plaster-yaml
Usage
The plaster-yaml
plugin must be "registered". This is done by
configuring a Python package "entry point" using the packaging tool of
your choice. How this is done depends on the packaging tool.
Examples are given below.
When developing, using an "editable" install that executes your unpackaged code, after changing your package's configuration your packaging tool must be run in order to finalize the registration. Examples are given below.
No special steps must be taken after configuring a entry point and
(correctly) packaging your project. The plaster-yaml
plugin is
registered when your project's package is installed.
With poetry
Plugin registration is configured in your pyproject.toml
, as
follows:
[tool.poetry.plugins."paste.app_factory"]
main = "<PATH_TO_MODULE_CONTAINING_MAIN>:main"
[tool.poetry.plugins."plaster.loader_factory"]
"file+yaml" = "plaster_yaml:Loader"
When developing, run poetry install
to register your plugin after
adding the above to your pyproject.toml
.
With setuptools
When developing, run pip install -e .
to register your plugin after
using either of approaches below.
With pyproject.toml
and a setuptools
build
back-end
This is the preferred method.
Plugin registration may be configured in your pyproject.toml
, as
follows:
[project.entry-points.'paste.app_factory']
main = '<my_app>:main']
[project.entry-points.'plaster.loader_factory']
yaml = 'plaster_yaml:Loader'
With setup.py
This method is generally obsolete, but it can be used when the
[project.entry-points]
table is declared "dynamic". However, this
method must be used when the deprecated python setup.py ...
command is the package building method.
Plugin registration may be configured in your setup.py
, as
follows:
setup(
...,
entry_points={
'paste.app_factory': ['main = <my_app>:main'],
'plaster.loader_factory': ['yaml = plaster_yaml:Loader'],
...
},
)
Troubleshooting
The following exception means that you did not successfully register
the plaster-yaml
plugin:
plaster.exceptions.LoaderNotFound: Could not find a matching loader for the scheme "file+yaml", protocol "wsgi".
Read the relevant "Usage" sub-section, above, to find out how to register it properly.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file plaster_yaml-1.0.0.tar.gz
.
File metadata
- Download URL: plaster_yaml-1.0.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.7.9-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e506814d5faff36246cf8d8bb244be6338d601e7c1ae772d7c98f7ddb8b1ab4 |
|
MD5 | bc0d14f4bcace9782b8f1c9e7305d35a |
|
BLAKE2b-256 | 588a6e8ef5e7a94a3c57e064e9d77601251dfc01bd9a9218fe7146022c5997f6 |
File details
Details for the file plaster_yaml-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: plaster_yaml-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.7.9-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6566446b9549a21ae64e1c039678159c645b1b10ace91e9d5dc720f34aacb791 |
|
MD5 | 221e2180defcb8365cd993abb4376d30 |
|
BLAKE2b-256 | 383cc8124301b2c7a98d6f387994589d7e9927756d99885889de6999efc1155e |