From 452b59728fde58e7f6fa869c6a689c1fe81f04d4 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 20 May 2025 15:56:12 -0400 Subject: [PATCH] fix list_templates command in switching this to use pathlib, the template names were coming out as long absolute paths Change-Id: I3ba7de601a11fbd28e96c63e7bdcfd4accdfd858 --- alembic/command.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/alembic/command.py b/alembic/command.py index 9b1a44cb..4ae3f9ef 100644 --- a/alembic/command.py +++ b/alembic/command.py @@ -31,11 +31,9 @@ def list_templates(config: Config) -> None: config.print_stdout("Available templates:\n") for tempname in config._get_template_path().iterdir(): - with ( - config._get_template_path() / tempname / "README" - ).open() as readme: + with (tempname / "README").open() as readme: synopsis = next(readme).rstrip() - config.print_stdout("%s - %s", tempname, synopsis) + config.print_stdout("%s - %s", tempname.name, synopsis) config.print_stdout("\nTemplates are used via the 'init' command, e.g.:") config.print_stdout("\n alembic init --template generic ./scripts") -- 2.47.3