pygraphviz 2.0.2__tar.gz → 2.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. {pygraphviz-2.0.2/pygraphviz.egg-info → pygraphviz-2.0.3}/PKG-INFO +1 -1
  2. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/conf.py +1 -0
  3. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/release/index.rst +1 -1
  4. pygraphviz-2.0.3/doc/source/release/release_2.0.3.rst +30 -0
  5. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/__init__.py +1 -1
  6. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/scraper.py +18 -12
  7. pygraphviz-2.0.3/pygraphviz/tests/test_scraper.py +88 -0
  8. {pygraphviz-2.0.2 → pygraphviz-2.0.3/pygraphviz.egg-info}/PKG-INFO +1 -1
  9. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz.egg-info/SOURCES.txt +1 -0
  10. pygraphviz-2.0.2/pygraphviz/tests/test_scraper.py +0 -36
  11. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/INSTALL.txt +0 -0
  12. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/LICENSE +0 -0
  13. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/LICENSE.graphviz +0 -0
  14. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/MANIFEST.in +0 -0
  15. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/Makefile +0 -0
  16. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/README.rst +0 -0
  17. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/Makefile +0 -0
  18. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/developer/contribute.rst +0 -0
  19. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/developer/index.rst +0 -0
  20. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/developer/release.rst +0 -0
  21. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/index.rst +0 -0
  22. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/install.rst +0 -0
  23. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/reference/agraph.rst +0 -0
  24. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/reference/credits.rst +0 -0
  25. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/reference/history.rst +0 -0
  26. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/reference/index.rst +0 -0
  27. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/release/old_release_log.rst +0 -0
  28. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/release/release_1.12.rst +0 -0
  29. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/release/release_1.13.rst +0 -0
  30. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/release/release_1.14.rst +0 -0
  31. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/release/release_2.0.1.rst +0 -0
  32. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/release/release_2.0.2.rst +0 -0
  33. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/doc/source/release/release_2.0.rst +0 -0
  34. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/README.txt +0 -0
  35. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/miles_dat.txt.gz +0 -0
  36. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/plot_attributes.py +0 -0
  37. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/plot_miles.py +0 -0
  38. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/plot_simple.py +0 -0
  39. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/plot_star.py +0 -0
  40. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/plot_subgraph.py +0 -0
  41. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/plot_subgraph_boundaries.py +0 -0
  42. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/skip_django_simple.py +0 -0
  43. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/examples/skip_utf8_encoding.py +0 -0
  44. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/agraph.py +0 -0
  45. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/graphviz.i +0 -0
  46. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/graphviz.py +0 -0
  47. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/testing.py +0 -0
  48. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/__init__.py +0 -0
  49. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_attribute_defaults.py +0 -0
  50. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_clear.py +0 -0
  51. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_close.py +0 -0
  52. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_drawing.py +0 -0
  53. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_edge_attributes.py +0 -0
  54. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_graph.py +0 -0
  55. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_html.py +0 -0
  56. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_layout.py +0 -0
  57. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_node_attributes.py +0 -0
  58. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_pygraphviz.py +0 -0
  59. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_readwrite.py +0 -0
  60. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_repr_mimebundle.py +0 -0
  61. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_string.py +0 -0
  62. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_subgraph.py +0 -0
  63. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz/tests/test_unicode.py +0 -0
  64. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz.egg-info/dependency_links.txt +0 -0
  65. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pygraphviz.egg-info/top_level.txt +0 -0
  66. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/pyproject.toml +0 -0
  67. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/setup.cfg +0 -0
  68. {pygraphviz-2.0.2 → pygraphviz-2.0.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygraphviz
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: Python interface to Graphviz
5
5
  Author: Manos Renieris
6
6
  Author-email: Aric Hagberg <aric.hagberg@gmail.com>, Dan Schult <dschult@colgate.edu>
@@ -36,6 +36,7 @@ sphinx_gallery_conf = {
36
36
  "ignore_pattern": "skip_",
37
37
  "image_scrapers": ("pygraphviz",),
38
38
  "min_reported_time": 60.0,
39
+ "parallel": True,
39
40
  }
40
41
 
41
42
  # Prevent numpydoc from trying to create toctree prematurely - suppresses a
@@ -7,7 +7,7 @@ Releases
7
7
  .. toctree::
8
8
  :maxdepth: 2
9
9
 
10
- release_dev
10
+ release_2.0.3
11
11
  release_2.0.2
12
12
  release_2.0.1
13
13
  release_2.0
@@ -0,0 +1,30 @@
1
+ pygraphviz 2.0.3
2
+ ================
3
+
4
+ We're happy to announce the release of pygraphviz 2.0.3!
5
+
6
+ Bug Fixes
7
+ ---------
8
+
9
+ - Fix scraper path handling (`#651 <https://github.com/pygraphviz/pygraphviz/pull/651>`_).
10
+ - Fix DLL dependencies of bundled Windows executables (`#653 <https://github.com/pygraphviz/pygraphviz/pull/653>`_).
11
+
12
+ Contributors
13
+ ------------
14
+
15
+ 4 authors added to this release (alphabetically):
16
+
17
+ - Eric Larson (`@larsoner <https://github.com/larsoner>`_)
18
+ - Jarrod Millman (`@jarrodmillman <https://github.com/jarrodmillman>`_)
19
+ - Mridul Seth (`@MridulS <https://github.com/MridulS>`_)
20
+ - Ross Barnowski (`@rossbar <https://github.com/rossbar>`_)
21
+
22
+ 4 reviewers added to this release (alphabetically):
23
+
24
+ - Eric Larson (`@larsoner <https://github.com/larsoner>`_)
25
+ - Jarrod Millman (`@jarrodmillman <https://github.com/jarrodmillman>`_)
26
+ - Mridul Seth (`@MridulS <https://github.com/MridulS>`_)
27
+ - Ross Barnowski (`@rossbar <https://github.com/rossbar>`_)
28
+
29
+ _These lists are automatically generated, and may not be complete or may contain
30
+ duplicates._
@@ -32,7 +32,7 @@ from ._graphviz import (
32
32
  GRAPHVIZ_PATCH_VERSION,
33
33
  )
34
34
 
35
- __version__ = "2.0.2"
35
+ __version__ = "2.0.3"
36
36
  __graphviz_version__ = (
37
37
  f"{GRAPHVIZ_MAJOR_VERSION}.{GRAPHVIZ_MINOR_VERSION}.{GRAPHVIZ_PATCH_VERSION}"
38
38
  )
@@ -27,6 +27,11 @@ class PNGScraper:
27
27
  'image_scrapers': ('matplotlib', 'pygraphviz'),
28
28
  }
