Registry / web-framework / plaster-pastedeploy

plaster-pastedeploy

JSON →
library1.0.1pypypi✓ verified 23d ago

Plaster-pastedeploy provides a `plaster` loader that understands `PasteDeploy` configuration files, primarily used for loading WSGI applications and server configurations from INI-style files. It is currently at version 1.0.1. Its release cadence is generally stable and aligns with major `plaster` and `PasteDeploy` releases.

pip install plaster-pastedeploy
INSTALL
IMPORT
SIG · PLASTER-PASTEDEPLO
P
plaster-pastedeploy
web-frameworkpythonv1.0.1
Install
1.6s avg
Import
131ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.140s · 18.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.122s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

plaster_pastedeploy
import plaster_pastedeploy
Importing the package registers its PasteDeploy loader with the plaster ecosystem.
parse_uri
from plaster import parse_uri
The primary way to use plaster-pastedeploy's functionality is through plaster's parse_uri after importing plaster_pastedeploy.

This quickstart demonstrates how to use `plaster-pastedeploy` to load a WSGI application and server configuration from a `PasteDeploy`-style `.ini` file using the `plaster` API. Importing `plaster_pastedeploy` ensures that `plaster` can correctly parse URIs starting with `config:` that point to `PasteDeploy` configurations. For this example to fully run without errors regarding egg specs, `webtest-app` and `waitress` would need to be installed.

import os import plaster import plaster_pastedeploy # This registers the PasteDeploy loader # Create a dummy PasteDeploy-style config file config_content = """ [app:main] use = egg:webtest_app#main [server:main] use = egg:waitress#main host = 127.0.0.1 port = 8080 """ config_path = "development.ini" with open(config_path, "w") as f: f.write(config_content) # Parse the URI using plaster (which now knows about PasteDeploy thanks to plaster_pastedeploy) # Note: webtest_app and waitress would need to be installed for a real application. try: loader = plaster.parse_uri(f"config:{config_path}") print(f"Successfully parsed configuration using loader: {type(loader).__name__}") # Example: Get a WSGI application app = loader.get_wsgi_app("main") print(f"WSGI App loaded: {app}") # Example: Get a WSGI server factory server_factory = loader.get_wsgi_server("main") print(f"WSGI Server factory loaded: {server_factory}") except Exception as e: print(f"An error occurred: {e}") finally: # Clean up the dummy config file if os.path.exists(config_path): os.remove(config_path)
plaster --version
Debug
Known issues
gotchaFor plaster-pastedeploy's loader to be available to `plaster.parse_uri`, `import plaster_pastedeploy` must be executed *before* `plaster.parse_uri` is called. This ensures the entry points are loaded and the PasteDeploy loader is registered.
fix
Ensure `import plaster_pastedeploy` is placed at the top of your module or prior to any `plaster.parse_uri` calls.
affects: All versions
gotchaPasteDeploy configurations often use `egg:package#factory` syntax for specifying applications and servers. These rely on `setuptools` entry points and the referenced packages being installed in your Python environment. If packages like `webtest-app` or `waitress` (common in examples) are not installed, `plaster-pastedeploy` will raise `DistributionNotFound` or similar errors during configuration loading.
fix
Ensure all packages referenced in your `use = egg:spec` directives within the .ini file are installed in your environment (e.g., `pip install webtest-app waitress`).
affects: All versions
breaking`plaster-pastedeploy` v1.x is designed to work with `plaster` v1.x. `plaster` itself introduced significant breaking changes between its 0.x and 1.x versions (e.g., `plaster.PlasterLoader` was removed). Attempting to use `plaster-pastedeploy` 1.x with `plaster` 0.x, or an older `plaster-pastedeploy` with `plaster` 1.x, will lead to API incompatibilities and runtime errors.
fix
When upgrading, ensure both `plaster` and `plaster-pastedeploy` are at compatible 1.x versions (e.g., `pip install 'plaster>=1.0' 'plaster-pastedeploy>=1.0'`). Review `plaster`'s migration guide if moving from 0.x.
affects: Migration from plaster < 1.0 to plaster >= 1.0 (and corresponding plaster-pastedeploy versions)
Errors
Common errors & fixes
configparser.NoSectionError: No section: 'app:main'
The PasteDeploy configuration file is missing the `[app:main]` section or the application name specified in `get_wsgi_app()` or `get_settings()` does not exist in the file.
fix
Ensure your INI file contains a section like `[app:main]` with a correctly defined application factory. If your application section has a different name (e.g., `[app:myapp]`), specify it when calling the loader methods.

```ini
[app:main]
use = call:my_package.module:app_factory
# ... other app settings
```

```python
# If your section is [app:myapp]
loader.get_wsgi_app('myapp')
```
ModuleNotFoundError: No module named 'plaster_pastedeploy'
The `plaster-pastedeploy` library has not been installed in the current Python environment, or the environment is not correctly activated.
fix
Install the library using pip:
```bash
pip install plaster-pastedeploy
```
KeyError: 'main'
When using `plaster_pastedeploy` to load an application or settings, a function (e.g., `loader.get_wsgi_app()` or `loader.get_settings()`) implicitly or explicitly attempted to access a configuration section or a dictionary key named 'main' that was not found or properly defined in the configuration.
fix
Verify that a section named `[app:main]` exists in your PasteDeploy INI file if you intend to load the default application, or explicitly specify the correct section name in your loader calls if it's different. If the error occurs when accessing loaded settings, check the structure of the dictionary returned to ensure the 'main' key is present.

```ini
# In your .ini file, ensure a 'main' app section exists
[app:main]
# ... configuration for the main application
```

```python
# Or specify the correct section name
settings = loader.get_settings('my_other_section')
```
Upgrade
Version history
1.0.1latest on PyPI · released Nov 7, 2022
Audit
Dependencies
plasterrequiredProvides the base configuration loading interface; plaster-pastedeploy registers itself as a loader for plaster.
PasteDeployrequiredProvides the underlying configuration parsing logic for PasteDeploy-style files.
Agent activity
5 hits · last 30 days
node
4
Resources
plaster-pastedeploy — pip install plaster-pastedeploy · libregistry