fix: Move livereload import inside docserve() task

This fixes `invoke setup` failing in fresh virtual environments.
The top-level import of `livereload` caused tasks.py to fail before any
task could execute, since `livereload` is a development dependency only
installed by PDM as part of the setup task.
This commit is contained in:
Yash Srivastava 2026-04-05 23:51:51 +05:30 committed by GitHub
commit 77e88ae3f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3,7 +3,6 @@ from pathlib import Path
from shutil import which
from invoke import task
from livereload import Server
PKG_NAME = "pelican"
PKG_PATH = Path(PKG_NAME)
@ -30,6 +29,8 @@ def docbuild(c):
@task(docbuild)
def docserve(c):
"""Serve docs at http://localhost:$DOCS_PORT/ (default port is 8000)"""
from livereload import Server # noqa: PLC0415
server = Server()
server.watch("docs/conf.py", lambda: docbuild(c))
server.watch("CONTRIBUTING.rst", lambda: docbuild(c))