Remove legacy generate_gallery.py script. Good night, sweet prince

This commit is contained in:
Kylian Schmidt
2026-05-08 13:34:05 +02:00
parent 25b564e085
commit 6978a1b768
3 changed files with 3 additions and 102 deletions
+1
View File
@@ -7,3 +7,4 @@ backups
.venv
build
*egg-info
.claude
-100
View File
@@ -1,100 +0,0 @@
"""
Scientific Gallery Generator - Legacy CLI Entry Point
This module provides backward compatibility for the legacy CLI interface.
For new development, use the gallery package API directly:
from gallery import generate, GalleryConfig
config = GalleryConfig.from_yaml("config.yaml")
generate(config, verbose=True)
Or use the new CLI:
gallery --config config.yaml --verbose
"""
from gallery import generate
from gallery.config import GalleryConfig
def main(clean_first: bool = False, source_override: str = None) -> None:
"""
Main entry point for gallery generation (legacy interface).
Args:
clean_first: If True, removes and recreates the gallery directory
source_override: If provided, only process this source directory.
If not in config, it will be temporarily added.
Processes all configured sources and generates the complete gallery
structure in the web directory. Ensures assets are available.
"""
try:
# Load configuration from config.yaml
config = GalleryConfig.from_yaml("config.yaml")
# Handle source override
source_to_update = None
if source_override:
from pathlib import Path
from gallery.config import GallerySource
source_path = Path(source_override).resolve()
# Check if source is in config
matching_source = None
for source in config.sources:
if Path(source.path).resolve() == source_path:
matching_source = source
break
# If not in config, create a temporary source entry
if matching_source is None:
source_name = source_path.name
source_to_update = GallerySource(
name=source_name,
path=source_path
)
config.sources.append(source_to_update)
print(
f"Source {source_override} not in config. "
f"Adding temporarily as '{source_name}'"
)
else:
source_to_update = matching_source
# Generate gallery using the new API
success = generate(
config=config,
clean_first=clean_first,
verbose=True,
source_to_update=source_to_update
)
if not success:
exit(1)
except Exception as e:
print(f"Error: {e}")
exit(1)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description='Generate gallery')
parser.add_argument(
'--clean',
action='store_true',
help='Clean gallery directory before generation'
)
parser.add_argument(
'--source',
type=str,
default=None,
help='Override to only recompute a specific source directory. '
'If the directory is not in config, it will be added temporarily.'
)
args = parser.parse_args()
main(clean_first=args.clean, source_override=args.source)
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "gallery"
version = "0.1.0"
version = "0.1.1"
description = "Scientific Gallery Generator - Create responsive HTML galleries from plot collections"
readme = "README.md"
requires-python = ">=3.8"