Skip to main content

A loader implementing the PasteDeploy syntax to be used by plaster.

Project description

https://img.shields.io/pypi/v/plaster_pastedeploy.svg master CI Status

plaster_pastedeploy is a plaster plugin that provides a plaster.Loader that can parse ini files according to the standard set by PasteDeploy. It supports the wsgi plaster protocol, implementing the plaster.protocols.IWSGIProtocol interface.

Usage

Applications should use plaster_pastedeploy to load settings from named sections in a configuration source (usually a file).

  • Please look at the documentation for plaster on how to integrate this loader into your application.

  • Please look at the documentation for PasteDeploy on the specifics of the supported INI file format.

Most applications will want to use plaster.get_loader(uri, protocols=['wsgi']) to get this loader. It then exposes get_wsgi_app, get_wsgi_app_settings, get_wsgi_filter and get_wsgi_server.

import plaster

loader = plaster.get_loader('development.ini', protocols=['wsgi'])
# to get any section out of the config file
settings = loader.get_settings('app:main')

# to get settings for a WSGI app
app_config = loader.get_wsgi_app_settings()  # defaults to main

# to get an actual WSGI app
app = loader.get_wsgi_app()  # defaults to main

# to get a filter and compose it with an app
filter = loader.get_wsgi_filter('filt')
app = filter(app)

# to get a WSGI server
server = loader.get_wsgi_server()  # defaults to main

# to start the WSGI server
server(app)

Any plaster.PlasterURL options are forwarded as defaults to the loader. Some examples are below:

  • development.ini#myapp

  • development.ini?http_port=8080#main

  • pastedeploy+ini:///path/to/development.ini

  • pastedeploy+ini://development.ini#foo

  • egg:MyApp?debug=false#foo

1.0.1 (2022-11-06)

  • Minor release to cleanup README.

1.0 (2022-11-06)

  • Drop support for Python 2.7, 3.4, 3.5, 3.6.

  • Add support for Python 3.8, 3.9, 3.10.

  • Blackify the codebase.

  • Switch CI to Github Actions.

0.7 (2019-04-12)

0.6 (2018-07-11)

0.5 (2018-03-29)

  • Removed environment variable support entirely for now. The feature requires bugfixes upstream in PasteDeploy which have not been done yet and this was breaking people’s environments so it is gone for now. See https://github.com/Pylons/plaster_pastedeploy/pull/15

0.4.2 (2017-11-20)

0.4.1 (2017-07-10)

0.4 (2017-07-09)

  • Fix get_settings for an arbitrary section to follow the same rules as PasteDeploy with regards to the handling of defaults. The goal of this package is to be compliant with PasteDeploy’s format for all sections in the file such that there are no surprising format changes in various sections.

    Supported added for set default_foo = bar and get foo = default_foo syntax to override a default value and to pull a default value into the settings, respectively. In the above example the value foo = bar would be returned. Any other defaults not pulled into the section via either interpolation or the get syntax will be ignored.

    See https://github.com/Pylons/plaster_pastedeploy/pull/6

  • Inject environment variables into the defaults automatically. These will be available for interpolation as ENV_<foo>. For example if environment variable APP_DEBUG=true then %(ENV_APP_DEBUG)s will work within the ini file. See https://github.com/Pylons/plaster_pastedeploy/pull/7

  • get_settings and get_wsgi_app_settings both return only the local config now. However, the returned object has a global_conf attribute containing the defaults as well as a loader attribute pointing at the loader instance. See https://github.com/Pylons/plaster_pastedeploy/pull/8

0.3.2 (2017-07-01)

0.3.1 (2017-06-02)

  • Recognize the pastedeploy+egg scheme as an egg type.

0.3 (2017-06-02)

0.2.1 (2017-03-29)

  • Fix a bug in 0.2 in which an exception was raised for an invalid section if the a non-config-file-based protocol was used.

0.2 (2017-03-29)

  • No longer raise plaster.NoSectionError exceptions. Empty dictionaries are returned for missing sections and a user should check get_sections for the list of valid sections.

0.1 (2017-03-27)

  • Initial release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plaster_pastedeploy-1.0.1.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

plaster_pastedeploy-1.0.1-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file plaster_pastedeploy-1.0.1.tar.gz.

File metadata

  • Download URL: plaster_pastedeploy-1.0.1.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for plaster_pastedeploy-1.0.1.tar.gz
Algorithm Hash digest
SHA256 be262e6d2e41a7264875daa2fe2850cbb0615728bcdc92828fdc72736e381412
MD5 79a05aadf9704ffae75e374715aaba4c
BLAKE2b-256 c7af01a22f73ce97c6375c88d7ceaf6f5f4f345e940da93c94f98833d898a449

See more details on using hashes here.

File details

Details for the file plaster_pastedeploy-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for plaster_pastedeploy-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ad3550cc744648969ed3b810f33c9344f515ee8d8a8cec18e8f2c4a643c2181f
MD5 29c33baa01599cee7a7574505a2647f4
BLAKE2b-256 bd302d4cf89035c22a89bf0e34dbc50fdc07c42c9bdc90fd972d495257ad2b6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page