29
29
 
30
+ Only ``.png`` files whose names appear in the code block that was just
31
+ executed are collected (e.g., ``"star.png"`` in ``A.draw("star.png")``), so
32
+ examples in the same directory can be built in parallel (sphinx-gallery's
33
+ ``parallel`` option) without collecting each other's images.
34
+
30
35
  This class is based on the recipe provide in [1]_.
31
36
 
32
37
  References
@@ -35,9 +40,6 @@ class PNGScraper:
35
40
  https://sphinx-gallery.github.io/stable/advanced.html
36
41
  """
37
42
 
38
- def __init__(self):
39
- self.seen = set()
40
-
41
43
  def __repr__(self):
42
44
  return "PNGScraper"
43
45
 
@@ -50,8 +52,10 @@ class PNGScraper:
50
52
  Parameters
51
53
  ----------
52
54
  block : tuple
53
- A tuple containing the (label, content, line_number of the
54
- block.
55
+ A tuple containing the (label, content, line_number) of the
56
+ block. Only PNG files whose names appear in ``content`` are
57
+ collected. If ``None``, all PNG files in the example's directory are
58
+ collected.
55
59
  block_vars : dict
56
60
  Dict of block variables
57
61
  gallery_conf : dict
@@ -68,19 +72,21 @@ class PNGScraper:
68
72
  except ImportError as e:
69
73
  raise ImportError("You must install `sphinx_gallery`") from e
70
74
 
71
- # Find all PNG files in the directory of this example
75
+ # Find the PNG files in the directory of this example that were written
76
+ # by this code block
72
77
  path_current_example = os.path.dirname(block_vars["src_file"])
73
78
  pngs = sorted(glob(os.path.join(path_current_example, "*.png")))
79
+ if block is not None:
80
+ pngs = [png for png in pngs if os.path.basename(png) in block[1]]
74
81
 
75
- # Iterate through PNGs and copy them to sphinx-gallery output dir
82
+ # Move PNGs to the sphinx-gallery output dir (so they can't be collected
83
+ # twice, while a later example can still write a file with the same name)
76
84
  image_names = []
77
85
  image_path_iterator = block_vars["image_path_iterator"]
78
86
  for png in pngs:
79
- if png not in self.seen:
80
- self.seen |= set(png)
81
- this_image_path = next(image_path_iterator)
82
- image_names.append(this_image_path)
83
- shutil.move(png, this_image_path)
87
+ this_image_path = next(image_path_iterator)
88
+ image_names.append(this_image_path)
89
+ shutil.move(png, this_image_path)
84
90
 
85
91
  # Use figure_rst to generate rST for image files
86
92
  return figure_rst(image_names, gallery_conf["src_dir"])
@@ -0,0 +1,88 @@
1
+ import os
2
+ import pytest
3
+
4
+ import pygraphviz as pgv
5
+ from pygraphviz.scraper import _get_sg_image_scraper
6
+
7
+
8
+ def test_scraper(tmpdir):
9
+ pytest.importorskip("sphinx_gallery")
10
+ scraper = _get_sg_image_scraper()
11
+
12
+ ### Source
13
+ src_dir = str(tmpdir)
14
+ src_file = os.path.join(src_dir, "simple.py") # no need for this to exist
15
+ # Create source PNG
16
+ A = pgv.AGraph()
17
+ A.add_edge(1, 2)
18
+ A.layout()
19
+ A.draw(os.path.join(src_dir, "simple.png"))
20
+
21
+ ### Target
22
+ out_dir = os.path.join(src_dir, "build", "html")
23
+ os.makedirs(out_dir)
24
+ out_file = os.path.join(out_dir, "simple.png")
25
+ # Target should **not** exist
26
+ assert not os.path.isfile(out_file)
27
+ # Copy source PNG to target location
28
+ block = None
29
+ block_vars = {
30
+ "image_path_iterator": (img for img in [out_file]),
31
+ "src_file": src_file,
32
+ }
33
+ gallery_conf = {"src_dir": src_dir, "builder_name": "html"}
34
+ scraper(block, block_vars, gallery_conf)
35
+ # Target should exist
36
+ assert os.path.isfile(out_file)
37
+
38
+
39
+ def test_scraper_only_block_pngs(tmpdir):
40
+ """Only PNGs named in the block are collected, e.g. for parallel builds."""
41
+ pytest.importorskip("sphinx_gallery")
42
+ scraper = _get_sg_image_scraper()
43
+ src_dir = str(tmpdir)
44
+ A = pgv.AGraph()
45
+ A.add_edge(1, 2)
46
+ A.layout()
47
+ # "other.png" stands in for an image written by another example in the
48
+ # same directory that is running at the same time
49
+ for name in ("mine.png", "other.png"):
50
+ A.draw(os.path.join(src_dir, name))
51
+ out_dir = os.path.join(src_dir, "build", "html")
52
+ os.makedirs(out_dir)
53
+ out_files = [os.path.join(out_dir, f"img_{ii}.png") for ii in range(2)]
54
+ block = ("code", 'A.draw("mine.png")', 1)
55
+ block_vars = {
56
+ "image_path_iterator": iter(out_files),
57
+ "src_file": os.path.join(src_dir, "mine.py"),
58
+ }
59
+ gallery_conf = {"src_dir": src_dir, "builder_name": "html"}
60
+ rst = scraper(block, block_vars, gallery_conf)
61
+ assert os.path.isfile(out_files[0])
62
+ assert not os.path.isfile(out_files[1])
63
+ assert "img_0.png" in rst
64
+ assert not os.path.isfile(os.path.join(src_dir, "mine.png"))
65
+ assert os.path.isfile(os.path.join(src_dir, "other.png"))
66
+
67
+
68
+ def test_scraper_same_name_twice(tmpdir):
69
+ """A file name reused by a later block (or example) is collected again."""
70
+ pytest.importorskip("sphinx_gallery")
71
+ scraper = _get_sg_image_scraper()
72
+ src_dir = str(tmpdir)
73
+ A = pgv.AGraph()
74
+ A.add_edge(1, 2)
75
+ A.layout()
76
+ out_dir = os.path.join(src_dir, "build", "html")
77
+ os.makedirs(out_dir)
78
+ block = ("code", 'A.draw("same.png")', 1)
79
+ gallery_conf = {"src_dir": src_dir, "builder_name": "html"}
80
+ for ii in range(2):
81
+ A.draw(os.path.join(src_dir, "same.png"))
82
+ out_file = os.path.join(out_dir, f"img_{ii}.png")
83
+ block_vars = {
84
+ "image_path_iterator": iter([out_file]),
85
+ "src_file": os.path.join(src_dir, f"example_{ii}.py"),
86
+ }
87
+ scraper(block, block_vars, gallery_conf)
88
+ assert os.path.isfile(out_file)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygraphviz
3
- Version: 2.0.2
3
+ Version: 2.0.3
4
4
  Summary: Python interface to Graphviz
5
5
  Author: Manos Renieris
6
6
  Author-email: Aric Hagberg <aric.hagberg@gmail.com>, Dan Schult <dschult@colgate.edu>
@@ -24,6 +24,7 @@ doc/source/release/release_1.13.rst
24
24
  doc/source/release/release_1.14.rst
25
25
  doc/source/release/release_2.0.1.rst
26
26
  doc/source/release/release_2.0.2.rst
27
+ doc/source/release/release_2.0.3.rst
27
28
  doc/source/release/release_2.0.rst
28
29
  examples/README.txt
29
30
  examples/miles_dat.txt.gz
@@ -1,36 +0,0 @@
1
- import os
2
- import pytest
3
-
4
- import pygraphviz as pgv
5
- from pygraphviz.scraper import _get_sg_image_scraper
6
-
7
-
8
- def test_scraper(tmpdir):
9
- pytest.importorskip("sphinx_gallery")
10
- scraper = _get_sg_image_scraper()
11
-
12
- ### Source
13
- src_dir = str(tmpdir)
14
- src_file = os.path.join(src_dir, "simple.py") # no need for this to exist
15
- # Create source PNG
16
- A = pgv.AGraph()
17
- A.add_edge(1, 2)
18
- A.layout()
19
- A.draw(os.path.join(src_dir, "simple.png"))
20
-
21
- ### Target
22
- out_dir = os.path.join(src_dir, "build", "html")
23
- os.makedirs(out_dir)
24
- out_file = os.path.join(out_dir, "simple.png")
25
- # Target should **not** exist
26
- assert not os.path.isfile(out_file)
27
- # Copy source PNG to target location
28
- block = None
29
- block_vars = {
30
- "image_path_iterator": (img for img in [out_file]),
31
- "src_file": src_file,
32
- }
33
- gallery_conf = {"src_dir": src_dir, "builder_name": "html"}
34
- scraper(block, block_vars, gallery_conf)
35
- # Target should exist
36
- assert os.path.isfile(out_file)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes