diff --git a/.gitignore b/.gitignore index 8ff9619..f97a30b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ backups .pytest_cache .venv build -*egg-info \ No newline at end of file +*egg-info +.claude \ No newline at end of file diff --git a/generate_gallery.py b/generate_gallery.py deleted file mode 100644 index f583f79..0000000 --- a/generate_gallery.py +++ /dev/null @@ -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) diff --git a/pyproject.toml b/pyproject.toml index cf7ee9a..1a7a2c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"