Formalize a Style typing protocol
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 827
- Avg merge
- 9h 45m
- Merged PRs (30d)
- 58
Description
### What is the problem or limitation you are having?
(Created after in-person discussion with @freakboy3742)
Currently, there is no good way to provide a type annotation for the `style` parameter of many `__init__` methods (e.g. Widget). In practice, it usually boils down to `toga.style.Pack`, but other implementations of `travertino.declaration.BaseStyle` or third-party libraries should be allowed.
### Describe the solution you'd like
toga should specify a `typing.Protocol` for styles, which can be satisfied by travertino and other style providers. This protocol can then be used for type annotations as well.
### Describe alternatives you've considered
-
### Additional context
_No response_
Contributor guide
Research direction
The issue concerns style parameters on __init__ methods such as Widget, along with toga.style.Pack and travertino.declaration.BaseStyle. Start by locating those annotations and reviewing the typing.Protocol requirements; done means the protocol supports travertino and third-party styles and is used in the relevant annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100