Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a7dce51
chore: add config for linters and formatters
Bubu-Droid Oct 17, 2026
87dfdc0
build: replace setuptools with hatchling
Bubu-Droid Oct 17, 2026
9db8908
chore: add config for pre-commit hooks
Bubu-Droid Oct 17, 2026
56833b2
chore: pin python version to 3.14
Bubu-Droid Oct 17, 2026
f8e6bd9
refactor: use modern library structure
Bubu-Droid Oct 17, 2026
f699106
chore: ignore non-fenced code blocks
Bubu-Droid Oct 17, 2026
dce77bf
refactor: move author and homepage into pyproject.toml
Bubu-Droid Oct 17, 2026
da45ef7
build: shift project build settings to pyproject
Bubu-Droid Oct 17, 2026
33c56aa
chore: pin project dependencies
Bubu-Droid Oct 17, 2026
3a88658
feat: add argument for version and refactor code
Bubu-Droid Oct 17, 2026
7c35433
style: run ruff format
Bubu-Droid Oct 17, 2026
bf25242
chore: ignore unused call results in basedpyright
Bubu-Droid Oct 17, 2026
ce5b5a7
test: run ruff format
Bubu-Droid Oct 17, 2026
b6b5cd8
chore: remove shebang from non-executable file
Bubu-Droid Oct 17, 2026
371c8f5
style: run prettier format
Bubu-Droid Oct 17, 2026
22e8c75
ci: de-couple workflows into individual units
Bubu-Droid Oct 17, 2026
bd8f883
refactor: drop MANIFEST.in as hatchling config handles the files
Bubu-Droid Oct 17, 2026
44ff543
build: update makefile with uv commands
Bubu-Droid Oct 17, 2026
090e2e1
chore: remove global exclude-files
Bubu-Droid Oct 17, 2026
fadf9f0
chore: update vendor file path
Bubu-Droid Oct 17, 2026
cd558db
chore: remove lint and typecheck
Bubu-Droid Oct 17, 2026
573891f
style: use pyright ignore for type complain
Bubu-Droid Oct 17, 2026
53c2d74
fix: comment out lint and typecheck
Bubu-Droid Oct 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/prek.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Prek Checks"
on:
push:
branches: [master]
pull_request:
permissions: {}
jobs:
prek:
name: "Run prek"
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install uv"
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: true
- name: "Set up Python"
run: uv python install
- name: "Install dependencies"
run: uv sync --locked --all-extras --dev
- name: "Run prek"
uses: j178/prek-action@4e14d07f9231acabce116ccfca13b13dd9755ece # v3.0.0
99 changes: 39 additions & 60 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,48 @@
name: Release theme to PyPI

permissions:
contents: write
id-token: write

name: "PyPI Release"
on:
push:
tags:
- v2.*

workflow_dispatch:
permissions: {}
jobs:
build:
name: build dist files
name: "Build distributions"
# Only publish from a release tag, never from a branch.
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest

permissions:
contents: read
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.11

- name: install build
run: python -m pip install --upgrade build

- name: build dist
run: python -m build

- uses: actions/upload-artifact@v4
with:
name: artifacts
path: dist/*
if-no-files-found: error

publish:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Set up python"
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version-file: .python-version
- name: "Install Hatch"
run: pipx install hatch
- name: "Build package"
run: hatch build
- name: "Upload distributions"
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dist
path: dist/
if-no-files-found: error
pypi-publish:
name: "Upload release to PyPI"
needs: build
runs-on: ubuntu-latest
environment:
name: pypi-release
url: https://pypi.org/p/livereload

name: release to pypi
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
name: artifacts
path: dist

- name: Push build artifacts to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

release:
name: write release note
runs-on: ubuntu-latest
needs: publish

permissions:
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npx changelogithub --no-group
continue-on-error: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: "Download distributions"
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: dist
path: dist/
- name: "Publish package distributions to PyPI"
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
31 changes: 31 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Run Tests (pytest)"
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
permissions: {}
jobs:
tests:
name: "Run pytest"
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: "Install uv and set up Python version"
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: "Install dependencies"
run: uv sync --locked --all-extras --dev
- name: "Run pytest"
run: uv run pytest
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "GitHub Release"
on:
push:
tags: ["v*"]
permissions: {}
jobs:
release:
name: "Write release notes"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: "Checkout code"
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
fetch-depth: 0
# NOTE: changing to gh specific actions can help drop node setup
- name: "Setup node"
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
package-manager-cache: false
- name: "Generate changelog"
run: npx changelogithub --no-group
continue-on-error: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
109 changes: 109 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_install_hook_types: ["pre-commit", "commit-msg", "pre-push"]

repos:
- repo: "https://github.com/compilerla/conventional-pre-commit"
rev: "v4.4.0"
hooks:
- id: "conventional-pre-commit"
stages: ["commit-msg"]

- repo: "https://github.com/pre-commit/pre-commit-hooks"
rev: "v6.0.0"
hooks:
- id: "trailing-whitespace"
- id: "end-of-file-fixer"
- id: "check-toml"
- id: "check-yaml"
- id: "mixed-line-ending"
- id: "check-merge-conflict"
- id: "detect-private-key"
- id: "check-shebang-scripts-are-executable"
- id: "check-executables-have-shebangs"

- repo: "meta"
hooks:
- id: "check-useless-excludes"

- repo: "https://github.com/gitleaks/gitleaks"
rev: "v8.30.1"
hooks:
- id: "gitleaks"

- repo: "https://github.com/zizmorcore/zizmor-pre-commit"
rev: "v1.30.1"
hooks:
- id: "zizmor"

# - repo: "https://github.com/astral-sh/ruff-pre-commit"
# rev: "v0.16.10"
# hooks:
# - id: "ruff-format"
# - id: "ruff-check"

# - repo: "https://github.com/DetachHead/basedpyright-prek-mirror"
# rev: "1.40.1"
# hooks:
# - id: "basedpyright"

- repo: "https://github.com/tox-dev/pyproject-fmt"
rev: "v2.30.0"
hooks:
- id: "pyproject-fmt"
files: "^pyproject\\.toml$"

- repo: "https://github.com/tombi-toml/tombi-pre-commit"
rev: "v1.7.1"
hooks:
- id: "tombi-format"
exclude: "(^pyproject\\.toml$|^uv\\.lock$)"
- id: "tombi-lint"

- repo: "https://github.com/google/yamlfmt"
rev: "v0.21.0"
hooks:
- id: "yamlfmt"

- repo: "https://github.com/rhysd/actionlint"
rev: "v1.7.12"
hooks:
- id: "actionlint"
files: "^\\.github/workflows/.*\\.ya?ml$"

- repo: "https://github.com/adrienverge/yamllint.git"
rev: "v1.38.0"
hooks:
- id: "yamllint"
exclude: "^\\.github/workflows/.*\\.ya?ml$"

- repo: "https://github.com/rvben/rumdl-pre-commit"
rev: "v0.2.78"
hooks:
- id: "rumdl-fmt"
- id: "rumdl"

- repo: "https://github.com/JoC0de/pre-commit-prettier"
rev: "v3.9.9"
hooks:
- id: "prettier"
types_or: ["html", "css", "javascript"]

- repo: "https://github.com/codespell-project/codespell"
rev: "v2.4.3"
hooks:
- id: "codespell"

- repo: "https://github.com/astral-sh/uv-pre-commit"
rev: "0.12.23"
hooks:
- id: "uv-lock"

- repo: "local"
hooks:
- id: "pytest"
name: "pytest"
entry: "uv run pytest"
pass_filenames: false
language: "system"
stages: ["pre-push"]
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/livereload/vendors/livereload.js
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
3 changes: 3 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extends: default
rules:
document-start: disable
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.PHONY: clean-pyc clean-build docs test coverage
# .PHONY: clean-pyc clean-build docs test coverage lint typecheck check build install
.PHONY: clean-pyc clean-build docs test coverage check build install

clean: clean-build clean-pyc

Expand All @@ -15,14 +16,25 @@ clean-pyc:
find . -name '*~' -exec rm -f {} +

install:
python3 setup.py install
uv sync

build:
uv build

docs:
$(MAKE) -C docs html

test:
@nosetests -s
uv run pytest

# lint:
# uv run ruff check .

# typecheck:
# uv run basedpyright

# check: lint typecheck test
check: test

coverage:
@rm -f .coverage
@nosetests --with-coverage --cover-package=livereload --cover-html
uv run --with pytest-cov pytest --cov=livereload --cov-report=html
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""A sphinx documentation configuration file.
"""
"""A sphinx documentation configuration file."""

# -- Project information ---------------------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
Expand Down
20 changes: 10 additions & 10 deletions example/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE HTML>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Python LiveReload Example</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>Example</h1>
<p>Container</p>
</body>
<head>
<meta charset="UTF-8" />
<title>Python LiveReload Example</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>Example</h1>
<p>Container</p>
</body>
</html>
4 changes: 1 addition & 3 deletions example/server.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python

from livereload import Server, shell

server = Server()
server.watch('style.less', shell('lessc style.less', output='style.css'))
server.watch("style.less", shell("lessc style.less", output="style.css"))
server.serve(open_url_delay=1)
Loading
Loading