Skip to content

Commit

Permalink
Finish 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-eschle committed Jan 21, 2018
2 parents a5f9823 + 1d281b5 commit 0520310
Show file tree
Hide file tree
Showing 32 changed files with 1,670 additions and 155 deletions.
22 changes: 22 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
engines:
duplication:
enabled: true
config:
languages:
- python
fixme:
enabled: true
radon:
enabled: true
config:
python_version: 3
ratings:
paths:
- "**.py"
exclude_paths:
- tests/
- docs/
- build/
- dist/

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
build
dist
MANIFEST
/.hypothesis/
*.coverage
24 changes: 24 additions & 0 deletions .landscape.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
strictness: veryhigh
#pylint:
# disable:
# - too-many-arguments
# - too-many-statements
# - too-many-locals
# - too-many-branches
# - redefined-builtin

ignore-paths:
- docs/
- tests/
python-targets:
- 2
- 3

pep8:
full: true

doc-warnings: true
max-line-length: 110



56 changes: 56 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

os:
- linux
# - osx
language: python
python:
- '2.7'
- '3.4'
- '3.5'
- '3.6'
matrix:
include:
- os: osx
language: generic

#cache: pip

before_install:

- . ci/install_conda.sh

- . ci/setup_env.sh

install:
- pip install .

script:
- . ci/install_tester.sh

- . ci/run_tests.sh

- . ci/testbuild_docs.sh

after_success:
- coveralls



deploy:
- provider: pypi
user: phynix
password:
secure: "K4sQLzchDacZK5q/fMndLO+max2cMSA+a+TEk3HCl9+ALo99E8ywBEQJPzoSDwC8/7O3HZA884I16pDMpTjX7TBMgvOTGwCGWISdCPJXy7h7exer4VzwU24V48S8cPLBp5Gw/5aMUmDGW9d9btTxccKT0F312DRszyM+uLOPAvdAv9J5FucVXWy87CjdNp3/W1U8N4rzBtsFKbG5zOn/xU4DH/BxwovUs9n/Jl2YC7UxG7dUV4qeY0vucMyhrXRHM9bh4zLxXdtNKoCuPSrE/z5R4qMD588+o/1j5em1TASriynTWQnQLkunJ6J1cZkZ8HRjcFdgK9wRO7Dlf2KAIrhPtl/R1dZVFaeY+QLQQVNTsTHzPrZpp6c+mdPk8GfQhy+oUEQ+4rZMt44WD8AhLZO6aPuM0+0BxLus0qZ+AHUZnJHh0GlmsHoMLBBrx4hf+emCip5EF4lY7lThHNSlnxRXKKoZyUf2njJShzCHQtvm3+keit+N9TfCKhzABGzldjWYDrtSVBCyW5Hvwrm/QICMDXf2r38qcF6+Tiea6IyQjs9Zn38T3/BeJPTHHIpIYP2jKmlvtqkhc3XsXAcTx8YF0VnL4gjZAkoVmQ/KoRjxZGHkSDm04CinYPoDgGDumsKomyhgzxWF494Wp1+UOEI8gGcSFsiQOH2C8EpVVDo="
distributions: sdist bdist_wheel
on:
branch: master
condition: $TRAVIS_PYTHON_VERSION = "3.6" && $TRAVIS_OS_NAME = "linux"

