This guide provides tips for extending Glimpser, running tests, and contributing to the project.
- Clone the repository and create a virtual environment:
ruff check --exit-zero . git clone https://github.com/KristopherKubicki/glimpser.git cd glimpser python -m venv env source env/bin/activate
- Install Python dependencies:
Browser automation packages used for screenshots are optional and configured in
pip install .[dev]
pyproject.toml. A minimal install only requireswkhtmltoimagefor lightweight captures. - Set up tooling:
After installation, verify hooks:
make setup # installs pre-commit hooks and JS packagespre-commit run --all-files
- Copy the provided example environment file and update the values. Important
variables include
SECRET_KEYfor session management,CHATGPT_KEYfor AI features, and the various path settings used by the application.cp .env.example .env # edit .env before running the app - Install the Node.js dependencies used for CSS linting:
npm install
Before diving into new features, read Architecture Overview. It describes how Flask routes, background jobs and utility modules cooperate. The "Data Flow from Camera to UI" section maps the path a captured frame takes through the scheduler and database to the web interface.
The project uses pytest for testing and lints Python with ruff and flake8. After activating your environment, run:
ruff check --exit-zero .
flake8
pytest # runs in parallel via pytest-xdistRunning the full test suite helps ensure that your changes do not introduce regressions.
We follow a staged GitHub Flow:
- Fork the repository and create a feature branch from
main. Open a pull request targeting thestagingbranch once the feature is ready. - Make your changes and commit them with clear messages.
- Ensure all tests pass and linting succeeds.
- Open a pull request describing your changes and merge it into
stagingafter review.
For more details, see CONTRIBUTING.md.
- New routes can be added in
app/routes.py. - Utility functions live in
app/utils/. - Configuration defaults are defined in
app/config.py.
When adding new features, include corresponding tests under the tests/ directory.
- Utilities for network testing now have dedicated tests in
tests/test_network_testing_utils.py. - Configuration lookup logic is verified by
tests/test_config_get_setting.py. - Scheduler helpers are tested in
tests/test_scheduling_more.py. - Template update validation ensures numeric fields remain in range and required values are present.
- Forms validate input client-side with JavaScript and fall back to server-side checks.
- URLs in the template form must begin with http:// or https:// and fetch helpers provide consistent error handling.
save_templatenow reschedules APScheduler jobs when a template is edited.