Skip to content

RFW: Livereload in development #2

Open
@davegaeddert

Description

@davegaeddert

When using combine work, there should be a livereload feature.

The initial suggestion is to implement this using python-livereload. There is some potential for overlap between Combine's current implementation of "build steps" and livereload's ability to run commands. It is probably best to leave that alone, and instead just focus on whether the basic HTTP server can be replaced with a livereload server that simply focuses on reloading pages automatically:

combine/combine/dev.py

Lines 109 to 135 in 2fa299c

class Server:
def __init__(self, path, port=8000):
self.path = path
self.port = port
self.httpd = HTTPServer(self.path, ("", self.port))
def serve(self):
click.secho(f"Serving at http://127.0.0.1:{self.port}", fg="green")
self.httpd.serve_forever()
class HTTPHandler(SimpleHTTPRequestHandler):
"""This handler uses server.base_path instead of always using os.getcwd()"""
def translate_path(self, path):
path = SimpleHTTPRequestHandler.translate_path(self, path)
relpath = os.path.relpath(path, os.getcwd())
fullpath = os.path.join(self.server.base_path, relpath)
return fullpath
class HTTPServer(BaseHTTPServer):
"""The main server, you pass in base_path which is the path you want to serve requests from"""
def __init__(self, base_path, server_address, RequestHandlerClass=HTTPHandler):
self.base_path = base_path
BaseHTTPServer.__init__(self, server_address, RequestHandlerClass)

Requirements:

  • Livereload is enabled by default with combine work
  • Option to disable livereload with a CLI option
  • Option to specify the livereload port with a CLI option

(You don't have to work on the documentation -- we can do that part ourselves.)

General steps to get started:

  1. Fork this repo
  2. Run ./scripts/install
  3. poetry add livereload
  4. Run ./scripts/docs to test your changes on the Combine docs site
  5. Most of the work will be in dev.py, and the CLI options can be added in cli.py
  6. Make a branch and submit a pull request. Specific questions can be asked and answered on the PR.

This RFW is currently worth $150 and you'll be paid when we merge your PR. You can find more information and other RFWs on the Dropseed website.

Any questions can be asked here or through our private contact page!

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFWRequest for workdependenciesPull requests that update a dependency fileenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions