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>
This commit is contained in:
+13
-17
@@ -2,7 +2,8 @@
|
||||
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from typing import Dict, Any, Optional, Union
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
from jinja2 import Environment, FileSystemLoader, Template
|
||||
|
||||
from gallery.config import GalleryConfig
|
||||
@@ -17,7 +18,6 @@ from gallery.utils.metadata import (
|
||||
)
|
||||
from gallery.utils.processing import (
|
||||
process_plot_files,
|
||||
needs_update,
|
||||
render_gallery_page,
|
||||
)
|
||||
|
||||
@@ -39,13 +39,14 @@ def get_template(template_dir: Optional[Union[Path, str]] = None):
|
||||
if template_dir is None:
|
||||
# Use package-included template
|
||||
import gallery
|
||||
|
||||
gallery_module_path = Path(gallery.__file__).parent
|
||||
template_dir = gallery_module_path / "templates"
|
||||
|
||||
env = Environment(loader=FileSystemLoader(str(template_dir)))
|
||||
|
||||
env.filters['datetime_from_timestamp'] = datetime_from_timestamp
|
||||
env.filters['strftime'] = strftime_filter
|
||||
env.filters["datetime_from_timestamp"] = datetime_from_timestamp
|
||||
env.filters["strftime"] = strftime_filter
|
||||
|
||||
return env.get_template("gallery.html")
|
||||
|
||||
@@ -54,8 +55,8 @@ def build_gallery(
|
||||
config: GalleryConfig,
|
||||
source_dir: Path,
|
||||
web_dir: Path,
|
||||
template: Template = None,
|
||||
relative_path: Path = None,
|
||||
template: Optional[Template] = None,
|
||||
relative_path: Optional[Path] = None,
|
||||
inherited_metadata: Optional[Dict[str, Any]] = None,
|
||||
) -> None:
|
||||
"""
|
||||
@@ -119,7 +120,7 @@ def build_gallery(
|
||||
subdir_web,
|
||||
template,
|
||||
subdir_relative,
|
||||
current_metadata if config.inherit_from_parent else {}
|
||||
current_metadata if config.inherit_from_parent else {},
|
||||
)
|
||||
subdir_names.append(subdir.name)
|
||||
|
||||
@@ -130,15 +131,11 @@ def build_gallery(
|
||||
items=items,
|
||||
subdirs=subdir_names,
|
||||
relative_path=relative_path,
|
||||
metadata=current_metadata
|
||||
metadata=current_metadata,
|
||||
)
|
||||
|
||||
|
||||
def copy_assets(
|
||||
config: GalleryConfig,
|
||||
assets_src: Optional[Path] = None,
|
||||
verbose: bool = False
|
||||
) -> bool:
|
||||
def copy_assets(config: GalleryConfig, assets_src: Optional[Path] = None, verbose: bool = False) -> bool:
|
||||
"""
|
||||
Copy assets to the web directory.
|
||||
|
||||
@@ -154,14 +151,13 @@ def copy_assets(
|
||||
if assets_src is None:
|
||||
# Use package-included assets
|
||||
import gallery
|
||||
|
||||
gallery_module_path = Path(gallery.__file__).parent
|
||||
assets_src = gallery_module_path / "assets"
|
||||
|
||||
if not assets_src.exists():
|
||||
if verbose:
|
||||
print(
|
||||
f"Warning: Assets directory {assets_src} not found"
|
||||
)
|
||||
print(f"Warning: Assets directory {assets_src} not found")
|
||||
return False
|
||||
|
||||
gallery_root = Path(config.web_folder) / config.plot_root
|
||||
@@ -171,7 +167,7 @@ def copy_assets(
|
||||
# so any change to any JS/CSS file triggers a redeploy.
|
||||
sentinel_dst = assets_dst / "css" / "main.css"
|
||||
newest_src_mtime = max(
|
||||
(f.stat().st_mtime for f in assets_src.rglob('*') if f.is_file()),
|
||||
(f.stat().st_mtime for f in assets_src.rglob("*") if f.is_file()),
|
||||
default=0,
|
||||
)
|
||||
dst_mtime = sentinel_dst.stat().st_mtime if sentinel_dst.exists() else 0
|
||||
|
||||
Reference in New Issue
Block a user