- provider: pages
skip_cleanup: true
github_token:
secure: "CqHGP/iah+GiUJVrScDTCbmSz+1CqQ7vdxS0o9PF7mfnGgnqfu38FKz6OA85vrI1XY0L6hE9SlPId4yH3EiG8y19XKMLd4EMAg3WlA0T9Z2hgafOSa0ZHkZi32yJfVzoPYspvRyXYZQ7ggRj6l3XGvsioY3023R5CPRPBGEVU38WHvl2Fskd+lDvwkBwVHSmy6kAxtPJe1z84oJhheHNtSuOtKlezdnndmU0wO2hX08wPegluuACe8ez08Qe8OB56X7sZCHoWvstZE6xdBkSjjnRb54Dm7Ll6313PHQHSXI0JBDDtKfRrqaI6J7ByieZA1SPNXtzsnq0/Hr47GvJ3Whcvc1tCaeEMt3q/JTCLcBOG0oRNZeJUiXObkX7PyHOCdUmLJ/brOeLHyTNnUFoHHr3IXFqLUqVnSjf/BoMeeW66Tfq/1BoyrInwpIoOJzN+aH0vjXXPFhUOUZq2dizMopSQ9IcG/etmrsF0LokqVaUS8nrJzS//n85UXa9U0EFpVd7VHzPwt9L8OZIAIe5SIBhkGyAMlcm059pmF7dPZL2rsfZ1JSZS6/lyXggI/cW+cYnJ8z7bDl2xqCkEAWlLJCyNTwJeoZe4NJxUM96yKyQSLilQxqDoIgvxYb9LN5qJ2WF4IFVVh0uRD9Wb+nEqVEc/pyXSRYR+jpjuj0T8I8="
local_dir: docs/api/_build/html
on:
branch: master
condition: $TRAVIS_PYTHON_VERSION = "3.6" && $TRAVIS_OS_NAME = "linux"
26 changes: 26 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
Copyright 2017 Jonas Eschle

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.




Parts of the code, mostly from ordereddict.py including within others
the functions construct_yaml_map, construct_mapping are licensed under the
following license.

Copyright 2017 François Ménabé

Permission is hereby granted, free of charge, to any person obtaining a copy of
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
include README.rst
include LICENSE.txt
include requirements.txt
87 changes: 47 additions & 40 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,78 +1,85 @@
python-yamlordereddictloader
============================
.. image:: https://travis-ci.org/Phynix/yamlloader.svg?branch=master
:target: https://travis-ci.org/Phynix/yamlloader
.. image:: https://landscape.io/github/Phynix/yamlloader/master/landscape.svg?style=flat
:target: https://landscape.io/github/Phynix/yamlloader/master
:alt: Code Health
.. image:: https://www.versioneye.com/user/projects/5a2f00060fb24f07e40988bf/badge.svg?style=flat-square
:target: https://www.versioneye.com/user/projects/5a2f00060fb24f07e40988bf
:alt: Dependency Status
.. image:: https://coveralls.io/repos/github/Phynix/yamlloader/badge.svg
:target: https://coveralls.io/github/Phynix/yamlloader

.. image:: https://img.shields.io/pypi/l/yamlordereddictloader.svg
:target: https://opensource.org/licenses/MIT
:alt: License
yamlloader
==========

.. image:: https://img.shields.io/pypi/pyversions/yamlordereddictloader.svg
:target: https://pypi.python.org/pypi/yamlordereddictloader
:alt: Versions
This project was mirrored from `yamlordereddict <https://github.com/fmenabe/python-yamlordereddictloader>`_
Many thanks to the original author François Ménabé! It contains several improvements including
the much faster C-versions of the Loaders/Dumpers.

.. image:: https://img.shields.io/pypi/v/yamlordereddictloader.svg
:target: https://pypi.python.org/pypi/yamlordereddictloader
:alt: PyPi
This module provides loaders and dumpers for PyYAML. Currently, an OrderedDict loader/dumper is
implemented, allowing to keep items order
when loading resp. dumping a file from/to an OrderedDict.

.. image:: https://img.shields.io/badge/github-repo-yellow.jpg
:target: https://github.com/fmenabe/python-yamlordereddictloader
:alt: Code repo
`API Documentation <https://phynix.github.io/yamlloader/index.html>`_

.. image:: https://landscape.io/github/fmenabe/python-yamlordereddictloader/master/landscape.svg?style=flat
:target: https://landscape.io/github/fmenabe/python-yamlordereddictloader/master
:alt: Code Health

Install
-------
It is recommended to use the pip or anaconda version

