Move livereload import inside docserve()

This fixes 'invoke setup' failing in fresh virtual environments.
The top-level import of livereload caused tasks.py to fail on
import before any task could execute, since livereload is a dev
dependency only installed by pdm during the setup process.
This commit is contained in:
cr7yash 2026-04-05 01:07:36 -07:00
commit 91d6a1b1e3
2 changed files with 5 additions and 1 deletions

3
RELEASE.md Normal file
View file

@ -0,0 +1,3 @@
Release type: patch
Move livereload import inside docserve() to fix invoke setup in fresh environments

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))