3b9d1ef1a8
- 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>
77 lines
1.8 KiB
Python
77 lines
1.8 KiB
Python
"""
|
|
Scientific Gallery Generator
|
|
|
|
A Python package for creating responsive HTML galleries from scientific plot
|
|
collections. Supports PDF to PNG conversion, hierarchical directory structures,
|
|
and can be used programmatically or via CLI.
|
|
|
|
Example usage:
|
|
from gallery import generate, GalleryConfig, GallerySource
|
|
|
|
config = GalleryConfig(
|
|
web_folder="/path/to/output",
|
|
sources=[
|
|
GallerySource(name="plots", path="/path/to/plots"),
|
|
]
|
|
)
|
|
|
|
success = generate(config, verbose=True)
|
|
"""
|
|
|
|
__version__ = "0.1.0"
|
|
__author__ = "K. Schmidt"
|
|
|
|
from gallery.api import generate
|
|
from gallery.builder import build_gallery, get_template
|
|
from gallery.config import (
|
|
GalleryConfig,
|
|
GalleryDefaults,
|
|
GallerySource,
|
|
)
|
|
from gallery.utils.datetime_utils import (
|
|
datetime_from_timestamp,
|
|
strftime_filter,
|
|
)
|
|
from gallery.utils.metadata import (
|
|
load_folder_metadata,
|
|
load_metadata_file,
|
|
merge_metadata,
|
|
resolve_metadata_for_plot,
|
|
save_metadata_cache,
|
|
)
|
|
from gallery.utils.processing import (
|
|
convert_pdf_to_png,
|
|
needs_update,
|
|
process_plot_files,
|
|
render_gallery_page,
|
|
)
|
|
|
|
# Export utility functions for testing and advanced usage
|
|
from gallery.utils.stats import (
|
|
calculate_directory_stats,
|
|
format_file_size,
|
|
)
|
|
|
|
__all__ = [
|
|
"generate",
|
|
"GalleryConfig",
|
|
"GallerySource",
|
|
"GalleryDefaults",
|
|
# Utilities
|
|
"calculate_directory_stats",
|
|
"format_file_size",
|
|
"convert_pdf_to_png",
|
|
"needs_update",
|
|
"process_plot_files",
|
|
"render_gallery_page",
|
|
"load_folder_metadata",
|
|
"merge_metadata",
|
|
"save_metadata_cache",
|
|
"load_metadata_file",
|
|
"resolve_metadata_for_plot",
|
|
"build_gallery",
|
|
"get_template",
|
|
"datetime_from_timestamp",
|
|
"strftime_filter",
|
|
]
|