Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
215 commits
Select commit Hold shift + click to select a range
1e79c8c
Create README.md for anyplotlib project
CSSFrancis Mar 9, 2026
3816d0f
Add project name 'Anyplotlib' to README
CSSFrancis Mar 9, 2026
166d58a
Update README to refer to Figure object instead of viewer
CSSFrancis Mar 10, 2026
d727dd9
New Feature: Add example for 3D plotting support with surface, scatte…
CSSFrancis Mar 9, 2026
0b5b3d7
New Feature: Implement two-tier event and callback system for interac…
CSSFrancis Mar 16, 2026
0912384
New Feature: Add support for drawing circles, horizontal lines, line …
CSSFrancis Mar 16, 2026
4dfee0e
New Feature: Add interactive widget support with callbacks for real-t…
CSSFrancis Mar 16, 2026
39402fa
New Documentation: Add AGENTS.md for architecture overview and develo…
CSSFrancis Mar 16, 2026
132ce84
New Documentation: Add pcolormesh examples
CSSFrancis Mar 16, 2026
5571443
Fix y-axis label positioning and add units label to the y-axis gutter
CSSFrancis Mar 16, 2026
1eb0be3
New Feature: Add baseline tests for comparison with pngs created usin…
CSSFrancis Mar 16, 2026
9f99a73
New Feature: Implement colormap aliasing with colorcet for improved c…
CSSFrancis Mar 16, 2026
ccb0f92
New Feature: Add PlotBar class for bar chart functionality with suppo…
CSSFrancis Mar 16, 2026
a296e58
New Feature: Add GitHub Actions workflows for documentation and testing
CSSFrancis Mar 16, 2026
0eb47bd
Update dependencies in pyproject.toml and enhance GitHub Actions work…
CSSFrancis Mar 16, 2026
f7e5667
New Feature: Add various marker types including arrows, ellipses, rec…
CSSFrancis Mar 16, 2026
7854b20
Update documentation to reflect repository name change and enhance us…
CSSFrancis Mar 16, 2026
b69ffdf
Add SVG logo for anyplotlib and update documentation configuration
CSSFrancis Mar 16, 2026
079ce28
Enhance documentation build process and add version switcher for impr…
CSSFrancis Mar 16, 2026
1eabcbb
Refactor layout handling for 2D panels to ensure canvas size matches …
CSSFrancis Mar 17, 2026
617135a
Add key-press handling for overlay widget placement and interaction
CSSFrancis Mar 17, 2026
dbbb83e
Clean up syntax and remove unused code. Add regression tests for Plot…
CSSFrancis Mar 18, 2026
1329e97
Add detailed docstrings and examples for callbacks and figure modules…
CSSFrancis Mar 18, 2026
0df9e8c
Add doc strings for figure_plots.py
CSSFrancis Mar 18, 2026
6f24865
Enhance documentation for figure, markers, and widget classes with de…
CSSFrancis Mar 18, 2026
55bc5bd
Revert "Add doc strings for figure_plots.py"
CSSFrancis Mar 18, 2026
9f40251
Implement zoom-out handling in _imgToCanvas2d and update documentatio…
CSSFrancis Mar 19, 2026
d7a3a15
Add responsive iframe embedding for interactive widgets in HTML output
CSSFrancis Mar 19, 2026
2fd8318
Refactor figure.py: streamline attribute documentation and enhance pa…
CSSFrancis Mar 19, 2026
a79cbd5
Enhance responsive iframe embedding: add max width for notebook displ…
CSSFrancis Mar 19, 2026
48b6a8e
Add new parameters to imshow: cmap, vmin, vmax, and origin for enhanc…
CSSFrancis Mar 24, 2026
648b9a2
Enhance Plot1D documentation: improve parameter descriptions, add usa…
CSSFrancis Mar 24, 2026
8329221
Add linestyle, alpha, and marker options to Plot1D: enhance line cust…
CSSFrancis Mar 24, 2026
c1b0968
Enhance documentation for line properties: update parameter descripti…
CSSFrancis Mar 24, 2026
3a1c5d1
Enhance thumbnail rendering: implement pixel-accurate dark-theme PNG …
CSSFrancis Mar 24, 2026
a803953
Refactor thumbnail rendering: remove fallback to matplotlib and strea…
CSSFrancis Mar 25, 2026
faff3a5
Enhance Playwright integration: add --no-sandbox and --disable-setuid…
CSSFrancis Mar 26, 2026
bc35add
Enhance documentation and dependencies: update index.rst for improved…
CSSFrancis Mar 27, 2026
05679a9
Enhance documentation: update API reference and add detailed summarie…
CSSFrancis Mar 29, 2026
95683a1
Enhance widgets and callbacks: add PointWidget for draggable control …
CSSFrancis Apr 2, 2026
bff4669
Add benchmarks for JS rendering and Python serialization performance
CSSFrancis Apr 3, 2026
2d495f8
Enhance performance benchmarks and add base64 encoding for geometry data
CSSFrancis Apr 3, 2026
f8b13a8
Enhance bar chart functionality: support grouped bars, log scale, and…
CSSFrancis Apr 4, 2026
a7d6039
Enhance benchmarking: update baselines, add new benchmarks for JS ren…
CSSFrancis Apr 4, 2026
7a47094
Enhance documentation and styling: add custom CSS for Sphinx output a…
CSSFrancis Apr 4, 2026
258da05
Enhance documentation: improve event class docstring and update chart…
CSSFrancis Apr 5, 2026
41f2c52
Refactor: update--> .set_data for more consistent naming scheme.
CSSFrancis Apr 5, 2026
d2939c2
Enhance benchmarks: increase failure ratio threshold for regression t…
CSSFrancis Apr 5, 2026
a652ee4
Enhance benchmarks: increase failure ratio threshold for regression t…
CSSFrancis Apr 5, 2026
d3c94bf
Enhance benchmarks: add --ignore-hardware option to restore full fail…
CSSFrancis Apr 5, 2026
b447ad5
Remove benchmarks workflow.
CSSFrancis Apr 5, 2026
7f7430c
Merge pull request #4 from CSSFrancis/benchmark
CSSFrancis Apr 5, 2026
2781cd3
Add interactive fitting example with Gaussian components and widgets.
CSSFrancis Apr 6, 2026
ffb35dc
Enhance interactive fitting: update fit method to include FWHM widget…
CSSFrancis Apr 6, 2026
3a1f025
Enhance interactive fitting: add figure-level help text and update ex…
CSSFrancis Apr 6, 2026
fc8e876
Enhance documentation workflow: add pull request support and improve …
CSSFrancis Apr 6, 2026
ac46554
Refactor interactive fitting: remove unused fitting figure function a…
CSSFrancis Apr 6, 2026
f8c4758
Fix doc build.
CSSFrancis Apr 6, 2026
ddf9799
Merge pull request #5 from CSSFrancis/add-interactive-fitting-example
CSSFrancis Apr 6, 2026
5276b08
Add InsetAxes for floating overlay sub-plots and enhance layout handling
CSSFrancis Apr 12, 2026
1977b4f
Add changelog management with towncrier and document filing process
CSSFrancis Apr 12, 2026
0972eba
chore: add workflow for preparing releases with version bumping and c…
CSSFrancis Apr 12, 2026
0c0c928
Add GitHub Actions workflow for automated release process
CSSFrancis Apr 12, 2026
196c39f
Add InsetAxes class for floating overlay sub-plots with interactive c…
CSSFrancis Apr 13, 2026
cf373db
Merge pull request #6 from CSSFrancis/inset-plot
CSSFrancis Apr 20, 2026
531537f
Add CI configuration with test coverage and Codecov integration
CSSFrancis Apr 20, 2026
9073254
Add unit tests for Plot2D, Plot1D, PlotMesh, and Plot3D features
CSSFrancis Apr 20, 2026
b70ae9b
Add Playwright browser installation step in CI configuration
CSSFrancis Apr 20, 2026
731b22f
Merge pull request #7 from CSSFrancis/add_test_coverage
CSSFrancis Apr 20, 2026
1eb4078
Add overlay mask functionality for interactive image segmentation
CSSFrancis Apr 28, 2026
b6e8529
Enhance UI elements and preserve view state in 2D panels
CSSFrancis May 2, 2026
8bbd2f2
Enhance overlay mask functionality and view state preservation in 2D …
CSSFrancis May 2, 2026
2da1220
Merge pull request #8 from CSSFrancis/MaskCreation
CSSFrancis May 2, 2026
7328a71
Add support for pyodide and responsive plots.
CSSFrancis Apr 3, 2026
6657b15
feat: add sphinx_anywidget extension — generic anywidget Pyodide bridge
CSSFrancis May 3, 2026
d2948d3
refactor: remove static icon support and update badge behavior for in…
CSSFrancis May 3, 2026
bdfee95
feat: enhance Pyodide bridge with event handling and deterministic pa…
CSSFrancis May 3, 2026
593e189
refactor: remove stale pyodide_bridge.js reference and add anywidget_…
CSSFrancis May 3, 2026
c6a9532
feat: add support for extracting and loading Pyodide packages in inte…
CSSFrancis May 3, 2026
a4a7d10
feat: add .gitignore and update conf.py for wheel build optimization
CSSFrancis May 4, 2026
beb25ef
chore: remove committed __pycache__ .pyc files and add them to .gitig…
CSSFrancis May 4, 2026
7ecc2ac
feat: enhance anywidget integration with improved config handling and…
CSSFrancis May 4, 2026
469fb62
test: move root-level test scripts into tests/ as proper pytest funct…
CSSFrancis May 4, 2026
d666ef6
Documentation: Added Changelog entry.
CSSFrancis May 4, 2026
60e7b4b
Testing: add docutils and sphinx as dependencies for documentation su…
CSSFrancis May 4, 2026
68e887d
feat: enhance interactive 3D spectral viewer with draggable crosshair…
CSSFrancis May 5, 2026
43ed8d3
Merge pull request #9 from CSSFrancis/sphinx-anywidget
CSSFrancis May 6, 2026
3051392
Fix building documentation on windows
ericpre May 6, 2026
6e66b88
Add rst files generated during docs build
ericpre May 6, 2026
6100eac
Remove generated `rst` files during docs build when calling `make cle…
ericpre May 6, 2026
2dba9dc
feat: improve wheel handling in sphinx_anywidget by reusing existing …
CSSFrancis May 6, 2026
734bec4
refactor: reorganize test structure and update import paths for consi…
CSSFrancis May 9, 2026
0a42ad0
feat: add comprehensive tests for Plot2D and PlotMesh functionality
CSSFrancis May 11, 2026
a8d1f55
feat: add unit tests for Plot1D and PlotBar functionality
CSSFrancis May 11, 2026
505f1da
feat: add unit tests for panel alignment and inset functionality
CSSFrancis May 11, 2026
9af9932
feat: add comprehensive tests for callback system and widget interact…
CSSFrancis May 11, 2026
ecc2b33
feat: add end-to-end tests for Pyodide live-documentation bridge and …
CSSFrancis May 11, 2026
a125d08
Refactor: Remove pcolormesh_extra
CSSFrancis May 11, 2026
af7e4f1
ci: update CI configuration to use updated setup actions and specify …
CSSFrancis May 11, 2026
37b8539
fix: update coverage configuration to correctly omit test directory
CSSFrancis May 11, 2026
ddfcc16
refactor: skip tests based on Playwright availability
CSSFrancis May 11, 2026
6f9d0bc
Merge pull request #10 from ericpre/doc_build_fix
CSSFrancis May 11, 2026
9adb170
Documentation: Added a changelog for #11
CSSFrancis May 11, 2026
397ca6b
Merge pull request #11 from CSSFrancis/refactor_tests
CSSFrancis May 11, 2026
8c5539e
chore: add .worktrees/ to .gitignore
CSSFrancis May 11, 2026
903de71
refactor: split widgets.py into widgets/ package (_base, _widgets2d, …
CSSFrancis May 11, 2026
20d01fc
fix: restore Callable type annotations in widgets/_base.py
CSSFrancis May 11, 2026
96783f6
refactor: extract shared helpers into _utils.py
CSSFrancis May 11, 2026
fa91ab8
fix: remove dead top-level import base64 from _utils.py
CSSFrancis May 11, 2026
ef2dc16
refactor: extract Plot3D into plot3d/ subpackage
CSSFrancis May 11, 2026
b9cd69f
refactor: extract Plot2D and PlotMesh into plot2d/ subpackage
CSSFrancis May 11, 2026
6738d86
fix: add module docstrings to subpackage __init__.py files
CSSFrancis May 11, 2026
c50aadc
refactor: extract Plot1D, Line1D, PlotBar into plot1d/ subpackage
CSSFrancis May 11, 2026
a68c7e3
fix: remove unused imports from plot1d/ modules
CSSFrancis May 11, 2026
1b16df1
refactor: extract Axes and InsetAxes into axes/ subpackage
CSSFrancis May 11, 2026
2619349
fix: add __all__ to axes/__init__.py and remove dead imports from fig…
CSSFrancis May 11, 2026
3f492ab
refactor: extract Figure, GridSpec, SubplotSpec into figure/ subpackage
CSSFrancis May 11, 2026
7bfc233
fix: remove dead imports from figure/ modules
CSSFrancis May 11, 2026
1e2448f
refactor: update __init__.py to import from new subpackages and remov…
CSSFrancis May 11, 2026
a50374e
fix: update stale figure_plots import in test_benchmarks_py.py
CSSFrancis May 11, 2026
9411114
refactor: update stale figure_plots docstring cross-references in Exa…
CSSFrancis May 11, 2026
2de4f24
refactor: update figure_plots documentation to reflect new module str…
CSSFrancis May 12, 2026
59939e8
Merge pull request #12 from CSSFrancis/refactor/project-reorganization
CSSFrancis May 12, 2026
c9bf593
refactor: update figure_plots documentation to reflect new module str…
CSSFrancis May 12, 2026
4dcebcb
feat: add new plotting examples for 2D and 3D visualizations
CSSFrancis May 12, 2026
22ca4ce
Apply suggestions from code review
CSSFrancis May 12, 2026
8cf7526
Merge pull request #13 from CSSFrancis/clean-up
CSSFrancis May 12, 2026
8c20363
feat: add pointer_settled dwell timer to JS — zero cost when unused, …
CSSFrancis May 17, 2026
f2ff29b
docs: add event system redesign spec
CSSFrancis May 14, 2026
40a56d0
docs: add event system implementation plan
CSSFrancis May 14, 2026
b9ffe12
refactor: flatten Event dataclass — all payload fields are typed top-…
CSSFrancis May 14, 2026
89dbd84
test: add stop_propagation repr test and dx/dy assertions to TestEvent
CSSFrancis May 15, 2026
e3250fa
refactor: rewrite CallbackRegistry with priority, wildcard, disconnec…
CSSFrancis May 15, 2026
c69142f
feat: add pause_events and hold_events context managers to CallbackRe…
CSSFrancis May 15, 2026
15d3c96
feat: add _EventMixin with add_event_handler, remove_handler, pause/h…
CSSFrancis May 15, 2026
b98576d
refactor: update _dispatch_event and Widget._update_from_js to use fl…
CSSFrancis May 15, 2026
52cb18c
refactor: Plot1D/2D/3D/Bar and PlotMesh adopt _EventMixin, remove old…
CSSFrancis May 15, 2026
ab31496
refactor: Widget adopts _EventMixin, remove old on_changed/on_release…
CSSFrancis May 15, 2026
0398bc5
fix: remove on_line_click/on_line_hover from VALID_EVENT_TYPES; use p…
CSSFrancis May 15, 2026
f0529df
fix: update inset tests to use renamed inset_state_change event type
CSSFrancis May 15, 2026
d6cc293
feat: JS forwards pointer_up, pointer_enter/leave, double_click, whee…
CSSFrancis May 15, 2026
b8de616
fix: remove duplicate mouseleave and dblclick listeners in _attachEve…
CSSFrancis May 15, 2026
7ecc2a1
fix: correct button null guard in _pointerFields, fix key_down x/y un…
CSSFrancis May 17, 2026
a49bd43
feat: add pointer_settled dwell timer to JS — zero cost when unused, …
CSSFrancis May 17, 2026
0f4a8bb
fix: snapshot performance.now() once in pointer_settled callback; cle…
CSSFrancis May 17, 2026
8f7ab0f
test: add Playwright tests for pointer events, pointer_settled, and p…
CSSFrancis May 17, 2026
223509d
fix: add button=0 assertion to double_click test; fix 3d no-xdata tes…
CSSFrancis May 17, 2026
5abc64c
refactor: extract shared event test helpers; fix 3d no-pointer_down p…
CSSFrancis May 17, 2026
e1bda14
test: add regression tests confirming old event API removed; update E…
CSSFrancis May 17, 2026
9035601
refactor: replace event.data dict access with widget attribute access…
CSSFrancis May 17, 2026
f4d5345
fix: use event.source.x in widget handlers; remove duplicate regressi…
CSSFrancis May 18, 2026
823581f
fix: delete dead Line1D.on_hover shim; add regression tests for Line1D
CSSFrancis May 18, 2026
12676c4
fix: replace event.img_x/img_y with event.xdata/ydata in Examples
CSSFrancis May 18, 2026
bdef485
fix: _pointerFields always null button; pointer_down/up explicitly se…
CSSFrancis May 18, 2026
9890886
fix: PlotBar pointer_down on mousedown (was click); emit bar_index: n…
CSSFrancis May 18, 2026
fe34530
refactor. Removed plans
CSSFrancis May 18, 2026
ac6334b
fix: address PR review comments — last_widget_id field, x/y float typ…
CSSFrancis May 18, 2026
96df339
docs: add events.rst — event system guide with Matplotlib/pygfx compa…
CSSFrancis May 18, 2026
245ec19
test: fix flaky test_fires_again_after_re_settle — poll with wait_for…
CSSFrancis May 18, 2026
c02e351
feat: add plot_particle_picker.py EM interactive example
CSSFrancis May 18, 2026
d7f59cf
feat: add plot_eels_explorer.py EM interactive example
CSSFrancis May 18, 2026
3bcc904
feat: add plot_threshold_explorer.py EM interactive example
CSSFrancis May 18, 2026
525baab
feat: add plot_roi_inspector.py EM interactive example
CSSFrancis May 18, 2026
25b7aa1
test: add smoke tests for interactive EM example scripts
CSSFrancis May 18, 2026
0b43bb6
fix: add xdata/ydata None guards in all EM example event handlers
CSSFrancis May 18, 2026
fb407fa
feat: implement auto-sync for Figure dimensions based on GridSpec
CSSFrancis May 20, 2026
20d7d49
feat: add examples and test baselines for GridSpec layouts for multi-…
CSSFrancis May 20, 2026
afb486f
refactor: enhance documentation and interaction descriptions in EELS …
CSSFrancis May 20, 2026
404b563
Refactor: Update and clean ROI-to-spectrum inspector for 3-D EDS hype…
CSSFrancis May 20, 2026
2d4e0c3
Refactor: Update and clean ROI-to-spectrum inspector for 3-D EDS hype…
CSSFrancis May 20, 2026
bbae38e
Merge pull request #14 from CSSFrancis/refactor/project-reorganization
CSSFrancis May 20, 2026
af6806a
Refactor: Add transform parameter to marker functions for coordinate …
CSSFrancis May 20, 2026
d9f781a
Refactor: Enhance Plot1D and Plot2D classes with additional state man…
CSSFrancis May 20, 2026
17e6f64
Refactor: Introduce color cycle utility and enhance Plot1D with logar…
CSSFrancis May 21, 2026
ce1832d
Refactor: Implement subplot spacing adjustments with hspace and wspac…
CSSFrancis May 21, 2026
7b1b2a1
Refactor: Enhance layout management for Plot2D with dynamic resizing …
CSSFrancis May 22, 2026
2c8d80c
Refactor: Enhance Plot1D and Plot2D with new axis label, title, and v…
CSSFrancis May 22, 2026
d4b90aa
Refactor: Add axis visibility controls and state management methods f…
CSSFrancis May 23, 2026
4b76fbd
Refactor: Standardize method names and enhance axis visibility contro…
CSSFrancis May 23, 2026
5761bc1
Refactor: add png baselines
CSSFrancis May 23, 2026
cbe4d22
Refactor: Improve docstring for vertices parameter in polygon function
CSSFrancis May 23, 2026
a738747
Refactor: Enhance subplot adjustment method to allow optional spacing…
CSSFrancis May 23, 2026
d6eac10
Merge pull request #16 from CSSFrancis/refactor/project-reorganization
CSSFrancis May 23, 2026
68272b7
Refactor: Add Playwright tests for 2D title rendering and blitting be…
CSSFrancis May 23, 2026
36e4d42
Refactor: Remove unused Playwright browser fixture and update testpat…
CSSFrancis May 23, 2026
56b257a
Refactor: Add standalone pytest configuration and tests for sphinx_an…
CSSFrancis May 23, 2026
8f1f02c
Refactor: Reorganize plot classes to inherit from a shared base class…
CSSFrancis May 23, 2026
569ee13
Refactor: Introduce shared constants and helper functions to streamli…
CSSFrancis May 23, 2026
008637a
Refactor: Add package-level pytest fixture for shared Chromium browse…
CSSFrancis May 24, 2026
91cde28
Fix: Switch wheel builder from pip to uv build for CI compatibility
CSSFrancis May 24, 2026
3f500d6
Merge pull request #17 from CSSFrancis/refactor/project-reorganization
CSSFrancis May 26, 2026
c30404f
sphinx_anywidget: add _PYODIDE_MOCK_PACKAGES support
CSSFrancis Jun 10, 2026
71aed65
Refactor: Update import alias from 'vw' to 'apl' for consistency acro…
CSSFrancis Jun 12, 2026
b8e7c94
Enhance: Add support for per-point colors in 3D scatter and voxel plo…
CSSFrancis Jun 15, 2026
74cecde
Add 3D/embed/perf features: WebGPU rendering, voxels, geometry channel
CSSFrancis Jun 15, 2026
1583194
Fix macOS title clipping: clamp 2D title to strip height minus margin
CSSFrancis Jun 15, 2026
00f1939
Review fixes: cheaper geom change-detection, clarify _applyGeom
CSSFrancis Jun 15, 2026
94742ec
Merge pull request #18 from CSSFrancis/feat/3d-gpu-embed-perf
CSSFrancis Jun 15, 2026
1de8f65
Add touch input: plots usable on iPad / iPhone
CSSFrancis Jun 16, 2026
c619c4d
Merge pull request #19 from CSSFrancis/feat/touch-input
CSSFrancis Jun 16, 2026
c87b593
Fix 3D plane-drag snap-back and faulty highlight tracking
CSSFrancis Jun 16, 2026
a358c39
Fix floating/random 3-D voxel highlight in grain explorer
CSSFrancis Jun 16, 2026
6125831
Fix large voxel volumes rendering as sparse "floating" cubes
CSSFrancis Jun 16, 2026
b09afe3
Fix voxels rendering empty under WebGPU (opaque plotCanvas overlay)
CSSFrancis Jun 16, 2026
923f5ab
Self-heal 3D GPU panels when the device throws mid-draw (Safari)
CSSFrancis Jun 16, 2026
b41b43c
Merge pull request #20 from CSSFrancis/fix/plane-drag-snapback
CSSFrancis Jun 17, 2026
dceee22
Speed up Pyodide interaction dispatch ~50x (pre-compiled proxy)
CSSFrancis Jun 16, 2026
e8c62ce
Merge pull request #21 from CSSFrancis/perf/pyodide-dispatch
CSSFrancis Jun 17, 2026
b152f71
Add Electron app bridge for anyplotlib figures
CSSFrancis Jun 18, 2026
3b726ac
feat(plotxy): data-coordinate 2-D axis (axes2d/PlotXY) for orix-style…
CSSFrancis Jun 19, 2026
16fc713
feat(markers): per-point face/edge colours for 1-D points (scatter c=…
CSSFrancis Jun 19, 2026
791af64
feat(plotxy): aspect="equal" in the renderer (matplotlib apply_aspect)
CSSFrancis Jun 19, 2026
a7759c5
feat(plotxy): pcolormesh — data-coord quad mesh for IPF density heatmaps
CSSFrancis Jun 19, 2026
5f77874
feat(markers): clip_path — clip a group to a data-coord polygon
CSSFrancis Jun 19, 2026
8058e48
feat(events): 1-D / PlotXY double_click reports ydata (data coords)
CSSFrancis Jun 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"
enable-cache: true

- name: Install dependencies
run: uv sync --group dev

- name: Install Playwright browsers
run: uv run playwright install --with-deps chromium

- name: Run tests with coverage
run: uv run pytest

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.xml
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
169 changes: 169 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: Docs

on:
push:
# Publish to dev/ on every push to main …
branches: [main]
# … and to a versioned directory on every release tag.
tags: ["v*.*.*"]
pull_request:
branches: [main]
# Allow manual re-builds from the Actions tab.
workflow_dispatch:

# Only one docs deployment should run at a time to avoid race conditions on
# the gh-pages branch.
concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write # needed to push to gh-pages

jobs:
# ── Build ──────────────────────────────────────────────────────────────────
# Runs on every push and every pull request. Treats warnings as errors so
# broken cross-references and bad docstrings are caught before merge.
build:
name: Build docs
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# ── uv + Python ──────────────────────────────────────────────────────
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
enable-cache: true

# ── Dependencies ─────────────────────────────────────────────────────
# Install the package itself plus the [docs] optional-dependency group
# (sphinx, pydata-sphinx-theme, sphinx-gallery, pillow, playwright).
- name: Install dependencies (with docs extras)
run: uv sync --extra docs

# Playwright ships the Python bindings but NOT the browser binaries.
# --with-deps also installs the OS-level shared libraries Chromium needs
# (libglib2, libnss3, etc.) on bare Ubuntu runners.
- name: Install Playwright browser
run: uv run playwright install chromium --with-deps

# ── Build Pyodide wheel ───────────────────────────────────────────────
# Produces docs/_static/wheels/anyplotlib-0.0.0-py3-none-any.whl so the
# in-browser Pyodide bridge can install the exact source tree that built
# these docs — no PyPI release required.
- name: Build Pyodide wheel
run: |
mkdir -p docs/_static/wheels
uv build --wheel --out-dir docs/_static/wheels/
# Rename to the stable sentinel name micropip expects for URL installs.
cd docs/_static/wheels
for f in anyplotlib-*.whl; do
[ "$f" != "anyplotlib-0.0.0-py3-none-any.whl" ] && mv "$f" anyplotlib-0.0.0-py3-none-any.whl
done

# ── Sphinx build ─────────────────────────────────────────────────────
# -W turns warnings into errors; --keep-going collects all of them.
- name: Build HTML documentation
run: |
uv run sphinx-build -b html docs build/html -W --keep-going

# ── Upload built HTML as an artifact so it can be inspected on PRs ──
- name: Upload HTML artifact
uses: actions/upload-artifact@v4
with:
name: docs-html
path: build/html
retention-days: 7

# ── Deploy ─────────────────────────────────────────────────────────────────
# Only runs after a successful build on pushes to main or release tags.
# Pull requests skip this job entirely.
deploy:
name: Deploy docs
needs: build
runs-on: ubuntu-latest
# Skip deployment for pull requests.
if: github.event_name != 'pull_request'

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

# ── uv + Python ──────────────────────────────────────────────────────
- name: Set up uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
enable-cache: true

# ── Dependencies ─────────────────────────────────────────────────────
- name: Install dependencies (with docs extras)
run: uv sync --extra docs

- name: Install Playwright browser
run: uv run playwright install chromium --with-deps

# ── Determine deployment target ──────────────────────────────────────
# Release tag (refs/tags/v1.2.3) → destination = "v1.2.3"
# Everything else (push to main, manual dispatch) → destination = "dev"
- name: Determine deployment directory
id: target
shell: bash
run: |
if [[ "${GITHUB_REF}" == refs/tags/v* ]]; then
echo "dest_dir=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
else
echo "dest_dir=dev" >> "$GITHUB_OUTPUT"
fi

# ── Build Pyodide wheel ───────────────────────────────────────────────
- name: Build Pyodide wheel
run: |
mkdir -p docs/_static/wheels
uv build --wheel --out-dir docs/_static/wheels/
cd docs/_static/wheels
for f in anyplotlib-*.whl; do
[ "$f" != "anyplotlib-0.0.0-py3-none-any.whl" ] && mv "$f" anyplotlib-0.0.0-py3-none-any.whl
done

# ── Sphinx build ─────────────────────────────────────────────────────
- name: Build HTML documentation
env:
DOCS_VERSION: ${{ steps.target.outputs.dest_dir }}
run: |
uv run sphinx-build -b html docs build/html -W --keep-going

# ── Deploy to gh-pages ───────────────────────────────────────────────
# keep_files: true preserves all existing directories on the branch so
# versioned releases accumulate rather than overwriting each other.
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/html
destination_dir: ${{ steps.target.outputs.dest_dir }}
keep_files: true
commit_message: |
docs: deploy ${{ steps.target.outputs.dest_dir }} @ ${{ github.sha }}

# ── Deploy root files (redirect + switcher) ──────────────────────────
# Places index.html and switcher.json at the root of gh-pages so the
# bare URL redirects to dev/ and the version switcher is always reachable.
- name: Deploy root redirect and switcher
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_root
destination_dir: .
keep_files: true
commit_message: |
docs: update root redirect and switcher.json @ ${{ github.sha }}

Loading