Skip to main content

Paasmaker Python interface library

Project description

This is a simple Python library that is designed to read in the Paasmaker configuration of the container, falling back to a custom configuration file in development.

You can read more about the Paasmaker PaaS at http://paasmaker.org/.

Usage

In the startup of your application create an interface object. Supply the constructor with a list of locations to look for override configuration files for development. You won’t need override configuration files if you are using the development directory SCM in Paasmaker.

import pminterface

interface = pminterface.PaasmakerInterface(['../my-project.yml'])

interface.is_on_paasmaker() # Returns true if on Paasmaker.

# Raises NameError if no such service exists.
service = interface.get_service('named-service')
# service now is a dict of the parameters. Typically this will
# have the keys 'hostname', 'username', 'password', etc. Use this
# to connect to revelant services.

# Get other application metadata.
application = interface.get_application_name()

Override configuration files can be in either YAML or JSON format. If using the YAML format, be sure to install pyyaml first. If pyyaml isn’t present, only the JSON format is supported, and it will raise an exception when trying to read YAML files.

Example YAML configuration file:

services:
  parameters:
    foo: bar

application:
  name: test
  version: 1
  workspace: Test
  workspace_stub: test

Example JSON configuration file:

{
        "services": {
                "parameters": {
                        "foo": "bar"
                }
        },
        "application": {
                "name": "test",
                "version": 1,
                "workspace": "Test",
                "workspace_stub": "test"
        }
}

Development

You can run the unit tests with the test.py script in the root directory.

The code is currently stored on BitBucket at:

git@bitbucket.org:paasmaker/paasmaker-interface-python.git

Feel free to fork and submit pull requests.

Project details


Release history Release notifications | RSS feed

This version

0.9

Download files

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

Source Distribution

pminterface-0.9.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file pminterface-0.9.tar.gz.

File metadata

  • Download URL: pminterface-0.9.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pminterface-0.9.tar.gz
Algorithm Hash digest
SHA256 b96afa419c2bbb3d34d27754633121b3dc4cb2a0c0a51bc44f6d6d2c2c819582
MD5 36252bda30ef0719b31c940e2e5422ec
BLAKE2b-256 0a746e25e521cdfeb7ac79c59711fdfca677c0b890a73f1dc92deffeab52395c

See more details on using hashes here.

Supported by

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