Skip to content

Commit 22e5b13

Browse files
committed
Doc improvements + fixed the coverage by adding an init file in the tests
1 parent e8c78fb commit 22e5b13

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

docs/index.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
[![Build Status](https://travis-ci.org/smarie/python-yamlable.svg?branch=master)](https://travis-ci.org/smarie/python-yamlable) [![Tests Status](https://smarie.github.io/python-yamlable/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-yamlable/junit/report.html) [![codecov](https://codecov.io/gh/smarie/python-yamlable/branch/master/graph/badge.svg)](https://codecov.io/gh/smarie/python-yamlable) [![Documentation](https://img.shields.io/badge/docs-latest-blue.svg)](https://smarie.github.io/python-yamlable/) [![PyPI](https://img.shields.io/badge/PyPI-yamlable-blue.svg)](https://pypi.python.org/pypi/yamlable/)
66

77
PyYaml is a great library. However it is a bit hard for anyone to add the yaml capability to their classes. Its `YamlObject` helper class is a first step but it has two drawbacks:
8+
89
* one has to master PyYaml Loader/Dumper internal features to understand what they are doing
910
* there is a mandatory metaclass, which can prevent wide adoption (multiple inheritance with metaclasses...)
1011

11-
`yamlable` provides a very easy way for you to leverage PyYaml without suffering the complexity: simply inherit from `YamlAble`, decorate with `@yaml_info`, implement the abstract methods to write to / load from a dictionary, and you're set!
12+
`yamlable` provides a very easy way for you to leverage PyYaml without seeing the complexity: simply inherit from `YamlAble`, decorate with `@yaml_info`, implement the abstract methods to write to / load from a dictionary, and you're set!
1213

13-
In addition `yamlable` provides
14-
* a way to creade Yaml codecs for several object types at the same time (`YamlCodec`).
15-
* an alternative to `YamlAble` that relies strictly on `YamlObject`: `YamlObject2`
14+
In addition `yamlable` provides a way to creade Yaml codecs for several object types at the same time (`YamlCodec`) (see Usage page)
1615

1716

1817
## Installing
@@ -24,6 +23,7 @@ In addition `yamlable` provides
2423
## Usage
2524

2625
Let's make a class yaml-able: we have to
26+
2727
- inherit from `YamlAble`
2828
- decorate it with the `@yaml_info` annotation to declare the associated yaml tag
2929
- implement `from_yaml_dict` (class method called during decoding) and `to_yaml_dict` (instance method called during encoding)
@@ -89,14 +89,17 @@ a: 1
8989
b: hello
9090
```
9191

92+
For more general cases where your object is embedded in a more complex structure for example, you can of course call pyyaml `dump`/`load` functions, it will work as expected.
93+
94+
9295
See [Usage](./usage) for other possibilities of `yamlable`.
9396

9497

9598
## Main features / benefits
9699

97100
* Add yaml-ability to any class easily through inheritance without metaclass (as opposed to `YamlObject`) and without knowledge of internal PyYaml loader/dumper logic.
98101
* Write codecs to support several types at a time with `YamlCodec`
99-
102+
* If you absolutely wish to use PyYaml's `YamlObject` for some reason, you can use `YamlObject2` as an alternative to `YamlAble`. But it comes with the metaclass, like `YamlObject`.
100103

101104
## See Also
102105

yamlable/tests/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)