This module provide a loader and a dumper for PyYAML allowing to keep items order
when loading a file (by putting them in ``OrderedDict`` objects) and to manage
``OrderedDict`` objects when dumping to a file.
.. code-block:: bash
The loader is based on stackoverflow topic (thanks to Eric Naeseth):
http://stackoverflow.com/questions/5121931/in-python-how-can-you-load-yaml-mappings-as-ordereddicts#answer-5121963
$ pip install yamlloader
Self promotion: I use it a lot with `clg <https://clg.readthedocs.io>`_, which
allows to generate command-line definition from a configuration file, for keeping
order of subcommands, options and arguments in the help message!
or

.. code-block:: bash
To install it
-------------
$ conda install yamlloader -c phynix
.. code-block:: bash
$ pip install yamlordereddictloader
But does [your special case here] also work?
--------------------------------------------

Tests are run continuously using randomly generated yaml files.
Also, there are no fails to be expected.

Still, if you are concerned that *your* special case may breaks in the future, please
add your own tests as `test_ext_anyname.py` under `tests/` or let us know about your needs.
This guarantees that no code will be added that breaks *your* case.


Loader usage
------------

.. code-block:: python
import yaml
import yamlordereddictloader
import yamlloader
data = yaml.load(open('myfile.yml'), Loader=yamlordereddictloader.Loader)
data = yaml.load(open('myfile.yml'), Loader=yamlloader.ordereddict.CLoader) # CLoader is faster than Loader
**Note:** For using the safe loader (which want standard YAML tags and does
not construct arbitrary Python objects), replace ``yamlorderdictloader.Loader`` by
``yamlorderedictloader.SafeLoader``.
**Note:** For using the safe loader (which takes standard YAML tags and does
not construct arbitrary Python objects), replace ``yamlorderdictloader.CLoader`` by
``yamlorderedictloader.CSafeLoader``.

Dumper usage
------------

.. code-block:: python
import yaml
import yamlordereddictloader
import yamlloader
from collections import OrderedDict
data = OrderedDict([
('key1', 'val1'),
('key2', OrderedDict([('key21', 'val21'), ('key22', 'val22')]))
])
yaml.dump(
data,
open('myfile.yml', 'w'),
Dumper=yamlordereddictloader.Dumper,
default_flow_style=False)
yaml.dump(data,
open('myfile.yml', 'w'),
Dumper=yamlloader.ordereddict.CDumper,
default_flow_style=False)
**Note:** For using the safe dumper (which produce standard YAML tags and does
not represent arbitrary Python objects), replace ``yamlorderdictloader.Dumper`` by
Expand Down
16 changes: 16 additions & 0 deletions ci/install_conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O anaconda.sh;
PHYNIX_PYTHON_VERSION=$TRAVIS_PYTHON_VERSION;
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
PHYNIX_PYTHON_VERSION="3.6";
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -O anaconda.sh;
fi

bash anaconda.sh -b -p $HOME/anaconda > tmp.txt && echo "alive"
export PATH="$HOME/anaconda/bin:$PATH"
hash -r
conda config --set always_yes yes --set changeps1 no

conda info -a
5 changes: 5 additions & 0 deletions ci/install_tester.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# install test environment
conda install -y coverage > tmp.txt && echo "alive";
pip install coveralls > tmp.txt && echo "alive";
pip install hypothesis
4 changes: 4 additions & 0 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

#- coverage run -m unittest discover
coverage run --branch -m unittest discover && coverage report yamlloader/*.py
5 changes: 5 additions & 0 deletions ci/setup_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
conda create -q --name=yamlloader-env python=$PHYNIX_PYTHON_VERSION > tmp.txt && echo "alive"
source activate yamlloader-env


6 changes: 6 additions & 0 deletions ci/testbuild_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
# test build docs
echo "============================ Building docs for test ============================"
conda install sphinx sphinx_rtd_theme > tmp.txt && echo 'doc utils installed'
bash docs/make_docs.sh 2>&1 | tail -n 11 && \
echo "======================= Finished building docs for test ========================"
20 changes: 20 additions & 0 deletions docs/api/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = yamlloader
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading

0 comments on commit 0520310

Please sign in to comment.