diff --git a/docker/startup.py b/docker/startup.py index 4b9b16e..a8156a3 100644 --- a/docker/startup.py +++ b/docker/startup.py @@ -102,7 +102,6 @@ def main(): write_credentials(access_key, secret_key) except Exception as e: print(f"[startup] Setup failed: {e}") - pass os.environ["KOHAKU_HUB_LAKEFS_ACCESS_KEY"] = access_key os.environ["KOHAKU_HUB_LAKEFS_SECRET_KEY"] = secret_key diff --git a/images/generate_png_favicons.py b/images/generate_png_favicons.py index af00a98..7433b83 100644 --- a/images/generate_png_favicons.py +++ b/images/generate_png_favicons.py @@ -5,64 +5,75 @@ import subprocess import sys from pathlib import Path + def generate_png_with_inkscape(svg_path, output_path, size): """Generate PNG using Inkscape CLI (if available)""" try: - subprocess.run([ - 'inkscape', - str(svg_path), - '--export-filename', str(output_path), - '--export-width', str(size), - '--export-height', str(size) - ], check=True, capture_output=True) + subprocess.run( + [ + "inkscape", + str(svg_path), + "--export-filename", + str(output_path), + "--export-width", + str(size), + "--export-height", + str(size), + ], + check=True, + capture_output=True, + ) return True except (subprocess.CalledProcessError, FileNotFoundError): return False + def generate_png_with_cairosvg(svg_path, output_path, size): """Generate PNG using cairosvg library""" try: import cairosvg + cairosvg.svg2png( url=str(svg_path), write_to=str(output_path), output_width=size, - output_height=size + output_height=size, ) return True except ImportError: return False + def main(): # Paths script_dir = Path(__file__).parent - svg_path = script_dir / 'logo-square.svg' + svg_path = script_dir / "logo-square.svg" # Favicon sizes to generate sizes = [ - (16, 'favicon-16x16.png'), - (32, 'favicon-32x32.png'), - (180, 'apple-touch-icon.png'), - (192, 'android-chrome-192x192.png'), - (512, 'android-chrome-512x512.png'), + (16, "favicon-16x16.png"), + (32, "favicon-32x32.png"), + (180, "apple-touch-icon.png"), + (192, "android-chrome-192x192.png"), + (512, "android-chrome-512x512.png"), ] # Output directories - ui_public = script_dir.parent / 'src' / 'kohaku-hub-ui' / 'public' - admin_public = script_dir.parent / 'src' / 'kohaku-hub-admin' / 'public' + ui_public = script_dir.parent / "src" / "kohaku-hub-ui" / "public" + admin_public = script_dir.parent / "src" / "kohaku-hub-admin" / "public" print(f"Generating PNG favicons from {svg_path}...") print() # Try cairosvg first, then inkscape method = None - if generate_png_with_cairosvg(svg_path, script_dir / 'test.png', 16): - method = 'cairosvg' - (script_dir / 'test.png').unlink() + if generate_png_with_cairosvg(svg_path, script_dir / "test.png", 16): + method = "cairosvg" + (script_dir / "test.png").unlink() print("✓ Using cairosvg") - elif generate_png_with_inkscape(svg_path, script_dir / 'test.png', 16): - method = 'inkscape' - (script_dir / 'test.png').unlink() + elif generate_png_with_inkscape(svg_path, script_dir / "test.png", 16): + method = "inkscape" + (script_dir / "test.png").unlink() print("✓ Using Inkscape") else: print("❌ Error: Neither cairosvg nor Inkscape is available") @@ -83,7 +94,7 @@ def main(): for size, filename in sizes: output_path = output_dir / filename - if method == 'cairosvg': + if method == "cairosvg": success = generate_png_with_cairosvg(svg_path, output_path, size) else: success = generate_png_with_inkscape(svg_path, output_path, size) @@ -98,5 +109,6 @@ def main(): print("✓ All favicons generated successfully!") return 0 -if __name__ == '__main__': + +if __name__ == "__main__": sys.exit(main()) diff --git a/scripts/show_s3_usage.py b/scripts/show_s3_usage.py index 845c08f..23beb41 100644 --- a/scripts/show_s3_usage.py +++ b/scripts/show_s3_usage.py @@ -84,7 +84,7 @@ def analyze_storage(s3_client, bucket): TextColumn("[progress.description]{task.description}"), transient=True, ) as progress: - task = progress.add_task("Analyzing storage...", total=None) + progress.add_task("Analyzing storage...", total=None) paginator = s3_client.get_paginator("list_objects_v2") try: