weba¶
Weba is a Python library for building web user interfaces using a declarative, component-based approach. It provides a clean API for creating HTML elements and components with proper context management and type safety. The library extends BeautifulSoup's functionality by adding a custom Tag class that supports modern web development patterns, including HTMX integration, class list manipulation, and comment-based selectors. It allows developers to create reusable UI components with proper isolation, supports both synchronous and asynchronous contexts, and handles attribute management (including JSON serialization) elegantly. The library emphasizes type safety and follows clean code practices, making it particularly suitable for building modern web applications in Python with a focus on maintainability and developer experience.
Configuration¶
The library supports the following environment variables for configuration:
WEBA_LRU_CACHE_SIZE
: Controls the maximum size of the LRU cache used for storing parsed HTML templates and file contents. Defaults to 128. Example:
- Github repository: https://github.com/cj/weba/
- Documentation https://weba.cj.io/