hiveplotlib 0.26.1__tar.gz → 0.27.0__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 (41) hide show
  1. {hiveplotlib-0.26.1/src/hiveplotlib.egg-info → hiveplotlib-0.27.0}/PKG-INFO +14 -7
  2. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/pyproject.toml +70 -12
  3. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/__init__.py +4 -0
  4. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/axis.py +4 -1
  5. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/converters.py +18 -15
  6. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/datasets/__init__.py +3 -3
  7. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/datasets/international_trade.py +4 -3
  8. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/datasets/toy_hive_plots.py +304 -6
  9. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/datasets/toy_p2cps.py +2 -2
  10. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/edges.py +50 -25
  11. hiveplotlib-0.27.0/src/hiveplotlib/exceptions/__init__.py +6 -0
  12. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/hiveplot.py +372 -138
  13. hiveplotlib-0.27.0/src/hiveplotlib/hiveplot_matrix.py +1274 -0
  14. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/node.py +32 -18
  15. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/p2cp.py +23 -19
  16. hiveplotlib-0.27.0/src/hiveplotlib/utils.py +316 -0
  17. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/viz/base.py +20 -9
  18. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/viz/bokeh.py +18 -19
  19. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/viz/datashader.py +109 -51
  20. hiveplotlib-0.27.0/src/hiveplotlib/viz/hiveplot_matrix.py +657 -0
  21. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/viz/holoviews.py +24 -22
  22. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/viz/input_checks.py +4 -6
  23. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/viz/matplotlib.py +8 -7
  24. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/viz/plotly.py +39 -25
  25. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0/src/hiveplotlib.egg-info}/PKG-INFO +14 -7
  26. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib.egg-info/SOURCES.txt +2 -0
  27. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib.egg-info/requires.txt +14 -5
  28. hiveplotlib-0.26.1/src/hiveplotlib/exceptions/__init__.py +0 -6
  29. hiveplotlib-0.26.1/src/hiveplotlib/utils.py +0 -96
  30. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/LICENSE +0 -0
  31. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/MANIFEST.in +0 -0
  32. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/README.md +0 -0
  33. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/setup.cfg +0 -0
  34. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/setup.py +0 -0
  35. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/datasets/trade_data_harvard_growth_lab/international_exports_2019_8112.csv +0 -0
  36. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/datasets/trade_data_harvard_growth_lab/international_exports_metadata_2019_8112.json +0 -0
  37. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/exceptions/hive_plot.py +0 -0
  38. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/exceptions/node.py +0 -0
  39. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib/viz/__init__.py +0 -0
  40. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib.egg-info/dependency_links.txt +0 -0
  41. {hiveplotlib-0.26.1 → hiveplotlib-0.27.0}/src/hiveplotlib.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hiveplotlib
3
- Version: 0.26.1
3
+ Version: 0.27.0
4
4
  Summary: Visualize Network Data with Hive Plots
5
5
  Author-email: Gary Koplik <gary.koplik@geomdata.com>
6
6
  License: Copyright (c) 2020 - 2024, Geometric Data Analytics, Inc.
@@ -34,27 +34,27 @@ License: Copyright (c) 2020 - 2024, Geometric Data Analytics, Inc.
34
34
 
35
35
  Project-URL: Documentation, https://hiveplotlib.readthedocs.io/stable/
36
36
  Project-URL: Source, https://gitlab.com/geomdata/hiveplotlib
37
- Requires-Python: >=3.9
37
+ Requires-Python: >=3.10
38
38
  Description-Content-Type: text/markdown
39
39
  License-File: LICENSE
40
40
  Requires-Dist: matplotlib
41
41
  Requires-Dist: numpy
42
42
  Requires-Dist: pandas
43
43
  Provides-Extra: bokeh
44
- Requires-Dist: bokeh; extra == "bokeh"
44
+ Requires-Dist: bokeh>=3.0.0; extra == "bokeh"
45
45
  Provides-Extra: datashader
46
46
  Requires-Dist: dask[dataframe]; extra == "datashader"
47
47
  Requires-Dist: datashader; extra == "datashader"
48
48
  Requires-Dist: numba>0.54.0; extra == "datashader"
49
49
  Requires-Dist: seaborn; extra == "datashader"
50
50
  Provides-Extra: dev
