This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

python-wax - hierarchical configuration format and context object for Python

Quick Example

>>> from wax import Wax, parse_wax
>>> w = Wax(server=Wax(host='localhost'))
>>> w.server.port = 1234

>>> print 'hostname is %(server.host)s using port %(server.port)s' % w
hostname is localhost using port 1234

>>> s = str(w)
>>> print s

[server]
host = "localhost"
port = 1234

>>> w = parse_wax(s)
print w

[server]
host = "localhost"
port = 1234

Features

  • Context objects can be serialized to / from string
  • Simple hierarchical key structure
  • Key order is maintained
  • Values can be any JSON type
  • Supports comments and annotations

Overview

Easy to construct in code:

>>> w = Wax(message='hello world', num=17)

Access values with indexes:

>>> w['num'] = 18
>>> w.message = 'hello again'
>>> w.get('missing.key', 'no problem')
'no problem'

This object translates directly to a file format. Reading the format will reconstruct the context object exactly. This allows for “round-trip” configuration that can be serialized to utf-8, edited, and read back in:

>>> w = Wax(state='New York', zip=10003)
>>> s = str(w)
>>> print s
state = "New York"
zip = 10003

>>> q = parse_wax(s)
>>> print q
state = "New York"
zip = 10003

Key order is preserved when keys are added individually. If you add them in the constructor, initial order is governed by kwargs (dict) hashing order:

>>> w = Wax(a=1, b=2, c=3)
>>> print w
a = 1
c = 3
b = 2

>>> w = Wax()
>>> w.a = 1
>>> w.b = 2
>>> w.c = 3
>>> print w
a = 1
b = 2
c = 3

Create sublevels by attaching a Wax instance to a key:

>>> w = Wax(level1=Wax(level2=Wax(property='value')))
>>> w = Wax()
>>> w.level1 = Wax()
>>> w.level1.level2 = Wax()
>>> w.level1.level2.property = 'value'

Serializing this:

>>> print w
[level1.level2]
property = "value"

Or you can set dotted keys to create nested values:

>>> w = Wax()
>>> w['foo.bar'] = 123
>>> print w.foo.bar
123

Dotted access can be used in formatting strings:

>>> w = Wax(server=Wax(host='localhost', port=1234))
>>> print 'hostname is %(server.host)s using port %(server.port)s' % w
hostname is localhost using port 1234
Release History

Release History

0.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
python-wax-0.3.tar.gz (15.7 kB) Copy SHA256 Checksum SHA256 Source Oct 2, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting