Rewrite gallery as an installable package, add plotstyle, migrate build/CI to uv #1

Merged
lars merged 36 commits from dev into main 2026-07-24 10:49:38 +02:00

36 Commits

Author SHA1 Message Date
lars 5064aec831 Split CI lint/format/typecheck steps per package
CI / lint:ruff (push) Successful in 13s
CI / format:ruff (push) Successful in 15s
CI / typecheck:ty (push) Successful in 17s
CI / vulnerabilities:pip-audit (push) Successful in 16s
CI / test:pytest (push) Successful in 22s
CI / lint:ruff (pull_request) Successful in 15s
CI / format:ruff (pull_request) Successful in 16s
CI / typecheck:ty (pull_request) Successful in 14s
CI / vulnerabilities:pip-audit (pull_request) Successful in 17s
CI / test:pytest (pull_request) Successful in 21s
Run ruff check, ruff format --check, and ty check as separate steps
per package (gallery, plotstyle, tests) instead of one combined
command, so a failure points at which package broke.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-24 10:41:30 +02:00
lars 5109b6505c Move build system from setuptools to uv, wire uv into CI/CD
CI / lint:ruff (push) Successful in 25s
CI / format:ruff (push) Successful in 14s
CI / typecheck:ty (push) Successful in 15s
CI / vulnerabilities:pip-audit (push) Successful in 17s
CI / test:pytest (push) Successful in 24s
Convert both pyproject.toml files to the uv_build backend and turn the
repo into a proper uv workspace (plotstyle moved to src layout, since
uv_build requires the module in its own subdirectory). Dev tooling
moves from an optional-dependencies extra to a dependency-group, and
plotstyle's matplotlib dependency is now its own rather than a
gallery "plotting" extra.

Gitea Actions workflows and the Dockerfile now use astral-sh/setup-uv,
uv sync, uv run, uv build, and uv publish throughout instead of pip,
build, and twine. Also fixes .dockerignore, which was excluding
uv.lock, deploy/, and README.md and would have broken even the
previous Dockerfile's COPY of deploy/entrypoint.sh.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-24 10:30:20 +02:00
lars 2020ac4883 Remove pre-package-restructure cruft and dead features
CI / lint:ruff (push) Successful in 9s
CI / format:ruff (push) Successful in 8s
CI / typecheck:ty (push) Successful in 10s
CI / vulnerabilities:pip-audit (push) Successful in 11s
CI / test:pytest (push) Successful in 12s
Delete the top-level implementation superseded by the gallery/ package
conversion (generate_gallery.py, orchestration/, root templates/ and
assets/, python/ scripts), stray scratch files, and docs describing a
container/GitLab-CI coverage workflow that no longer exists. Also drop
two half-wired, never-invoked features: the backup_folder config/TUI
option (create_backup() was never called from the pipeline) and the
unfinished export-to-LaTeX JS/CSS. Update README's install instructions
to the current Gitea remote.
2026-07-23 13:50:32 +02:00
lars 067465503a Pin setuptools>=83.0.0 as a dev dependency
CI / format:ruff (push) Successful in 7s
CI / typecheck:ty (push) Successful in 8s
CI / vulnerabilities:pip-audit (push) Successful in 10s
CI / lint:ruff (push) Successful in 2m25s
CI / test:pytest (push) Successful in 13s
The build-system requirement only pins the isolated build backend, not
the runtime venv setuptools that pip-audit scans, so CI still saw the
vulnerable 79.0.1. Add it to the dev extra so pip actually installs
the patched version.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 13:20:11 +02:00
lars 2a7d3d244a Skip editable package in pip-audit; require setuptools>=83.0.0
CI / lint:ruff (push) Successful in 8s
CI / format:ruff (push) Successful in 7s
CI / typecheck:ty (push) Successful in 8s
CI / vulnerabilities:pip-audit (push) Failing after 9s
CI / test:pytest (push) Has been skipped
pip-audit can't look up the local editable "gallery" package on PyPI,
so skip it explicitly. Also bump the setuptools build requirement to
pull in recent security fixes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 13:18:16 +02:00
lars f7294909a2 Fix Gitea Actions: drop custom job container, use setup-python
CI / lint:ruff (push) Successful in 1m49s
CI / format:ruff (push) Successful in 7s
CI / typecheck:ty (push) Successful in 10s
CI / vulnerabilities:pip-audit (push) Failing after 9s
CI / test:pytest (push) Has been skipped
The python:3.11-slim job container lacked a Node.js runtime, so the
runner couldn't exec actions/checkout inside it. Run jobs on the
default runner image instead and pin Python via actions/setup-python.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 13:13:17 +02:00
lars ea5ec680c5 Migrate CI from GitLab to Gitea Actions
CI / lint:ruff (push) Failing after 10s
CI / format:ruff (push) Failing after 2s
CI / typecheck:ty (push) Failing after 1s
CI / vulnerabilities:pip-audit (push) Failing after 1s
CI / test:pytest (push) Has been skipped
Replace .gitlab-ci.yml with .gitea/workflows/ci.yml, keeping the same
lint/format/typecheck/pip-audit/pytest jobs against python:3.11-slim,
and update docs that referenced the old GitLab pipeline file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 13:05:25 +02:00
lars 3b9d1ef1a8 Rewrite CI to lint/typecheck/audit/test only; add HPC deployment path
- Replace the Docker build/publish CI stages with ruff (lint + format
  check), ty (type check), pip-audit, and pytest run directly against
  python:3.11-slim; Docker remains for manual/server deployment only.
- Swap black/pylint/mypy for ruff/ty across pyproject.toml, and fix
  every resulting lint, format, and type diagnostic in gallery/ and
  plotstyle/.
- Fix tests broken/stale from before the package restructuring: wrong
  `utils.*` import paths, mock patch targets pointed at the wrong
  module, and PDF-conversion tests still assuming ImageMagick instead
  of the current PyMuPDF-first path. Drop test_container.py (obsolete
  Docker-container smoke tests, fully superseded elsewhere).
- Add a plain-venv + systemd --user timer deployment path
  (deploy/systemd/) for HPC login nodes without a Docker daemon, where
  public_html is already served by existing infrastructure.
- Document both in CLAUDE.md, including running CI's checks locally
  before committing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 15:29:55 +02:00
lars 4ba321b327 Document plotstyle and the Docker deployment switch in CLAUDE.md/README
Root-level docs hadn't caught up with the plotstyle package addition
(KIT styling toolkit, plotting extra, plotstyle/CLAUDE.md pointer) or
the earlier Singularity-to-Docker deployment switch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 14:44:14 +02:00
lars eeb483a4fa Add ps.no_spines() for imshow/pcolormesh/2D-histogram plots
Image- and bin-indexed plots have no meaningful x baseline, so the
themed bottom spine kept by use() doesn't apply to them. Adds an
explicit opt-in to disable all spines on such Axes, documents it in
plotstyle/CLAUDE.md, and updates the showcase notebook's colormap and
multi-panel examples to use it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 14:43:41 +02:00
lars 36ae18e880 Add plotstyle: reusable KIT-branded matplotlib styling toolkit
Introduces a new plotstyle package providing consistent, presentation/thesis-ready
matplotlib figures: a KIT corporate-design color palette (categorical, sequential,
diverging, status), a theme applied via use() (KIT-black bottom spine only, left/bottom
ticks, horizontal gridlines, left-aligned titles, LaTeX text in Latin Modern Sans),
new_figure() with size presets and figure-level title/params subtitles, a
same-size colorbar() helper, style_legend() and panel_label() building blocks, and
savefig(). Ships as an optional "plotting" extra so core gallery installs stay
lightweight, with a full test suite and a runnable example notebook.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 14:19:30 +02:00
lars 8cae6533d5 Replace Singularity with Docker; add production deployment setup
- Remove Singularity.def; add Dockerfile (python:3.11-slim + ImageMagick,
  non-root user, installs gallery package with dev extras)
- Add .dockerignore to keep image lean
- Rewrite .gitlab-ci.yml: build→test→publish stages using Docker-in-Docker;
  push per-commit SHA tag and promote to :latest on main
- Add docker-compose.yml: gallery-generator + nginx services sharing a
  named volume; configurable GENERATE_INTERVAL env var
- Add deploy/nginx.conf: gzip, security headers, correct caching policy
  (immutable for assets, no-store for HTML)
- Add deploy/entrypoint.sh: runs gallery generate on startup then loops
  on GENERATE_INTERVAL; exits cleanly when interval is 0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-29 11:48:04 +02:00
