Scripts Modules

These are helper scripts bundled with the project.

Optionals Module

yugiquery.scripts.optionals.install_filters() None

Install Git filters to automatically clean notebooks before committing them and redacting secrets from “secrets” files. Will initializes a new Git repository if one does not exist.

yugiquery.scripts.optionals.install_kernel(venv: bool = False) None

Create a virtual environment, install YugiQuery inside it, and install it as a Jupyter kernel.

Parameters:

venv (bool, optional) – Whether to create a virtual environment. Default is True.

yugiquery.scripts.optionals.install_nbconvert() None

Patch the nbconvert “Lab” template to include a dynamic light and dark theme, and preprocessor to remove cells tagged with “exclude”.

yugiquery.scripts.optionals.install_templates() None

Copy the notebook templates from the package’s ASSETS directory to the user’s NOTEBOOKS directory and .xlsx files to the DATA directory.

yugiquery.scripts.optionals.main(args)

Main function to handle the installation of optional components based on command-line arguments.

yugiquery.scripts.optionals.set_parser(target: _SubParsersAction | ArgumentParser | None = None) ArgumentParser

Configure the argument parser for the optional installation of additional components, including flags for each component and debug arguments.

Generate Auto Theme Module

yugiquery.scripts.generate_auto_theme.classify_variables(light, dark)

Classifies variables into common, light-only, and dark-only groups.

yugiquery.scripts.generate_auto_theme.extract_variables(css)

Extracts CSS variables from CSS content, ignoring comments.

yugiquery.scripts.generate_auto_theme.find_theme_directory()

Finds the directory containing theme files.

yugiquery.scripts.generate_auto_theme.generate_theme_css(template_dir)

Generates theme-auto.css using theme-light.css and theme-dark.css.

yugiquery.scripts.generate_auto_theme.main()

Main function to generate theme-auto.css and update template files.

yugiquery.scripts.generate_auto_theme.update_conf_json(template_dir)

Updates the conf.json file with the new preprocessor.

yugiquery.scripts.generate_auto_theme.update_index_html(template_dir)

Updates the index.html.j2 file with the new theme block.