-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
Milestone
Description
Summary
Add a make dev task to the generated project template that provides auto-reload functionality during development. Uses watchfiles (Python-native, cross-platform) which is already used by HARP core.
Context
When developing HARP proxy applications, developers need to manually restart the server after each code or configuration change. A make dev task with file watching would significantly improve the development experience.
The cookiecutter template lives at harp/commandline/cookiecutters/project/{{cookiecutter.__dir_name}}/Makefile.
Proposed Implementation
Makefile addition
dev: install ## Start HARP proxy with auto-reload on file changes
$(call execute,$(UV) run watchfiles "$(UV) run harp-proxy server{% if cookiecutter.create_application %} --enable {{cookiecutter.__pkg_name}}{% endif %}{% if cookiecutter.create_config %} --file config.yml{% endif %} $(HARP_OPTIONS)"{% if cookiecutter.create_application %} {{cookiecutter.__pkg_name}}/{% endif %}{% if cookiecutter.create_config %} config.yml{% endif %})pyproject.toml addition
Add watchfiles as a dev dependency:
[project.optional-dependencies]
dev = ["watchfiles"]Features
- File watching: Monitors
config.yml(if enabled) and all files in the application directory (if enabled) - Cross-platform: Works on macOS, Linux, and Windows without external dependencies
- Proven: Same approach used by HARP core development (
harp/commandline/utils/manager.py)
Testing Scenarios
- Config-only project: Create project with
create_application=false,create_config=true.make devwatches onlyconfig.yml - App project: Create project with
create_application=true.make devwatches the app directory - Full project: Both config and app enabled, both are watched
- File change detection: Modify a
.pyfile orconfig.yml, server should restart automatically