diff --git a/docs/.overrides/404.html b/docs/.overrides/404.html deleted file mode 100644 index 150bd25..0000000 --- a/docs/.overrides/404.html +++ /dev/null @@ -1,9 +0,0 @@ -{% extends "main.html" %} {% block content %} -

Welcome to Blank Space 404

-

You have been following broken links for as long as you can remember.

-

- Try starting from the home page, or - searching for what you're looking for. -

- -{% endblock %} diff --git a/iconoclast/cli/cli.py b/iconoclast/cli/cli.py index c95ec0e..5669228 100644 --- a/iconoclast/cli/cli.py +++ b/iconoclast/cli/cli.py @@ -1,7 +1,6 @@ import contextlib import shutil import subprocess -import sys from datetime import datetime from pathlib import Path from tempfile import TemporaryDirectory @@ -24,9 +23,7 @@ app = typer.Typer(rich_markup_mode="rich") -here = Path(__file__).parent - -pip = [sys.executable, "-m", "pip", "--disable-pip-version-check"] +HERE = Path(__file__).parent def common_options(func: Callable): @@ -61,7 +58,7 @@ def install(ctx: typer.Context): """ Download Font Awesome Pro. """ - forbidden = {"--index-url", "-i"}.intersection(ctx.args) + forbidden = {"--index-url", "--index", "-i"}.intersection(ctx.args) if forbidden: raise Iconoquit( @@ -82,7 +79,7 @@ def install(ctx: typer.Context): index_url = f"https://dl.fontawesome.com/{token}/fontawesome-pro/python/simple" subprocess.run( - [*pip, "install", "fontawesomepro", "--index-url", index_url, *ctx.args], + [*plugin_config.installer_args, "fontawesomepro", "-i", index_url, *ctx.args], ) @@ -101,7 +98,8 @@ def kit( """ config_file = ctx.params.get("config_file") config = load_config(str(config_file) if config_file else None) - kit_config: IconokitConfig = config.plugins["iconoclast"].config.kit + plugin_config: IconoclastConfig = config.plugins["iconoclast"].config + kit_config: IconokitConfig = plugin_config.kit if not kit_config.enabled: raise Iconoquit( @@ -147,7 +145,7 @@ def kit( iconokit_root = Path.cwd() / "iconokit" iconokit_pkg = iconokit_root / "iconokit" - shutil.copytree(here / "iconokit", iconokit_root, dirs_exist_ok=True) + shutil.copytree(HERE / "iconokit", iconokit_root, dirs_exist_ok=True) (iconokit_pkg / ".token").write_text(kit_["token"]) icons_dir = iconokit_pkg / ".overrides" / ".icons" / "fontawesome" / "kit" @@ -161,7 +159,12 @@ def kit( (icons_dir / icon["name"]).with_suffix(".svg").write_text(svg) subprocess.run( - [*pip, "install", iconokit_root.absolute(), *ctx.args], + [ + *plugin_config.installer_args, + "install", + iconokit_root.absolute(), + *ctx.args, + ], ) if not {"--quiet", "-q"}.intersection(ctx.args): diff --git a/iconoclast/plugins/main.py b/iconoclast/plugins/main.py index 0a8a580..3323f38 100644 --- a/iconoclast/plugins/main.py +++ b/iconoclast/plugins/main.py @@ -38,8 +38,16 @@ class IconoclastConfig(Config): "FONTAWESOME_PKG_TOKEN", os.getenv("FONTAWESOME_NPM_AUTH_TOKEN", "") ), ) + uv = c.Type(bool, default=False) kit: IconokitConfig = c.SubConfig(IconokitConfig) + @property + def installer_args(self): + if self.uv and shutil.which("uv"): + return ["uv", "pip", "install"] + + return [sys.executable, "-m", "pip", "--disable-pip-version-check", "install"] + class IconoclastPlugin(BasePlugin[IconoclastConfig]): def on_config(self, config: MkDocsConfig) -> Optional[Config]: diff --git a/iconoclast/plugins/utils.py b/iconoclast/plugins/utils.py index b7794a6..a0ef7bf 100644 --- a/iconoclast/plugins/utils.py +++ b/iconoclast/plugins/utils.py @@ -22,8 +22,8 @@ def get_package_path() -> Path: except ImportError: log.error( ansify( - "Font Awesome Pro is [bold underline red]not installed[/]. " - "Run [bold underline green]iconoclast install[/] to install it." + "Font Awesome Pro is not installed. " + "Run [cyan]iconoclast install[/] to install it." ) ) sys.exit(1) diff --git a/mkdocs.yml b/mkdocs.yml index 01a6298..38aa2da 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -65,6 +65,7 @@ plugins: - social - iconoclast: css: true + uv: true - artwall # Extensions