bowser/pyproject.toml
Benedikt Willi fab66d1528 Implement Jinja2 templates for startpage and error pages
Features:
- Add Jinja2 template engine for page rendering
- Create startpage with Bowser branding and version info
- Create error page templates for 404, 500, and network errors
- Support for about:startpage special URL
- Custom error message support in templates
- Graceful fallback rendering if template fails
- Browser now starts with startpage when no URL provided

Templates:
- assets/pages/startpage.html - Beautiful purple gradient intro page
- assets/pages/error_404.html - Pink gradient 404 error page
- assets/pages/error_500.html - Red gradient 500 error page
- assets/pages/error_network.html - Orange gradient network error page

Code:
- src/templates.py - Template rendering utilities with Jinja2
- Updated main.py to use startpage as default
- Updated Frame.load() to handle about: URLs and render errors with templates
- Added 7 comprehensive template tests

All 62 core tests passing (excluding GTK-dependent tests)
2026-01-09 14:24:01 +01:00

76 lines
1.5 KiB
TOML

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "bowser"
version = "0.0.1"
description = "Educational web browser from scratch"
readme = "README.md"
requires-python = ">=3.11"
license = {text = "MIT"}
authors = [{name = "Bowser", email = "bowser@example.com"}]
dependencies = [
"PyGObject>=3.54.0", # GTK+ bindings for Python
"skia-python>=87.9", # Skia 2D graphics library
"Jinja2>=3.0", # Template engine for pages
]
[project.optional-dependencies]
dev = [
"pytest>=9.0.0",
"pytest-cov>=7.0.0",
"black>=25.0",
"ruff>=0.9.0",
"mypy>=1.9.0",
]
[project.scripts]
bowser = "main:main"
[tool.uv]
managed = true
[tool.hatch.build.targets.wheel]
packages = ["src"]
[tool.black]
line-length = 100
target-version = ["py311"]
[tool.ruff]
line-length = 100
target-version = "py311"
select = ["E", "F", "W"]
[tool.mypy]
python_version = "3.11"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = false
[tool.pytest.ini_options]
testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
addopts = [
"-ra",
"--strict-markers",
"--strict-config",
"--showlocals",
]
[tool.coverage.run]
source = ["src"]
omit = ["tests/*", "*/conftest.py"]
[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise AssertionError",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]