51
- Requires-Dist: bokeh<3.7.0; extra == "dev"
51
+ Requires-Dist: bokeh>=3.0.0; extra == "dev"
52
52
  Requires-Dist: cartopy; extra == "dev"
53
53
  Requires-Dist: dask[dataframe]; extra == "dev"
54
54
  Requires-Dist: datashader; extra == "dev"
55
55
  Requires-Dist: flexitext; extra == "dev"
56
56
  Requires-Dist: geopandas; extra == "dev"
57
- Requires-Dist: holoviews<1.20.2; extra == "dev"
57
+ Requires-Dist: holoviews>=1.15; extra == "dev"
58
58
  Requires-Dist: jupyter; extra == "dev"
59
59
  Requires-Dist: networkx; extra == "dev"
60
60
  Requires-Dist: numba>0.54.0; extra == "dev"
@@ -63,6 +63,7 @@ Requires-Dist: pybadges; extra == "dev"
63
63
  Requires-Dist: seaborn; extra == "dev"
64
64
  Requires-Dist: tqdm; extra == "dev"
65
65
  Provides-Extra: docs
66
+ Requires-Dist: ipywidgets; extra == "docs"
66
67
  Requires-Dist: myst-parser; extra == "docs"
67
68
  Requires-Dist: nbsphinx; extra == "docs"
68
69
  Requires-Dist: pydata-sphinx-theme; extra == "docs"
@@ -70,11 +71,15 @@ Requires-Dist: sphinx; extra == "docs"
70
71
  Requires-Dist: sphinx-copybutton; extra == "docs"
71
72
  Requires-Dist: toml; extra == "docs"
72
73
  Provides-Extra: holoviews
73
- Requires-Dist: bokeh<3.7.0; extra == "holoviews"
74
- Requires-Dist: holoviews<1.20.2; extra == "holoviews"
74
+ Requires-Dist: bokeh>=3.0.0; extra == "holoviews"
75
+ Requires-Dist: holoviews>=1.15; extra == "holoviews"
75
76
  Requires-Dist: numba>0.54.0; extra == "holoviews"
76
77
  Provides-Extra: networkx
77
78
  Requires-Dist: networkx; extra == "networkx"
79
+ Provides-Extra: perf
80
+ Requires-Dist: pyinstrument; extra == "perf"
81
+ Requires-Dist: snakeviz; extra == "perf"
82
+ Requires-Dist: memory_profiler; extra == "perf"
78
83
  Provides-Extra: plotly
79
84
  Requires-Dist: plotly; extra == "plotly"
80
85
  Provides-Extra: ruff
@@ -86,6 +91,8 @@ Requires-Dist: pytest-html; extra == "testing"
86
91
  Requires-Dist: pytest-timeout; extra == "testing"
87
92
  Requires-Dist: pytest-xdist; extra == "testing"
88
93
  Requires-Dist: toml; extra == "testing"
94
+ Provides-Extra: ty
95
+ Requires-Dist: ty==0.0.20; extra == "ty"
89
96
  Dynamic: license-file
90
97
 
