Skip to content
Snippets Groups Projects
Commit 72ebdc92 authored by TANIGUCHI Takaki's avatar TANIGUCHI Takaki :soccer:
Browse files

New upstream version 0.14.1

parent 8939df88
Branches
Tags upstream/0.14.1
No related merge requests found
......@@ -2,6 +2,14 @@ Changelog
=========
Version 0.14.1
--------------
Document the colon-separated ``node[:port[:compass]]`` format used for ``tail``
and ``head`` points in the ``edge()``- and ``edges()``-methods' (PR Michał
Góral).
Version 0.14
------------
......
Metadata-Version: 2.1
Name: graphviz
Version: 0.14
Version: 0.14.1
Summary: Simple Python interface for Graphviz
Home-page: https://github.com/xflr6/graphviz
Author: Sebastian Bank
......
......@@ -25,7 +25,7 @@ copyright = '2013-2020, Sebastian Bank'
author = 'Sebastian Bank'
# The short X.Y version
version = '0.14'
version = '0.14.1'
# The full version, including alpha/beta/rc tags
release = version
......
......@@ -94,6 +94,8 @@ structs_revisited.py
:align: center
.. _btree.py:
btree.py
--------
......
......@@ -52,7 +52,7 @@ Their constructors allow to set the graph's :attr:`~.Graph.name`, the
:attr:`~.Graph.comment` for the first source code line, etc.
Add nodes and edges to the graph object using its :meth:`~.Graph.node` and
:meth:`~.Graph.edge` or :meth:`~.Graph.edges` methods:
:meth:`~.Graph.edge`- or :meth:`~.Graph.edges`-methods:
.. code:: python
......@@ -261,6 +261,39 @@ key-value pairs targeting the current (sub-)graph (e.g. for ``rankdir``,
:align: center
.. _ports:
Node ports & compass
--------------------
The :meth:`~.Graph.edge`- and :meth:`~.Graph.edges`-methods use the
colon-separated format ``node[:port[:compass]]`` for ``tail`` and ``head``
nodes. This allows to specify an optional node ``port`` plus an optional
``compass`` point the edge should aim at for the given tail or head node
(:ref:`example <btree.py>`).
As colons are used to indicate ``port`` and ``compass``, node names with
literal colon(s) (``:``) are not supported. Note that there is no such
restriction for the ``label`` argument, so you can work around by choosing a
colon-free ``name`` together with the wanted ``label``:
.. code:: python
>>> cpp = Digraph('C++')
>>> cpp.node('A', 'std::string')
>>> cpp.node('B', '"spam"')
>>> cpp.edge('A', 'B')
>>> print(cpp.source) # doctest: +NORMALIZE_WHITESPACE
digraph "C++" {
A [label="std::string"]
B [label="\"spam\""]
A -> B
}
Backslash escapes
-----------------
......@@ -445,7 +478,7 @@ Custom DOT statements
To add arbitrary statements to the created DOT_ source, use the
:attr:`~.Graph.body` attribute of the :class:`.Graph` or :class:`.Digraph`
object. It holds the verbatim list of lines to be written to the source file.
Use its ``append()`` or ``extend()`` method:
Use its ``append()``- or ``extend()``-method:
.. code:: python
......
Metadata-Version: 2.1
Name: graphviz
Version: 0.14
Version: 0.14.1
Summary: Simple Python interface for Graphviz
Home-page: https://github.com/xflr6/graphviz
Author: Sebastian Bank
......
......@@ -17,7 +17,6 @@ docs/license.rst
docs/manual.rst
docs/notebooks.rst
docs/pet-shop.png
docs/requirements.txt
docs/round-table.png
docs/_static/angles.svg
docs/_static/btree.svg
......
......@@ -7,11 +7,11 @@ wheel
twine
[docs]
sphinx>=1.7
sphinx>=1.8
sphinx-rtd-theme
[test]
mock>=3
pytest!=3.10.0,>=3.4
pytest-mock>=1.8
pytest>=4
pytest-mock>=2
pytest-cov
......@@ -41,7 +41,7 @@ __all__ = [
]
__title__ = 'graphviz'
__version__ = '0.14'
__version__ = '0.14.1'
__author__ = 'Sebastian Bank <sebastian.bank@uni-leipzig.de>'
__license__ = 'MIT, see LICENSE.txt'
__copyright__ = 'Copyright (c) 2013-2020 Sebastian Bank'
......
......@@ -133,13 +133,19 @@ class Dot(files.File):
self.body.append(line)
def edge(self, tail_name, head_name, label=None, _attributes=None, **attrs):
"""Create an edge between two nodes.
"""Create an edge between two nodes.
Args:
tail_name: Start node identifier.
head_name: End node identifier.
tail_name: Start node identifier (format: ``node[:port[:compass]]``).
head_name: End node identifier (format: ``node[:port[:compass]]``).
label: Caption to be displayed near the edge.
attrs: Any additional edge attributes (must be strings).
Note:
The ``tail_name`` and ``head_name`` strings are separated by
(optional) colon(s) into ``node`` name, ``port`` name, and
``compass`` (e.g. ``sw``).
See :ref:`details in the User Guide <ports>`.
"""
tail_name = self._quote_edge(tail_name)
head_name = self._quote_edge(head_name)
......@@ -151,7 +157,14 @@ class Dot(files.File):
"""Create a bunch of edges.
Args:
tail_head_iter: Iterable of ``(tail_name, head_name)`` pairs.
tail_head_iter: Iterable of ``(tail_name, head_name)`` pairs (format:``node[:port[:compass]]``).
Note:
The ``tail_name`` and ``head_name`` strings are separated by
(optional) colon(s) into ``node`` name, ``port`` name, and
``compass`` (e.g. ``sw``).
See :ref:`details in the User Guide <ports>`.
"""
edge = self._edge_plain
quote = self._quote_edge
......@@ -198,7 +211,7 @@ class Dot(files.File):
See the :ref:`usage examples in the User Guide <subgraphs>`.
.. note::
Note:
If the ``name`` of the subgraph begins with ``'cluster'`` (all lowercase)
the layout engine will treat it as a special cluster subgraph.
"""
......@@ -255,7 +268,7 @@ class Graph(Dot):
strict (bool): Rendering should merge multi-edges.
Note:
All parameters are optional and can be changed under their
All parameters are `optional` and can be changed under their
corresponding attribute name after instance creation.
"""
......
......@@ -8,7 +8,7 @@ formats = zip
universal = 1
[tool:pytest]
minversion = 3.4
minversion = 4
testpaths = README.rst docs graphviz tests
addopts =
--doctest-modules --doctest-glob='*.rst' --ignore=docs/conf.py
......
......@@ -5,7 +5,7 @@ from setuptools import setup, find_packages
setup(
name='graphviz',
version='0.14',
version='0.14.1',
author='Sebastian Bank',
author_email='sebastian.bank@uni-leipzig.de',
description='Simple Python interface for Graphviz',
......@@ -22,8 +22,8 @@ setup(
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
extras_require={
'dev': ['tox>=3', 'flake8', 'pep8-naming', 'wheel', 'twine'],
'test': ['mock>=3', 'pytest>=3.4,!=3.10.0', 'pytest-mock>=1.8', 'pytest-cov'],
'docs': ['sphinx>=1.7', 'sphinx-rtd-theme'],
'test': ['mock>=3', 'pytest>=4', 'pytest-mock>=2', 'pytest-cov'],
'docs': ['sphinx>=1.8', 'sphinx-rtd-theme'],
},
long_description=io.open('README.rst', encoding='utf-8').read(),
classifiers=[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment