Skip to content

feat: support python -m livereload invocation#287

Open
krisvandecruys wants to merge 1 commit intolepture:masterfrom
krisvandecruys:feat/python-m-invocation
Open

feat: support python -m livereload invocation#287
krisvandecruys wants to merge 1 commit intolepture:masterfrom
krisvandecruys:feat/python-m-invocation

Conversation

@krisvandecruys
Copy link

Summary

Adds livereload/__main__.py so the development server can be started with:

python -m livereload [directory]

This mirrors the familiar pattern established by python -m http.server from the standard library, which many developers already reach for when they need a quick local server.

The implementation delegates directly to the existing cli.main() entry point — no behaviour changes, no new arguments, no new dependencies. The __main__.py is three lines.

Before / After

Before:

# Required a one-liner or a dedicated script
python -c "from livereload import Server; Server().serve(root='.')"

After:

python -m livereload
python -m livereload ./docs
python -m livereload --port 8080 ./site

Test plan

  • python -m livereload --help shows the existing CLI help
  • python -m livereload . serves the current directory with live reload
  • python -m livereload ./subdir serves a subdirectory correctly
  • All existing CLI flags (--host, --port, --target, etc.) work as before

🤖 Generated with Claude Code

Adds __main__.py so the server can be started with:

    python -m livereload [directory]

This mirrors the familiar pattern of python -m http.server and delegates
directly to the existing cli.main() entry point, keeping the behaviour
identical to the livereload console script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant