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
No related branches found
No related tags found
No related merge requests found
...@@ -2,6 +2,14 @@ Changelog ...@@ -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 Version 0.14
------------ ------------
......
Metadata-Version: 2.1 Metadata-Version: 2.1
Name: graphviz Name: graphviz
Version: 0.14 Version: 0.14.1
Summary: Simple Python interface for Graphviz Summary: Simple Python interface for Graphviz
Home-page: https://github.com/xflr6/graphviz Home-page: https://github.com/xflr6/graphviz
Author: Sebastian Bank Author: Sebastian Bank
......
...@@ -25,7 +25,7 @@ copyright = '2013-2020, Sebastian Bank' ...@@ -25,7 +25,7 @@ copyright = '2013-2020, Sebastian Bank'
author = 'Sebastian Bank' author = 'Sebastian Bank'
# The short X.Y version # The short X.Y version
version = '0.14' version = '0.14.1'
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
release = version release = version
......
...@@ -94,6 +94,8 @@ structs_revisited.py ...@@ -94,6 +94,8 @@ structs_revisited.py
:align: center :align: center
.. _btree.py:
btree.py btree.py
-------- --------
......
...@@ -52,7 +52,7 @@ Their constructors allow to set the graph's :attr:`~.Graph.name`, the ...@@ -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. :attr:`~.Graph.comment` for the first source code line, etc.
Add nodes and edges to the graph object using its :meth:`~.Graph.node` and 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 .. code:: python
...@@ -261,6 +261,39 @@ key-value pairs targeting the current (sub-)graph (e.g. for ``rankdir``, ...@@ -261,6 +261,39 @@ key-value pairs targeting the current (sub-)graph (e.g. for ``rankdir``,
:align: center :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 Backslash escapes
----------------- -----------------
...@@ -445,7 +478,7 @@ Custom DOT statements ...@@ -445,7 +478,7 @@ Custom DOT statements
To add arbitrary statements to the created DOT_ source, use the To add arbitrary statements to the created DOT_ source, use the
:attr:`~.Graph.body` attribute of the :class:`.Graph` or :class:`.Digraph` :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. 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 .. code:: python
......
Metadata-Version: 2.1 Metadata-Version: 2.1
Name: graphviz Name: graphviz
Version: 0.14 Version: 0.14.1
Summary: Simple Python interface for Graphviz Summary: Simple Python interface for Graphviz
Home-page: https://github.com/xflr6/graphviz Home-page: https://github.com/xflr6/graphviz
Author: Sebastian Bank Author: Sebastian Bank
......
...@@ -17,7 +17,6 @@ docs/license.rst ...@@ -17,7 +17,6 @@ docs/license.rst
docs/manual.rst docs/manual.rst
docs/notebooks.rst docs/notebooks.rst
docs/pet-shop.png docs/pet-shop.png
docs/requirements.txt
docs/round-table.png docs/round-table.png
docs/_static/angles.svg docs/_static/angles.svg
docs/_static/btree.svg docs/_static/btree.svg
......
...@@ -7,11 +7,11 @@ wheel ...@@ -7,11 +7,11 @@ wheel
twine twine
[docs] [docs]
sphinx>=1.7 sphinx>=1.8
sphinx-rtd-theme sphinx-rtd-theme
[test] [test]
mock>=3 mock>=3
pytest!=3.10.0,>=3.4 pytest>=4
pytest-mock>=1.8 pytest-mock>=2
pytest-cov pytest-cov
...@@ -41,7 +41,7 @@ __all__ = [ ...@@ -41,7 +41,7 @@ __all__ = [
] ]
__title__ = 'graphviz' __title__ = 'graphviz'
__version__ = '0.14' __version__ = '0.14.1'
__author__ = 'Sebastian Bank <sebastian.bank@uni-leipzig.de>' __author__ = 'Sebastian Bank <sebastian.bank@uni-leipzig.de>'
__license__ = 'MIT, see LICENSE.txt' __license__ = 'MIT, see LICENSE.txt'
__copyright__ = 'Copyright (c) 2013-2020 Sebastian Bank' __copyright__ = 'Copyright (c) 2013-2020 Sebastian Bank'
......
...@@ -133,13 +133,19 @@ class Dot(files.File): ...@@ -133,13 +133,19 @@ class Dot(files.File):
self.body.append(line) self.body.append(line)
def edge(self, tail_name, head_name, label=None, _attributes=None, **attrs): 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: Args:
tail_name: Start node identifier. tail_name: Start node identifier (format: ``node[:port[:compass]]``).
head_name: End node identifier. head_name: End node identifier (format: ``node[:port[:compass]]``).
label: Caption to be displayed near the edge. label: Caption to be displayed near the edge.
attrs: Any additional edge attributes (must be strings). 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) tail_name = self._quote_edge(tail_name)
head_name = self._quote_edge(head_name) head_name = self._quote_edge(head_name)
...@@ -151,7 +157,14 @@ class Dot(files.File): ...@@ -151,7 +157,14 @@ class Dot(files.File):
"""Create a bunch of edges. """Create a bunch of edges.
Args: 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 edge = self._edge_plain
quote = self._quote_edge quote = self._quote_edge
...@@ -198,7 +211,7 @@ class Dot(files.File): ...@@ -198,7 +211,7 @@ class Dot(files.File):
See the :ref:`usage examples in the User Guide <subgraphs>`. See the :ref:`usage examples in the User Guide <subgraphs>`.
.. note:: Note:
If the ``name`` of the subgraph begins with ``'cluster'`` (all lowercase) If the ``name`` of the subgraph begins with ``'cluster'`` (all lowercase)
the layout engine will treat it as a special cluster subgraph. the layout engine will treat it as a special cluster subgraph.
""" """
...@@ -255,7 +268,7 @@ class Graph(Dot): ...@@ -255,7 +268,7 @@ class Graph(Dot):
strict (bool): Rendering should merge multi-edges. strict (bool): Rendering should merge multi-edges.
Note: 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. corresponding attribute name after instance creation.
""" """
......
...@@ -8,7 +8,7 @@ formats = zip ...@@ -8,7 +8,7 @@ formats = zip
universal = 1 universal = 1
[tool:pytest] [tool:pytest]
minversion = 3.4 minversion = 4
testpaths = README.rst docs graphviz tests testpaths = README.rst docs graphviz tests
addopts = addopts =
--doctest-modules --doctest-glob='*.rst' --ignore=docs/conf.py --doctest-modules --doctest-glob='*.rst' --ignore=docs/conf.py
......
...@@ -5,7 +5,7 @@ from setuptools import setup, find_packages ...@@ -5,7 +5,7 @@ from setuptools import setup, find_packages
setup( setup(
name='graphviz', name='graphviz',
version='0.14', version='0.14.1',
author='Sebastian Bank', author='Sebastian Bank',
author_email='sebastian.bank@uni-leipzig.de', author_email='sebastian.bank@uni-leipzig.de',
description='Simple Python interface for Graphviz', description='Simple Python interface for Graphviz',
...@@ -22,8 +22,8 @@ setup( ...@@ -22,8 +22,8 @@ setup(
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*', python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
extras_require={ extras_require={
'dev': ['tox>=3', 'flake8', 'pep8-naming', 'wheel', 'twine'], 'dev': ['tox>=3', 'flake8', 'pep8-naming', 'wheel', 'twine'],
'test': ['mock>=3', 'pytest>=3.4,!=3.10.0', 'pytest-mock>=1.8', 'pytest-cov'], 'test': ['mock>=3', 'pytest>=4', 'pytest-mock>=2', 'pytest-cov'],
'docs': ['sphinx>=1.7', 'sphinx-rtd-theme'], 'docs': ['sphinx>=1.8', 'sphinx-rtd-theme'],
}, },
long_description=io.open('README.rst', encoding='utf-8').read(), long_description=io.open('README.rst', encoding='utf-8').read(),
classifiers=[ classifiers=[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment