figpack 0.1.4__tar.gz → 0.1.5__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.

Potentially problematic release.


This version of figpack might be problematic. Click here for more details.

Files changed (61) hide show
  1. {figpack-0.1.4/figpack.egg-info → figpack-0.1.5}/PKG-INFO +48 -7
  2. figpack-0.1.5/README.md +123 -0
  3. figpack-0.1.5/figpack/__init__.py +5 -0
  4. {figpack-0.1.4 → figpack-0.1.5}/figpack/cli.py +8 -7
  5. {figpack-0.1.4 → figpack-0.1.5}/figpack/core/_bundle_utils.py +2 -0
  6. {figpack-0.1.4 → figpack-0.1.5}/figpack/core/_show_view.py +4 -8
  7. {figpack-0.1.4 → figpack-0.1.5}/figpack/core/_upload_bundle.py +13 -11
  8. {figpack-0.1.4 → figpack-0.1.5}/figpack/core/figpack_view.py +1 -0
  9. figpack-0.1.4/figpack/figpack-gui-dist/assets/index-Dw14QqeQ.js → figpack-0.1.5/figpack/figpack-gui-dist/assets/index-DeyVLaXh.js +91 -91
  10. {figpack-0.1.4 → figpack-0.1.5}/figpack/figpack-gui-dist/index.html +1 -1
  11. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/views/AutocorrelogramItem.py +1 -0
  12. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/views/Autocorrelograms.py +39 -9
  13. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/views/CrossCorrelogramItem.py +1 -0
  14. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/views/CrossCorrelograms.py +45 -7
  15. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/views/UnitsTable.py +5 -3
  16. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/views/UnitsTableRow.py +1 -1
  17. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/Box.py +3 -1
  18. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/Image.py +4 -2
  19. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/LayoutItem.py +1 -0
  20. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/Markdown.py +1 -0
  21. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/MatplotlibFigure.py +4 -2
  22. figpack-0.1.5/figpack/views/MultiChannelTimeseries.py +226 -0
  23. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/PlotlyFigure.py +5 -3
  24. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/Splitter.py +3 -1
  25. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/TabLayout.py +3 -1
  26. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/TabLayoutItem.py +1 -0
  27. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/TimeseriesGraph.py +3 -2
  28. {figpack-0.1.4 → figpack-0.1.5}/figpack/views/__init__.py +7 -6
  29. {figpack-0.1.4 → figpack-0.1.5/figpack.egg-info}/PKG-INFO +48 -7
  30. {figpack-0.1.4 → figpack-0.1.5}/figpack.egg-info/SOURCES.txt +15 -2
  31. figpack-0.1.5/figpack.egg-info/requires.txt +18 -0
  32. figpack-0.1.5/pyproject.toml +130 -0
  33. figpack-0.1.5/tests/test_cli.py +306 -0
  34. figpack-0.1.5/tests/test_matplotlib_figure.py +181 -0
  35. figpack-0.1.5/tests/test_multichannel_timeseries.py +118 -0
  36. figpack-0.1.5/tests/test_package.py +51 -0
  37. figpack-0.1.5/tests/test_plotly_figure.py +304 -0
  38. figpack-0.1.5/tests/test_show_view.py +433 -0
  39. figpack-0.1.5/tests/test_si_autocorrelograms.py +60 -0
  40. figpack-0.1.5/tests/test_si_cross_correlograms.py +44 -0
  41. figpack-0.1.5/tests/test_splitter.py +362 -0
  42. figpack-0.1.5/tests/test_timeseries_graph.py +583 -0
  43. figpack-0.1.5/tests/test_upload_bundle.py +629 -0
  44. figpack-0.1.5/tests/test_views.py +244 -0
  45. figpack-0.1.4/README.md +0 -95
  46. figpack-0.1.4/figpack/__init__.py +0 -9
  47. figpack-0.1.4/figpack.egg-info/requires.txt +0 -3
  48. figpack-0.1.4/pyproject.toml +0 -48
  49. {figpack-0.1.4 → figpack-0.1.5}/LICENSE +0 -0
  50. {figpack-0.1.4 → figpack-0.1.5}/MANIFEST.in +0 -0
  51. {figpack-0.1.4 → figpack-0.1.5}/figpack/core/__init__.py +0 -0
  52. {figpack-0.1.4 → figpack-0.1.5}/figpack/figpack-gui-dist/assets/index-BDa2iJW9.css +0 -0
  53. {figpack-0.1.4 → figpack-0.1.5}/figpack/figpack-gui-dist/assets/neurosift-logo-CLsuwLMO.png +0 -0
  54. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/__init__.py +0 -0
  55. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/views/UnitSimilarityScore.py +0 -0
  56. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/views/UnitsTableColumn.py +0 -0
  57. {figpack-0.1.4 → figpack-0.1.5}/figpack/spike_sorting/views/__init__.py +2 -2
  58. {figpack-0.1.4 → figpack-0.1.5}/figpack.egg-info/dependency_links.txt +0 -0
  59. {figpack-0.1.4 → figpack-0.1.5}/figpack.egg-info/entry_points.txt +0 -0
  60. {figpack-0.1.4 → figpack-0.1.5}/figpack.egg-info/top_level.txt +0 -0
  61. {figpack-0.1.4 → figpack-0.1.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: figpack
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: A Python package for creating shareable, interactive visualizations in the browser
5
5
  Author-email: Jeremy Magland <jmagland@flatironinstitute.org>
6
6
  License: Apache-2.0
@@ -27,6 +27,19 @@ License-File: LICENSE
27
27
  Requires-Dist: numpy
28
28
  Requires-Dist: zarr
29
29
  Requires-Dist: requests
30
+ Provides-Extra: test
31
+ Requires-Dist: pytest>=7.0; extra == "test"
32
+ Requires-Dist: pytest-cov>=4.0; extra == "test"
33
+ Requires-Dist: pytest-mock>=3.10; extra == "test"
34
+ Requires-Dist: spikeinterface; extra == "test"
35
+ Requires-Dist: matplotlib; extra == "test"
36
+ Requires-Dist: plotly; extra == "test"
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest>=7.0; extra == "dev"
39
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
40
+ Requires-Dist: pytest-mock>=3.10; extra == "dev"
41
+ Requires-Dist: black>=24.0; extra == "dev"
42
+ Requires-Dist: pre-commit>=3.0; extra == "dev"
30
43
  Dynamic: license-file
31
44
 
32
45
  # figpack
@@ -68,19 +81,47 @@ y = np.sin(2 * np.pi * t)
68
81
  graph.add_line_series(name="sine wave", t=t, y=y, color="blue")
69
82
 
70
83
  # Display the visualization
71
- graph.show(open_in_browser=True)
84
+ graph.show(open_in_browser=True, title="Quick Start Example")
72
85
  ```
73
86
 
87
+ ## Available Views
88
+
89
+ figpack provides a comprehensive set of view components for creating interactive visualizations:
90
+
91
+ ### Core Views
92
+
93
+ - **[TimeseriesGraph](docs/timeseries-graph.md)** - Interactive line plots, markers, and intervals ([example](examples/example_timeseries_graph.py))
94
+ - **[MultiChannelTimeseries](docs/multichannel-timeseries.md)** - Multi-channel timeseries visualization ([example](examples/example_multichannel_timeseries.py))
95
+ - **[Image](docs/image.md)** - Display images with optional annotations ([example](examples/example_image.py))
96
+ - **[Markdown](docs/markdown.md)** - Render markdown content ([example](examples/example_markdown.py))
97
+
98
+ ### Layout Views
99
+
100
+ - **[Box](docs/box.md)** - Flexible container with horizontal/vertical layouts ([example](examples/example_box.py))
101
+ - **[Splitter](docs/splitter.md)** - Resizable split panes ([example](examples/example_splitter.py))
102
+ - **[TabLayout](docs/tab-layout.md)** - Tabbed interface for multiple views ([example](examples/example_tablayout.py))
103
+
104
+ ### External Figure Support
105
+
106
+ - **[MatplotlibFigure](docs/matplotlib-figure.md)** - Embed matplotlib plots ([example](examples/example_matplotlib.py))
107
+ - **[PlotlyFigure](docs/plotly-figure.md)** - Embed plotly visualizations ([example](examples/example_plotly.py))
108
+
109
+ ### Spike Sorting Views
110
+
111
+ - **[Autocorrelograms](docs/autocorrelograms.md)** - Auto-correlation analysis ([example](examples/example_autocorrelograms.py))
112
+ - **[CrossCorrelograms](docs/cross-correlograms.md)** - Cross-correlation analysis ([example](examples/example_cross_correlograms.py))
113
+ - **[UnitsTable](docs/units-table.md)** - Sortable table for spike sorting units ([example](examples/example_units_table.py))
114
+
74
115
  ## Examples
75
116
 
76
- See the `examples/` directory.
117
+ See the `examples/` directory for working examples of each view type.
77
118
 
78
119
  ## Usage Modes
79
120
 
80
- ### Local Development
121
+ ### Local-only Mode
81
122
 
82
123
  ```python
83
- view.show(open_in_browser=True)
124
+ view.show(open_in_browser=True, title="Local Visualization")
84
125
  ```
85
126
 
86
127
  ### Sharing Online
@@ -88,12 +129,12 @@ view.show(open_in_browser=True)
88
129
  Set the `FIGPACK_UPLOAD_PASSCODE` environment variable and use:
89
130
 
90
131
  ```python
91
- view.show(upload=True, open_in_browser=True)
132
+ view.show(upload=True, open_in_browser=True, title="Shared Visualization")
92
133
  ```
93
134
 
94
135
  ### Development Mode
95
136
 
96
- Set `_dev=True` in the call to show() to enable development mode, which allows for live updates and debugging with figpack-gui.
137
+ Set `_dev=True` in the call to show() to enable development mode, which allows for live updates and development of figpack-gui.
97
138
 
98
139
  ## Command Line Interface
99
140
 
@@ -0,0 +1,123 @@
1
+ # figpack
2
+
3
+ A Python package for creating shareable, interactive visualizations in the browser.
4
+
5
+ ## Overview
6
+
7
+ figpack enables you to create interactive data visualizations that can be displayed in a web browser and optionally shared online. The package focuses on timeseries data visualization with support for complex, nested layouts.
8
+
9
+ ### Key Features
10
+
11
+ - **Interactive timeseries graphs** with line series, markers, and interval plots
12
+ - **Flexible layout system** with boxes, splitters, and tab layouts
13
+ - **Web-based rendering** that works in any modern browser
14
+ - **Shareable visualizations** that can be uploaded and shared via URLs
15
+ - **Zarr-based data storage** for efficient handling of large datasets
16
+
17
+ ## Installation
18
+
19
+ Install figpack using pip:
20
+
21
+ ```bash
22
+ pip install figpack
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ```python
28
+ import numpy as np
29
+ import figpack.views as vv
30
+
31
+ # Create a timeseries graph
32
+ graph = vv.TimeseriesGraph(y_label="Signal")
33
+
34
+ # Add some data
35
+ t = np.linspace(0, 10, 1000)
36
+ y = np.sin(2 * np.pi * t)
37
+ graph.add_line_series(name="sine wave", t=t, y=y, color="blue")
38
+
39
+ # Display the visualization
40
+ graph.show(open_in_browser=True, title="Quick Start Example")
41
+ ```
42
+
43
+ ## Available Views
44
+
45
+ figpack provides a comprehensive set of view components for creating interactive visualizations:
46
+
47
+ ### Core Views
48
+
49
+ - **[TimeseriesGraph](docs/timeseries-graph.md)** - Interactive line plots, markers, and intervals ([example](examples/example_timeseries_graph.py))
50
+ - **[MultiChannelTimeseries](docs/multichannel-timeseries.md)** - Multi-channel timeseries visualization ([example](examples/example_multichannel_timeseries.py))
51
+ - **[Image](docs/image.md)** - Display images with optional annotations ([example](examples/example_image.py))
52
+ - **[Markdown](docs/markdown.md)** - Render markdown content ([example](examples/example_markdown.py))
53
+
54
+ ### Layout Views
55
+
56
+ - **[Box](docs/box.md)** - Flexible container with horizontal/vertical layouts ([example](examples/example_box.py))
57
+ - **[Splitter](docs/splitter.md)** - Resizable split panes ([example](examples/example_splitter.py))
58
+ - **[TabLayout](docs/tab-layout.md)** - Tabbed interface for multiple views ([example](examples/example_tablayout.py))
59
+
60
+ ### External Figure Support
61
+
62
+ - **[MatplotlibFigure](docs/matplotlib-figure.md)** - Embed matplotlib plots ([example](examples/example_matplotlib.py))
63
+ - **[PlotlyFigure](docs/plotly-figure.md)** - Embed plotly visualizations ([example](examples/example_plotly.py))
64
+
65
+ ### Spike Sorting Views
66
+
67
+ - **[Autocorrelograms](docs/autocorrelograms.md)** - Auto-correlation analysis ([example](examples/example_autocorrelograms.py))
68
+ - **[CrossCorrelograms](docs/cross-correlograms.md)** - Cross-correlation analysis ([example](examples/example_cross_correlograms.py))
69
+ - **[UnitsTable](docs/units-table.md)** - Sortable table for spike sorting units ([example](examples/example_units_table.py))
70
+
71
+ ## Examples
72
+
73
+ See the `examples/` directory for working examples of each view type.
74
+
75
+ ## Usage Modes
76
+
77
+ ### Local-only Mode
78
+
79
+ ```python
80
+ view.show(open_in_browser=True, title="Local Visualization")
81
+ ```
82
+
83
+ ### Sharing Online
84
+
85
+ Set the `FIGPACK_UPLOAD_PASSCODE` environment variable and use:
86
+
87
+ ```python
88
+ view.show(upload=True, open_in_browser=True, title="Shared Visualization")
89
+ ```
90
+
91
+ ### Development Mode
92
+
93
+ Set `_dev=True` in the call to show() to enable development mode, which allows for live updates and development of figpack-gui.
94
+
95
+ ## Command Line Interface
96
+
97
+ figpack includes a command-line interface for working with figures:
98
+
99
+ ### Download a Figure
100
+
101
+ ```bash
102
+ figpack download <figure-url> <dest.tar.gz>
103
+ ```
104
+
105
+ Download a figure from any figpack URL and save it as a local archive.
106
+
107
+ ### View a Figure Archive
108
+
109
+ ```bash
110
+ figpack view <figure.tar.gz>
111
+ ```
112
+
113
+ Extract and view a figure archive in your browser. The server will run locally until you press Enter.
114
+
115
+ Use `--port <number>` to specify a custom port.
116
+
117
+ ## License
118
+
119
+ Apache-2.0
120
+
121
+ ## Contributing
122
+
123
+ Visit the [GitHub repository](https://github.com/magland/figpack) for issues, contributions, and the latest updates.
@@ -0,0 +1,5 @@
1
+ """
2
+ figpack - A Python package for creating shareable, interactive visualizations in the browser
3
+ """
4
+
5
+ __version__ = "0.1.5"
@@ -3,19 +3,20 @@ Command-line interface for figpack
3
3
  """
4
4
 
5
5
  import argparse
6
- import sys
6
+ import json
7
7
  import pathlib
8
- import tempfile
8
+ import socket
9
+ import sys
9
10
  import tarfile
10
- import json
11
- import requests
11
+ import tempfile
12
12
  import threading
13
13
  import webbrowser
14
- import socket
15
14
  from concurrent.futures import ThreadPoolExecutor, as_completed
16
- from urllib.parse import urlparse, urljoin
17
- from typing import Dict, List, Tuple, Optional, Union
18
15
  from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
16
+ from typing import Dict, List, Optional, Tuple, Union
17
+ from urllib.parse import urljoin, urlparse
18
+
19
+ import requests
19
20
 
20
21
  from . import __version__
21
22
  from .core._show_view import serve_files
@@ -1,6 +1,8 @@
1
1
  import os
2
2
  import pathlib
3
+
3
4
  import zarr
5
+
4
6
  from .figpack_view import FigpackView
5
7
 
6
8
  thisdir = pathlib.Path(__file__).parent.resolve()
@@ -1,18 +1,14 @@
1
1
  import os
2
-
3
- from typing import Union
4
- import tempfile
5
-
6
- import webbrowser
7
-
8
2
  import pathlib
9
-
3
+ import tempfile
10
4
  import threading
5
+ import webbrowser
11
6
  from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
7
+ from typing import Union
12
8
 
13
- from .figpack_view import FigpackView
14
9
  from ._bundle_utils import prepare_figure_bundle
15
10
  from ._upload_bundle import _upload_bundle
11
+ from .figpack_view import FigpackView
16
12
 
17
13
  thisdir = pathlib.Path(__file__).parent.resolve()
18
14
 
@@ -1,18 +1,20 @@
1
- import time
1
+ import hashlib
2
2
  import json
3
- import uuid
4
3
  import pathlib
5
- import requests
6
4
  import threading
7
- import hashlib
8
- from .. import __version__
5
+ import time
6
+ import uuid
9
7
  from concurrent.futures import ThreadPoolExecutor, as_completed
10
8
  from datetime import datetime, timedelta, timezone
11
9
 
10
+ import requests
11
+
12
+ from .. import __version__
13
+
12
14
  thisdir = pathlib.Path(__file__).parent.resolve()
13
15
 
14
16
  FIGPACK_API_BASE_URL = "https://figpack-api.vercel.app"
15
- TEMPORY_BASE_URL = "https://tempory.net/figpack/default/figures"
17
+ FIGPACK_FIGURES_BASE_URL = "https://figures.figpack.org/figures/default"
16
18
 
17
19
 
18
20
  def _upload_single_file(
@@ -78,7 +80,7 @@ def _check_existing_figure(figure_id: str) -> dict:
78
80
  Returns:
79
81
  dict: Contains 'exists' (bool) and 'status' (str) if exists
80
82
  """
81
- figpack_url = f"{TEMPORY_BASE_URL}/{figure_id}/figpack.json"
83
+ figpack_url = f"{FIGPACK_FIGURES_BASE_URL}/{figure_id}/figpack.json"
82
84
 
83
85
  try:
84
86
  response = requests.get(figpack_url, timeout=10)
@@ -148,7 +150,7 @@ def _upload_bundle(tmpdir: str, passcode: str) -> None:
148
150
 
149
151
  # If figure_id is None, it means we found a completed upload and should skip
150
152
  if figure_id is None:
151
- figure_url = f"{TEMPORY_BASE_URL}/{completed_figure_id}/index.html"
153
+ figure_url = f"{FIGPACK_FIGURES_BASE_URL}/{completed_figure_id}/index.html"
152
154
  print(f"Figure already exists at: {figure_url}")
153
155
  return figure_url
154
156
 
@@ -281,7 +283,7 @@ def _upload_bundle(tmpdir: str, passcode: str) -> None:
281
283
  )
282
284
  print("Upload completed successfully")
283
285
 
284
- figure_url = f"{TEMPORY_BASE_URL}/{figure_id}/index.html"
286
+ figure_url = f"{FIGPACK_FIGURES_BASE_URL}/{figure_id}/index.html"
285
287
  return figure_url
286
288
 
287
289
 
@@ -352,7 +354,7 @@ def _upload_small_file(
352
354
  """
353
355
  Upload a small file by sending content directly
354
356
  """
355
- destination_url = f"{TEMPORY_BASE_URL}/{figure_id}/{file_path}"
357
+ destination_url = f"{FIGPACK_FIGURES_BASE_URL}/{figure_id}/{file_path}"
356
358
 
357
359
  try:
358
360
  content.encode("utf-8")
@@ -386,7 +388,7 @@ def _upload_large_file(
386
388
  """
387
389
  Upload a large file using signed URL
388
390
  """
389
- destination_url = f"{TEMPORY_BASE_URL}/{figure_id}/{file_path}"
391
+ destination_url = f"{FIGPACK_FIGURES_BASE_URL}/{figure_id}/{file_path}"
390
392
  file_size = local_file_path.stat().st_size
391
393
 
392
394
  # Get signed URL
@@ -49,6 +49,7 @@ class FigpackView:
49
49
  print(
50
50
  f"For development, run figpack-gui in dev mode and use http://localhost:5173?data=http://localhost:{port}/data.zarr"
51
51
  )
52
+ open_in_browser = False
52
53
 
53
54
  _show_view(
54
55
  self,