Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhayes authored and Alex Hayes committed Oct 31, 2016
1 parent 925addb commit 69c9b6e
Show file tree
Hide file tree
Showing 37 changed files with 1,794 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "scripts/git-tools"]
path = scripts/git-tools
url = https://github.com/alexhayes/git-tools.git
37 changes: 37 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
language: python
matrix:
include:
# Python 3.4
- python: 3.4
env: TOXENV=py34

# Python 3.3
- python: 3.3
env: TOXENV=py33

# Python 3.5
- python: 3.5
env: TOXENV=py35

# pypy
- python: pypy
env: TOXENV=pypy

# pypy
- python: pypy3
env: TOXENV=pypy3

install:
- pip install tox
- pip install codecov
- pip install Django==1.10
- pip install -r requirements/test.txt
- pip install -r requirements/docs.txt

script:
- py.test --cov=schematics_xml
- pylint schematics_xml
- cd docs && make clean html

after_success:
- bash <(curl -s https://codecov.io/bash)
Empty file added CHANGELOG.md
Empty file.
13 changes: 13 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
include VERSION
include CHANGELOG.md
include LICENSE
include README.rst
include MANIFEST.in
include setup.py

recursive-include docs *
recursive-include requirements *.txt *.rst

recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-exclude * .*.sw[a-z]
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

77 changes: 77 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
==============
schematics-xml
==============

Python schematics_ models for converting to and from XML.

.. image:: https://travis-ci.org/alexhayes/schematics-xml.png?branch=master
:target: https://travis-ci.org/alexhayes/schematics-xml
:alt: Build Status

.. image:: https://landscape.io/github/alexhayes/schematics-xml/master/landscape.png
:target: https://landscape.io/github/alexhayes/schematics-xml/
:alt: Code Health

.. image:: https://codecov.io/github/alexhayes/schematics-xml/coverage.svg?branch=master
:target: https://codecov.io/github/alexhayes/schematics-xml?branch=master
:alt: Code Coverage

.. image:: https://readthedocs.org/projects/schematics-xml/badge/
:target: http://schematics-xml.readthedocs.org/en/latest/
:alt: Documentation Status

.. image:: https://img.shields.io/pypi/v/schematics-xml.svg
:target: https://pypi.python.org/pypi/schematics-xml
:alt: Latest Version

.. image:: https://img.shields.io/pypi/pyversions/schematics-xml.svg
:target: https://pypi.python.org/pypi/schematics-xml/
:alt: Supported Python versions


Install
-------

.. code-block:: bash
pip install schematics-xml
Example Usage
-------------

Simply inherit XMLModel.

.. code-block:: python
from schematics_xml import XMLModel
class Person(XMLModel):
name = StringType()
john = Person(dict(name='John'))
xml = john.to_xml()
XML now contains;

.. code-block:: xml
<?xml version='1.0' encoding='ISO-8859-1'?>
<person>
<name>John</name>
</person>
And back the other way;

.. code-block:: python
john = Person.from_xml(xml)
Author
------

Alex Hayes <alex@alution.com>

.. _schematics: https://schematics.readthedocs.io
Empty file added VERSION
Empty file.
9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
codecov:
branch: develop
bot: alexhayes

comment:
layout: "header, diff, changes, sunburst, uncovered, tree"
branches:
- *
behavior: default
140 changes: 140 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
PROJECT = schematics-xml

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " apidoc to regenerate API docs.
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"

clean:
-rm -rf $(BUILDDIR)/*

apidoc:
sphinx-apidoc -f -o internals/reference ../schematics_xml
cat internals/reference/index.tpl > internals/reference/index.rst
ls -1 internals/reference | fgrep -v index.rst | fgrep -v index.tpl | sed -e 's/.rst//g' -e 's/^/ /g' >> internals/reference/index.rst
@echo "Auto generated internals/reference/index.rst"
@echo
@echo "Build finished. The autogenerate API docs are in internals/reference."

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."

json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/$(PROJECT).qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/$(PROJECT).qhc"

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/$(PROJECT)"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/$(PROJECT)"
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."

man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
60 changes: 60 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import pkg_resources
import sys
import os
import sphinx_rtd_theme

this = os.path.dirname(os.path.abspath(__file__))


# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
sys.path.insert(0, os.path.join(this, os.pardir))

from schematics_xml import __version__

# Monkey patch to get around https://github.com/sphinx-doc/sphinx/issues/1254

extensions = ['sphinx.ext.autodoc',
'sphinx.ext.viewcode',
#'sphinx.ext.intersphinx',
]

templates_path = []
source_suffix = '.rst'
master_doc = 'index'
project = 'schematics-xml'
copyright_holder = 'Alex Hayes'
copyright = u'2016, %s' % copyright_holder
exclude_patterns = ['_build']
pygments_style = 'sphinx'
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
htmlhelp_basename = '%sdoc' % project

latex_documents = [
('index', '%s.tex' % project, u'%s Documentation' % project, copyright_holder, 'manual'),
]
man_pages = [
('index', project, u'%s Documentation' % project,
[copyright_holder], 1)
]

version = __version__
release = version

# autodoc_default_flags = ['members', 'private-members', 'special-members',
# 'undoc-members',
# 'show-inheritance']

def autodoc_skip_member(app, what, name, obj, skip, options):
exclusions = ('__weakref__', # special-members
'__doc__', '__module__', '__dict__', # undoc-members
)
exclude = name in exclusions
return skip or exclude

def setup(app):
app.connect('autodoc-skip-member', autodoc_skip_member)


43 changes: 43 additions & 0 deletions docs/developer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Developer Documentation
=======================

Contributions
-------------

Contributions are more than welcome!

To get setup do the following;

.. code-block:: bash
mkvirtualenv --python=/usr/bin/python3.5 schematics-xml
git clone https://github.com/alexhayes/schematics-xml.git
cd schematics-xml
pip install -r requirements/dev.txt
pip install Django>=1.9,<1.10
Running Tests
-------------

Once you've checked out you should be able to run the tests;

.. code-block:: bash
tox
Or run all environments at once using detox;

.. code-block:: bash
detox
Creating Documentation
----------------------

.. code-block:: bash
cd docs
make clean html

0 comments on commit 69c9b6e

Please sign in to comment.