91
98
  ![Hiveplotlib Logo](https://hiveplotlib.readthedocs.io/stable/_static/hiveplotlib.svg)
@@ -6,8 +6,8 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "hiveplotlib"
9
- requires-python = ">=3.9"
10
- version = "0.26.1"
9
+ requires-python = ">=3.10"
10
+ version = "0.27.0"
11
11
  authors = [
12
12
  {name="Gary Koplik", email="gary.koplik@geomdata.com"}
13
13
  ]
@@ -20,13 +20,13 @@ urls = {Documentation="https://hiveplotlib.readthedocs.io/stable/", Source="http
20
20
  dependencies = [
21
21
  "matplotlib",
22
22
  "numpy",
23
- "pandas"
23
+ "pandas",
24
24
  ]
25
25
 
26
26
  [project.optional-dependencies]
27
27
 
28
28
  bokeh = [
29
- "bokeh"
29
+ "bokeh>=3.0.0"
30
30
  ]
31
31
 
32
32
  datashader = [
@@ -38,13 +38,13 @@ datashader = [
38
38
 
39
39
  # developer dependencies
40
40
  dev = [
41
- "bokeh<3.7.0", # to maintain holoviews compatibility (see note below)
41
+ "bokeh>=3.0.0",
42
42
  "cartopy",
43
43
  "dask[dataframe]", # https://github.com/holoviz/datashader/issues/1319
44
44
  "datashader",
45
45
  "flexitext",
46
46
  "geopandas",
47
- "holoviews<1.20.2", # to keep from forcing bokeh 3.7 (bokeh 3.6+ dropped python 3.9 compatibility)
47
+ "holoviews>=1.15",
48
48
  "jupyter",
49
49
  "networkx",
50
50
  "numba>0.54.0", # https://github.com/numba/numba/issues/9708
@@ -56,6 +56,7 @@ dev = [
56
56
 
57
57
  # for building documentation
58
58
  docs = [
59
+ "ipywidgets", # so nbsphinx can handle notebooks with widget metadata (e.g. tqdm progress bars)
59
60
  "myst-parser",
60
61
  "nbsphinx",
61
62
  "pydata-sphinx-theme",
@@ -65,8 +66,8 @@ docs = [
65
66
  ]
66
67
 
67
68
  holoviews = [
68
- "bokeh<3.7.0", # to maintain holoviews compatibility (see note below)
69
- "holoviews<1.20.2", # to keep from forcing bokeh 3.7 (bokeh 3.6+ dropped python 3.9 compatibility)
69
+ "bokeh>=3.0.0",
70
+ "holoviews>=1.15",
70
71
  "numba>0.54.0", # https://github.com/numba/numba/issues/9708
71
72
  ]
72
73
 
@@ -74,13 +75,20 @@ networkx = [
74
75
  "networkx"
75
76
  ]
76
77
 
78
+ # performance profiling extras
79
+ perf = [
80
+ "pyinstrument",
81
+ "snakeviz",
82
+ "memory_profiler",
83
+ ]
84
+
77
85
  plotly = [
78
86
  "plotly"
79
87
  ]
80
88
 
81
89
  # ruff code hygeine checks
82
90
  ruff = [
83
- "ruff"
91
+ "ruff",
84
92
  ]
85
93
 
86
94
  testing = [
@@ -92,10 +100,23 @@ testing = [
92
100
  "toml",
93
101
  ]
94
102
 
103
+ # ty code hygeine checks
104
+ ty = [
105
+ "ty==0.0.20", # pinning for now, 0.0.21 would require non trivial type hint changes that affect the user
106
+ ]
107
+
95
108
  [tool.setuptools.packages.find]
96
109
  where = ["src"]
97
110
  include = ["hiveplotlib*"]
98
111
 
112
+ [tool.ty.src]
113
+ exclude = [
114
+ "docs",
115
+ "examples",
116
+ "runners",
117
+ "sandbox",
118
+ ]
119
+
99
120
  [tool.ruff]
100
121
  # ruff performs our linting and formatting.
101
122
  # if you receive an error you don't understand, you can run `ruff rule <error code>` to learn more.
@@ -121,32 +142,69 @@ extend-ignore = [
121
142
  "D203", # don't require blank line before class docstring.
122
143
  "D212", # require docstring text starts on the next line after the triple quotes.
123
144
  "E203", # https://black.readthedocs.io/en/stable/faq.html#why-are-flake8-s-e203-and-w503-violated
124
- "PD901", # generic `df` name for pandas dataframes will be tolerated
125
- "B905", # this is a python 3.10 convention, drop ignore when we drop 3.9 support
126
145
  ]
127
146
 
147
+
148
+
128
149
  extend-select = [
129
150
  "A", # use flake8-builtins (check if variable name shadows python builtin names)
130
151
  "ANN", # use flake8-annotations (checks type annotations)
131
152
  "ARG", # use flake8-unused-arguments (checks for unused arguments)
132
153
  "B", # use flake8-bugbear (nice for cleaner code)
133
- "C4", # use flake8-comprehensions (remove unnecessary literals, generators, lists, etc.)
154
+ "C4", # use flake8-comprehensions (remove unnecessary literals, generators, lists, etc.)
134
155
  "D", # use pydoc style rules
156
+ # "DOC", # usepydoclinter (additional docstring checks) (commented out because in preview at last change 12/31/25)
135
157
  "E", # use pycodestyle warnings
158
+ "EM", # use flake8-errmsg (improved error messages)
159
+ "ERA", # use flake8-eradicate (checks for commented out code)
160
+ "F", # use pyflakes rules
136
161
  "I", # use isort rules
137
162
  "ICN", # use flake-import-conventions (checks that imports use standard names)
163
+ "INP", # use flake8-no-pep420 (disallow implicit namespace packages)
164
+ "ISC", # use flake8-implicit-str-concat (checks for implicit string concatenation),
138
165
  "N", # use pep8 naming
139
166
  "NPY", # numpy-specific rules
140
167
  "PERF", # linter focused on avoiding performance anti-patterns
141
168
  "PIE", # use flake8-pie (some misc additional linting)
142
169
  "PD", # write pandas code more in line with pd recommendations
143
170
  "PT", # use flake8-pytest-style (linting specifically for pytest)
171
+ "PTH", # use flake8-pathlib (encourages use of pathlib over os.path)
172
+ "Q", # use flake8-quotes (enforce consistent quote style)
144
173
  "RET", # use flake8-return (linting on return / raise)
174
+ "RSE", # use flake8-raise (checks for unnecssary parentheses in raised exceptions)
175
+ "RUF", # ruff's own linting rules
145
176
  "SIM", # use flake8-simplify (helps simplify logic in code)
177
+ "T20", # use flake8-print (to prevent print statements)
178
+ "TC", # use flake8-type-checking (type checking imports)
146
179
  "TID", # use flake8-tidy-imports (to prevent relative imports)
147
180
  "W", # use pycodestyle warnings
148
181
  ]
149
182
 
183
+ [tool.ruff.lint.per-file-ignores]
184
+
185
+ ".gitlab/*" = [
186
+ "INP001", # don't require __init__.py in folder
187
+ "T201", # allow print statements
188
+ ]
189
+
190
+ "docs/*" = [
191
+ "INP001", # don't require __init__.py in folder
192
+ ]
193
+
194
+ "examples/*" = [
195
+ "T201", # allow print statements
196
+ "T203", # allow pprint statements
197
+ ]
198
+
199
+ "runners/*" = [
200
+ "INP001", # don't require __init__.py in runners
201
+ "T201", # allow print statements
202
+ ]
203
+
204
+ "tests/*" = [
205
+ "ERA001", # allow commented out code in tests
206
+ ]
207
+
150
208
  [tool.ruff.lint.pydocstyle]
151
209
  convention = "pep257"
152
210
 
@@ -12,5 +12,9 @@ from hiveplotlib.hiveplot import ( # noqa: F401
12
12
  HivePlot,
13
13
  hive_plot_n_axes,
14
14
  )
15
+ from hiveplotlib.hiveplot_matrix import ( # noqa: F401
16
+ HPM_SUPPORTED_VIZ_BACKENDS,
17
+ HivePlotMatrix,
18
+ )
15
19
  from hiveplotlib.node import Node, NodeCollection # noqa: F401
16
20
  from hiveplotlib.p2cp import P2CP, p2cp_n_axes # noqa: F401
@@ -6,6 +6,7 @@ Definition of ``Axis`` instance and helper static methods for generating and wor
6
6
 
7
7
  from typing import Hashable, Optional
8
8
 
9
+ import numpy as np
9
10
  import pandas as pd
10
11
 
11
12
  from hiveplotlib.utils import polar2cartesian
@@ -93,7 +94,9 @@ class Axis:
93
94
  self.sorting_variable = None
94
95
 
95
96
  # hold all the cartesian coordinates, polar rho, corresponding labels, and node metadata in a pandas dataframe
96
- self.node_placements = pd.DataFrame(columns=["x", "y", "unique_id", "rho"])
97
+ self.node_placements = pd.DataFrame(
98
+ columns=np.array(["x", "y", "unique_id", "rho"])
99
+ )
97
100
 
98
101
  # hold the current vmin and vmax used to place nodes on an axis in a ``HivePlot`` instance.
99
102
  self.vmin = None
@@ -4,22 +4,22 @@
4
4
  Converters from various data structures to ``hiveplotlib``-ready structures.
5
5
  """
6
6
 
7
- from typing import Tuple
8
-
9
7
  import pandas as pd
10
8
 
11
- from hiveplotlib import Edges, Node, NodeCollection
12
- from hiveplotlib.node import node_collection_from_node_list
9
+ from hiveplotlib import Edges, NodeCollection
13
10
 
14
- # say the graph type instead of calling `nx.Graph` to keep networkx dep out of this file.
15
- NetworkXGraph = "networkx.classes.graph.Graph instance"
11
+ try:
12
+ import networkx as nx
13
+ except ImportError as ie: # pragma: no cover
14
+ msg = "`networkx` dependencies not installed, but can be installed by running `pip install hiveplotlib[networkx]`"
15
+ raise ImportError(msg) from ie
16
16
 
17
17
 
18
18
  def networkx_to_nodes_edges(
19
- graph: NetworkXGraph,
19
+ graph: nx.Graph,
20
20
  unique_id_name: str = "unique_id",
21
21
  check_uniqueness: bool = True,
22
- ) -> Tuple[NodeCollection, Edges]: # type: ignore
22
+ ) -> tuple[NodeCollection, Edges]:
23
23
  """
24
24
  Take a ``networkx`` graph and return ``hiveplotlib``-friendly data structures.
25
25
 
@@ -31,11 +31,14 @@ def networkx_to_nodes_edges(
31
31
  :param check_uniqueness: whether or not to check that provided ``Node`` instances have unique IDs.
32
32
  :return: ``list`` of ``Node`` instances, ``(n, 2)`` ``np.ndarray`` of edges.
33
33
  """
34
- nodes = [Node(unique_id=i, data=data) for i, data in list(graph.nodes.data())]
35
- edge_keys = pd.DataFrame(list(graph.edges.keys()), columns=["from", "to"])
36
- edge_values = pd.DataFrame(list(graph.edges.values()))
37
- return node_collection_from_node_list(
38
- node_list=nodes,
39
- unique_id_name=unique_id_name,
34
+ node_data = []
35
+ for node, attributes in graph.nodes(data=True):
36
+ node_data.append({unique_id_name: node, **attributes})
37
+
38
+ node_df = pd.DataFrame(node_data)
39
+ edge_df = nx.to_pandas_edgelist(graph, source="from", target="to")
40
+ return NodeCollection(
41
+ data=node_df,
42
+ unique_id_column=unique_id_name,
40
43
  check_uniqueness=check_uniqueness,
41
- ), Edges(data=edge_keys.join(edge_values))
44
+ ), Edges(data=edge_df)
@@ -16,6 +16,6 @@ For Polar Parallel Coordinates Plots (P2CPs), many datasets are available throug
16
16
  `scikit-learn <https://scikit-learn.org/stable/datasets.html>`_.
17
17
  """
18
18
 
19
- from hiveplotlib.datasets.international_trade import * # noqa: F401, F403
20
- from hiveplotlib.datasets.toy_hive_plots import * # noqa: F401, F403
21
- from hiveplotlib.datasets.toy_p2cps import * # noqa: F401, F403
19
+ from hiveplotlib.datasets.international_trade import * # noqa: F403
20
+ from hiveplotlib.datasets.toy_hive_plots import * # noqa: F403
21
+ from hiveplotlib.datasets.toy_p2cps import * # noqa: F403
@@ -52,7 +52,7 @@ def international_trade_data(
52
52
  csv_years = [i.split("_")[2] for i in csv_files]
53
53
  csv_hs92 = [i.split("_")[-1] for i in csv_files]
54
54
  hiveplotlib_supported_values = pd.DataFrame(
55
- np.c_[csv_years, csv_hs92], columns=["Year", "Trade Code"]
55
+ np.c_[csv_years, csv_hs92], columns=np.array(["Year", "Trade Code"])
56
56
  )
57
57
 
58
58
  # check that our implied data and metadata files exist
@@ -62,15 +62,16 @@ def international_trade_data(
62
62
  )
63
63
 
64
64
  if not (data_path.exists() and metadata_path.exists()):
65
- raise ValueError(
65
+ msg = (
66
66
  "Could not find data and / or metadata under specified `path`. If you specified your own path, double "
67
67
  "check that the path is correct. Your file names should be "
68
68
  "If you are using `hiveplotlib` supported data, note that only the following `year`, "
69
69
  f"`hs29_code` values are supported:\n{hiveplotlib_supported_values}"
70
70
  )
71
+ raise ValueError(msg)
71
72
 
72
73
  data = pd.read_csv(data_path)
73
- with open(metadata_path, "r") as openfile:
74
+ with Path(metadata_path).open("r") as openfile:
74
75
  metadata = json.load(openfile)
75
76
 
76
77
  return data, metadata