1.1.1.2.1.1.1.1. nikola.plugins.command.auto package — Nikola 8.1.3 documentation

# 1.1.1.2.1.1.1.1. nikola.plugins.command.auto package

Automatic rebuilds for Nikola.

class nikola.plugins.command.auto.CommandAuto(*args, **kwargs)

  Bases: :class:`nikola.plugin_categories.Command`

  Automatic rebuilds for Nikola.

  cmd_options = [{'name': 'port', 'short': 'p', 'long': 'port', 'default': 8000, 'type': <class 'int'>, 'help': 'Port number'}, {'name': 'address', 'short': 'a', 'long': 'address', 'type': <class 'str'>, 'default': '127.0.0.1', 'help': 'Address to bind'}, {'name': 'browser', 'short': 'b', 'long': 'browser', 'type': <class 'bool'>, 'help': 'Start a web browser', 'default': False}, {'name': 'ipv6', 'short': '6', 'long': 'ipv6', 'default': False, 'type': <class 'bool'>, 'help': 'Use IPv6'}, {'name': 'no-server', 'long': 'no-server', 'default': False, 'type': <class 'bool'>, 'help': 'Disable the server, automate rebuilds only'}, {'name': 'process', 'short': 'n', 'long': 'process', 'default': 0, 'type': <class 'int'>, 'help': 'Number of subprocesses', 'section': 'Arguments passed to `nikola build`'}, {'name': 'parallel-type', 'short': 'P', 'long': 'parallel-type', 'default': 'process', 'type': <class 'str'>, 'help': "Parallelization mode ('process' or 'thread')", 'section': 'Arguments passed to `nikola build`'}, {'name': 'db-file', 'long': 'db-file', 'default': '.doit.db', 'type': <class 'str'>, 'help': 'Database file', 'section': 'Arguments passed to `nikola build`'}, {'name': 'backend', 'long': 'backend', 'default': 'dbm', 'type': <class 'str'>, 'help': "Database backend ('dbm', 'json', 'sqlite3')", 'section': 'Arguments passed to `nikola build`'}]
  delta_last_rebuild = datetime.timedelta(microseconds=100000)
  dns_sd = None
  doc_purpose = 'builds and serves a site; automatically detects site changes, rebuilds, and optionally refreshes a browser'
  has_server = True
  name = 'auto'
  async queue_rebuild(event) → None

    Rebuild the site.

  async reload_page(event) → None

    Reload the page.

  async remove_websockets(app) → None

    Remove all websockets.

  async run_initial_rebuild() → None

    Run an initial rebuild.

  async run_rebuild_queue() → None

    Run rebuilds from a queue (Nikola can only build in a single instance).

  async run_reload_queue() → None

    Send reloads from a queue to limit CPU usage.

  async send_to_websockets(message: dict) → None

    Send a message to all open WebSockets.

  async serve_livereload_js(request)

    Handle requests to /livereload.js and serve the JS file.

  async serve_robots_txt(request)

    Handle requests to /robots.txt.

  async set_up_server(host: str, port: int, out_folder: str) → None

    Set up aiohttp server and start it.

  web_runner: aiohttp.web_runner.AppRunner = None
  async websocket_handler(request)

    Handle requests to /livereload and initiate WebSocket communication.

class nikola.plugins.command.auto.ConfigEventHandler(configuration_filename, function, loop)

  Bases: :class:`nikola.plugins.command.auto.NikolaEventHandler`

  A Nikola-specific handler for Watchdog that handles the config file (as a workaround).

  async on_any_event(event)

    Handle file events if they concern the configuration file.

class nikola.plugins.command.auto.IndexHtmlStaticResource(modify_html=True, snippet='</head>', *args, **kwargs)

  Bases: :class:`~typing.Sized`, :class:`~typing.Iterable`[:class:`AbstractRoute`]

  A StaticResource implementation that serves /index.html in directory roots.

  async handle_file(request: aiohttp.web_request.Request, filename: str, from_index=None) → aiohttp.web_response.Response

    Handle file requests.

  modify_html = True
  snippet = '</head>'
  transform_html(text: str) → str

    Apply some transforms to HTML content.

class nikola.plugins.command.auto.NikolaEventHandler(function, loop)

  Bases: :class:`object`

  A Nikola-specific event handler for Watchdog. Based on code from hachiko.

  dispatch(event)

    Dispatch events to handler.

  async on_any_event(event)

    Handle all file events.

async nikola.plugins.command.auto.windows_ctrlc_workaround() → None

  Work around bpo-23057.