diff --git a/README.md b/README.md index 9b9b2e5..a9040fd 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,14 @@ especially for reading configuration files. OK, stop talking, show us some code! -On the left is what you'll normally do, on the right is the ezcf way. Much more elegant isn't it? +On the left is what you'll normally do, on the right is the ezcf way. +**All you need is `import ezcf` first, then `import filename` without extension.** Nothing else! ![](https://github.com/laike9m/ezcf/raw/master/code_compare.png) +For instance, here we want to load file `config.json`. With a single line of code `import config`, +everything is done and you're happy. + ## Install pip install ezcf @@ -66,6 +70,8 @@ only one of them will be loaded. So it's better not to use multiple documents; 3. All values in `.ini` files are kept as it is and loaded as a string; 4. Since XML only allows single root, the whole xml will be loaded as one dict with root's name as variable name; 5. Namespace package is not supported yet, pull requests are welcome. +6. Use [**valid variable names**][1], this means key strings in JSON/YAML/INI/XML should be valid Python variable name. + Invalid variable name won't do any harm to your program nor will it crash, but you can't use them as expected. ## Run Tests ``` @@ -86,4 +92,7 @@ python setup.py test - [x] pypi ## License -MIT \ No newline at end of file +MIT + + +[1]: https://docs.python.org/3.4/reference/lexical_analysis.html#identifiers \ No newline at end of file diff --git a/README.rst b/README.rst index c03af75..44f0225 100644 --- a/README.rst +++ b/README.rst @@ -10,12 +10,16 @@ from these formats, especially for reading configuration files. OK, stop talking, show us some code! -On the left is what you'll normally do, on the right is the ezcf way. -Much more elegant isn't it? +| On the left is what you'll normally do, on the right is the ezcf way. +| **All you need is ``import ezcf`` first, then ``import filename`` +without extension.** Nothing else! .. figure:: https://github.com/laike9m/ezcf/raw/master/code_compare.png :alt: +For instance, here we want to load file ``config.json``. With a single +line of code ``import config``, everything is done and you're happy. + Install ------- @@ -84,6 +88,11 @@ Something to note before using ezcf: 4. Since XML only allows single root, the whole xml will be loaded as one dict with root's name as variable name; 5. Namespace package is not supported yet, pull requests are welcome. +6. Use `**valid variable + names** `__, + this means key strings in JSON/YAML/INI/XML should be valid Python + variable name. Invalid variable name won't do any harm to your + program nor will it crash, but you can't use them as expected. Run Tests --------- @@ -109,7 +118,7 @@ Roadmap License ------- -MIT +MMIT .. |Build Status| image:: https://travis-ci.org/laike9m/ezcf.svg :target: https://travis-ci.org/laike9m/ezcf diff --git a/ezcf/__init__.py b/ezcf/__init__.py index 35fb5dd..ebf60c5 100644 --- a/ezcf/__init__.py +++ b/ezcf/__init__.py @@ -1,6 +1,6 @@ __author__ = "laike9m (laike9m@gmail.com)" __title__ = 'ezcf' -__version__ = '0.0.1' +__version__ = '0.2.0' __license__ = 'MIT' __copyright__ = 'Copyright 2015 laike9m'