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

Enhanced PyYAML

It makes PyYAML more convenient and avoids duplicate YAML data.

Here is the features:

  • by deafult, use name of class as the yaml_tag of YAMLObject
  • load anchor & as an attribute anchor of YAMLObject instance
  • dump the attribute anchor of YAMLObject instance as the anchor & name


You can install it via PyPI,

sudo pip install enhancedyaml

or download it manually.


Here is the yaml file:

# examples/enhanced_data.yaml

%YAML 1.1
    - !Example &first
        data: I am the first one.
    - !Example &second
        data: I am the second one.
    - \*first
    - \*second

Create an YAMLObject without specifiying yaml_tag

import enhancedyaml

class Example(enhancedyaml.YAMLObject): pass

Loaded YAML


from pprint import pprint

data = enhancedyaml.load(open('data/enhanced_data.yaml'))


{'examples': [<__main__.Example object at 0x7fa825fb4fd0>,

              <__main__.Example object at 0x7fa825fb4cd0>],
 'order': [<__main__.Example object at 0x7fa825fb4fd0>,
           <__main__.Example object at 0x7fa825fb4cd0>]}

Content of data[‘order’]


pprint(list(example.__dict__ for example in data['order']))


[{'anchor': u'first', 'data': 'I am the first one.'},
 {'anchor': u'second', 'data': 'I am the second one.'}]

Example has addational attribute anchor.

Dump Data Again


print enhancedyaml.dump(data, default_flow_style=False)


- &first !Example
  data: I am the first one.
- &second !Example
  data: I am the second one.
- \*first
- \*second

It is almost same as the original YAML.

Dump Objects Which are Generated in Runtime


e1 = Example()
e2 = Example() = "I don't have `anchor`." = "I don't have `anchor`, too."
es = [e1, e2, e2, e1]
print enhancedyaml.dump(es, default_flow_style=False)


- &example002 !Example
  data: I don't have `anchor`.
- &example001 !Example
  data: I don't have `anchor`, too.
- \*example001
- \*example002

You can find more examples in enhancedyaml/examples directory.

Have fun!

Release History

Release History


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

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
enhancedyaml-v0.1.1.tar.gz (3.1 kB) Copy SHA256 Checksum SHA256 Source May 20, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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