diff options
author | Bob Halley <halley@dnspython.org> | 2016-12-31 10:30:47 -0800 |
---|---|---|
committer | Bob Halley <halley@dnspython.org> | 2016-12-31 10:30:47 -0800 |
commit | d1289a7d1a0ffc9a26b2c2f87b96b947a5b261ab (patch) | |
tree | f3e8022bcd2f438d2374f8c8911655136d9ed67f /doc | |
parent | 5e87e2d2c7a5c84d2fd721ae2647656693c6af0a (diff) | |
download | dnspython-d1289a7d1a0ffc9a26b2c2f87b96b947a5b261ab.tar.gz |
initial Sphinx work
Diffstat (limited to 'doc')
-rw-r--r-- | doc/.gitignore | 1 | ||||
-rw-r--r-- | doc/Makefile | 20 | ||||
-rw-r--r-- | doc/conf.py | 158 | ||||
-rw-r--r-- | doc/index.rst | 26 | ||||
-rw-r--r-- | doc/name-class.rst | 21 | ||||
-rw-r--r-- | doc/name-codecs.rst | 65 | ||||
-rw-r--r-- | doc/name-exceptions.rst | 16 | ||||
-rw-r--r-- | doc/name-make.rst | 8 | ||||
-rw-r--r-- | doc/name.rst | 41 | ||||
-rw-r--r-- | doc/py2vs3.rst | 18 |
10 files changed, 374 insertions, 0 deletions
diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 0000000..e35d885 --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1 @@ +_build diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..ff97397 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = dnspython +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)
\ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 0000000..15e25ac --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,158 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# dnspython documentation build configuration file, created by +# sphinx-quickstart on Fri Dec 30 05:55:44 2016. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath('..')) + + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.viewcode', + 'sphinx.ext.githubpages'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = 'dnspython' +copyright = '2016, Nominum, Inc.' +author = 'Nominum, Inc.' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '1.16' +# The full version, including alpha/beta/rc tags. +release = '1.16.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'dnspythondoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'dnspython.tex', 'dnspython Documentation', + 'Nominum, Inc.', 'manual'), +] + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'dnspython', 'dnspython Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'dnspython', 'dnspython Documentation', + author, 'dnspython', 'One line description of project.', + 'Miscellaneous'), +] + + + diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..4dbfcce --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,26 @@ +.. dnspython documentation master file + +dnspython +========= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + py2vs3.rst + name.rst + +.. toctree:: + :hidden: + + name-class.rst + name-make.rst + name-exceptions.rst + name-codecs.rst + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/doc/name-class.rst b/doc/name-class.rst new file mode 100644 index 0000000..4974446 --- /dev/null +++ b/doc/name-class.rst @@ -0,0 +1,21 @@ +.. _name-class: + +The dns.name.Name Class and Predefined Names +-------------------------------------------- + +.. autoclass:: dns.name.Name + :members: + + .. attribute:: labels + + A tuple of ``binary`` in DNS wire format specifying the DNS + labels in the name, in order from least-signficiant label + (i.e. farthest from the origin) to most-significant label. + +.. data:: dns.name.root + + The root name, i.e. ``dns.name.Name([b''])``. + +.. data:: dns.name.empty + + The empty name, i.e. ``dns.name.Name([])``. diff --git a/doc/name-codecs.rst b/doc/name-codecs.rst new file mode 100644 index 0000000..851e00d --- /dev/null +++ b/doc/name-codecs.rst @@ -0,0 +1,65 @@ +.. _name-codecs: + +International Domain Name CODECs +-------------------------------- + +Representing non-ASCII text in the DNS is a complex and evolving +topic. Generally speaking, Unicode is converted into an ASCII-only, +case-insensitive form called "Punycode" by complex rules. There are +two standard specifications for this process, "IDNA 2003", which is +widely used, and the revised and not fully compatible standard "IDNA +2008". There are also varying degrees of strictness that can be applied +in encoding and decoding. Explaining the standards in detail is +out of scope for this document; Unicode Technical Standard #46 +http://unicode.org/reports/tr46/ is a good place to start learning more. + +Dnspython provides "codecs" to implement International Domain Name policy +according to the user's desire. + +.. autoclass:: dns.name.IDNACodec + :members: +.. autoclass:: dns.name.IDNA2003Codec + :members: +.. autoclass:: dns.name.IDNA2008Codec + :members: + +.. data:: dns.name.IDNA_2003_Practical + + The "practical" codec encodes using IDNA 2003 rules and decodes + punycode without checking for strict IDNA 2003 compliance. + +.. data:: dns.name.IDNA_2003_Strict + + The "strict" codec encodes using IDNA 2003 rules and decodes + punycode checking for IDNA 2003 compliance. + +.. data:: dns.name.IDNA_2003 + + A synonym for ``dns.name.IDNA_2003_Practical``. + +.. data:: dns.name.IDNA_2008_Practical + + The "practical" codec encodes using IDNA 2008 rules with UTS 46 + compatibility processing, and allowing pure ASCII labels. It + decodes punycode without checking for strict IDNA 2008 compliance. + +.. data:: dns.name.IDNA_2008_Strict + + The "strict" codec encodes using IDNA 2008 rules and decodes + punycode checking for IDNA 2008 compliance. + +.. data:: dns.name.IDNA_2008_UTS_46 + + The "UTS 46" codec encodes using IDNA 2008 rules with UTS 46 + compatibility processing and decodes punycode without checking for + IDNA 2008 compliance. + +.. data:: dns.name.IDNA_2008_Transitional + + The "UTS 46" codec encodes using IDNA 2008 rules with UTS 46 + compatibility processing in the "transitional mode" and decodes + punycode without checking for IDNA 2008 compliance. + +.. data:: dns.name.IDNA_2008 + + A synonym for ``dns.name.IDNA_2008_Practical``. diff --git a/doc/name-exceptions.rst b/doc/name-exceptions.rst new file mode 100644 index 0000000..1e616ed --- /dev/null +++ b/doc/name-exceptions.rst @@ -0,0 +1,16 @@ +.. _name-exceptions: + +dns.name Exceptions +------------------- + +.. autoexception:: dns.name.AbsoluteConcatenation +.. autoexception:: dns.name.BadEscape +.. autoexception:: dns.name.BadLabelType +.. autoexception:: dns.name.BadPointer +.. autoexception:: dns.name.EmptyLabel +.. autoexception:: dns.name.IDNAException +.. autoexception:: dns.name.LabelTooLong +.. autoexception:: dns.name.NameTooLong +.. autoexception:: dns.name.NeedAbsoluteNameOrOrigin +.. autoexception:: dns.name.NoIDNA2008 +.. autoexception:: dns.name.NoParent diff --git a/doc/name-make.rst b/doc/name-make.rst new file mode 100644 index 0000000..1c23d8d --- /dev/null +++ b/doc/name-make.rst @@ -0,0 +1,8 @@ +.. _name-make: + +Making DNS Names +---------------- + +.. autofunction:: dns.name.from_text +.. autofunction:: dns.name.from_unicode +.. autofunction:: dns.name.from_wire diff --git a/doc/name.rst b/doc/name.rst new file mode 100644 index 0000000..b350d13 --- /dev/null +++ b/doc/name.rst @@ -0,0 +1,41 @@ +DNS Names +========= + +Objects of the dns.name.Name class represent an immutable aomain name. +The representation is a tuple of labels, with each lable being a ``binary`` +object in the DNS wire format. Typically names are not created by +supplying the labels tuple directly, but rather by converting from DNS +text format or the DNS wire format. + +Labels are in the same order as in the DNS textual form, e.g. the labels +value for ``www.dnspython.org.`` is ``(b'www', b'dnspython', b'org', b'')`` on +Python 3, and ``('www', 'dnspython', 'org', '')`` on Python 2. + +Names may be *absolute* or *relative*. Absolute names end in the root label, +which is an empty ``binary``. Relative names do not end in the root label. To +convert a relative name to an absolute name requires specifying an *origin*. +Typically the origin is known by context. Dnspython provides tools to +relativize and derelativize names. It's a good idea not to mix relative +and absolute names, other than in the context of a zone. Names encoded +in the DNS wire protocol are always absolute. Dnspython's functions to +make names from text also default to an origin of the root name, and thus +to make a relative name using them you must specify an origin of None or +``dns.name.empty``. + +Names are compared and ordered according to the rules of the DNS. The +order is the DNSSEC canonical ordering. Relative names always sort before +absolute names. + +Names may also be compared according to the DNS tree hierarchy with +the ``fullcompare()`` method. For example ```www.dnspython.org.`` is +a subdomain of ``dnspython.org.``. See the method description for +full details. + +:ref:`name-class` + +:ref:`name-make` + +:ref:`name-exceptions` + +:ref:`name-codecs` + diff --git a/doc/py2vs3.rst b/doc/py2vs3.rst new file mode 100644 index 0000000..f926efe --- /dev/null +++ b/doc/py2vs3.rst @@ -0,0 +1,18 @@ +Python 2 vs. Python 3 +--------------------- + +Dnspython was originally written in Python 2, and for some years had a +separate Python 3 branch. Thanks to some excellent work by +contributors to the project, there is now a single source tree that +works for both. + +The most significant user-visible differences between the two are in +the representations of binary data and textual data. For Python 3, +binary data stored using the `bytes` type, and textual data is stored +using the `str` type. For Python 2, binary data is stored using the +`str` type, and textual data can use the `str` or `unicode` types. +Because there is a single source tree, the documentation will refer to +`binary` and `text` when describing the types of binary data or +textual data, respectively. + + |