lars 8e3b928bb0 Merge main into dev: bring dev up to date with restructured package
Resolves add/add conflicts in .gitignore, config.yaml, pyproject.toml and
content conflict in README.md — taking main's version in all cases, as it
reflects the complete package rewrite (gallery/ package, TUI, CI pipeline).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-29 11:45:45 +02:00
Kylian Schmidt 0a345a0f22 Fix UI. Reduce excessive spacing between plot grid and subdirectories
- Reduce plot-container margin-bottom from 450px to 2rem in view-controls.css
- Reduce body padding-bottom from 400px to 2rem in base.css
- Fix unnecessary spacing since stats box uses fixed positioning
- Enhance logger with professional tree-structured output and colors
- Replace print statements with structured logging throughout codebase
2025-08-07 16:00:18 +02:00
Kylian Schmidt eb770428b9 Add proper logging 2025-08-01 13:50:20 +02:00
Kylian Schmidt 752cee2d06 Fix metadata lists being shown in a single line 2025-07-29 16:13:09 +02:00
Kylian Schmidt c6882b2a48 Fix metadata display not wrapping long lines. Add LaTeX support 2025-07-29 14:05:22 +02:00
Kylian Schmidt fc4928fef1 Add the metadata file path for easy copy+paste 2025-07-29 11:18:03 +02:00
Kylian Schmidt bcb083bbb9 Add an expandable metadata grid 2025-07-29 10:31:35 +02:00
Kylian Schmidt f3adbe49fa Added so much stuff I cant keep up. I think some sorting capability and a way to add metadata to each folder (WIP) 2025-07-29 09:38:28 +02:00
Kylian Schmidt 3e2aaa4be8 Add toggle for grid, list and compact list views 2025-07-22 13:19:53 +02:00
Kylian Schmidt dced82a56f Remove features that were not working: Metadata, export button and reloading the website from the website itself 2025-07-22 12:37:33 +02:00
Kylian Schmidt 6eeacdc9b7 Add pyproject.toml 2025-07-22 09:49:43 +02:00
Kylian Schmidt 491a4a9fd2 Add gallery index.html to website 2025-07-21 15:54:17 +02:00
Kylian Schmidt 465f9b6dc6 Try to fix metadata stuff again (does not work) 2025-07-21 15:33:33 +02:00
Kylian Schmidt 7a9275819a Fix index not being reloaded if a subfolder was added 2025-07-21 09:57:35 +02:00
Kylian Schmidt dbd67f6039 Fix template rendering issue and improve export functionality
- Fix template rendering by storing rendered HTML in variable before writing
  This resolves subdirectories not appearing in navigation despite being
  correctly detected and included in template variables
- Add missing template variables (paths.work_dir) to gallery config
- Add CGI refresh handler for web-based gallery regeneration
- Improve PDF export functionality with better error handling
- Add ESC key shortcut documentation for exiting selection mode
- Enhanced export manager with proper dependency checking

Fixes issue where new subdirectories were detected but not displayed
in browser navigation due to incomplete template rendering.
2025-07-20 08:59:10 +02:00
Kylian Schmidt 2d98ed0e7a Add export to latex button (i think) 2025-07-08 17:04:55 +02:00
Kylian Schmidt 8173d7618a Add metadata (WIP) 2025-07-08 13:54:13 +02:00
Kylian Schmidt 51a74b23f8 Add metadata button (WIP) 2025-07-08 13:19:54 +02:00
Kylian Schmidt 72ebc5e103 feat: Implement metadata system and reorganize project structure
 Features:
- Add comprehensive metadata system with YAML/JSON support
- Implement hierarchical metadata inheritance from parent folders
- Support plot-specific metadata overrides
- Add metadata caching for performance optimization

🗂️ Code Organization:
- Move Python orchestration code to orchestration/ folder
- Move validation utilities to tests/ folder
- Move documentation to docs/ folder
- Separate metadata functionality into dedicated module

🔧 Infrastructure:
- Add automatic asset copying to web directory
- Fix asset path resolution for nested directories
- Update template to use dynamic asset paths
- Add MetadataConfig class with inheritance options

📚 Documentation:
- Add comprehensive metadata usage guide (METADATA_USAGE.md)
- Add implementation documentation (METADATA_IMPLEMENTATION.md)
- Include example metadata files in examples/
- Add metadata validation utility script

🐛 Bug Fixes:
- Fix breadcrumb navigation and JavaScript functionality
- Resolve asset path issues in nested directories
- Update template imports for modular CSS/JS structure

This commit introduces a flexible metadata system that allows users to add
rich metadata to plots and folders using YAML or JSON files, with full
hierarchical inheritance and plot-specific overrides. The project structure
is now better organized with clear separation of concerns.
2025-07-08 12:33:49 +02:00
Kylian Schmidt 716e1c95fe Move jv and css to own folder 2025-07-08 08:14:10 +02:00
Kylian Schmidt 71cf2031e0 Add comparison between plots 2025-07-07 16:11:54 +02:00
Kylian Schmidt b5b2c676b3 Update 2025-07-07 15:26:01 +02:00
Kylian Schmidt 9041abb72f Update and refactor 2025-07-07 14:44:09 +02:00
Kylian Schmidt 976d90f26b Refactor gallery generator with smart file handling and improved UI
Key improvements:
- Add intelligent file update checking with 30-second buffer to avoid unnecessary operations
- Implement efficient PDF to PNG conversion (only when source is newer)
- Add smart file copying (skip if target is up-to-date)
- Create proper folder structure using plot_root/source_name pattern
- Improve template with better text handling for long plot names
- Add text wrapping, truncation, and hover tooltips for plot names
- Remove unnecessary directory cleaning for true incremental updates
- Fix title display issue (was showing '.' instead of 'Gallery')
- Add comprehensive logging showing what's processed vs skipped

Performance benefits:
- Subsequent runs are significantly faster (only processes changed files)
- Reduces ImageMagick conversions and file I/O operations
- Maintains file system timing robustness with buffer delays

UI improvements:
- Better handling of long filenames with word wrapping
- Constrained text areas prevent overlap between thumbnails
- Hover tooltips show full names when truncated
- Responsive grid layout maintained
2025-07-07 13:27:25 +02:00