devboard
¤
Devboard package.
A development dashboard for your projects.
Classes:
-
Checkbox–A checkbox, added to rows to make them selectable.
-
Column–A Devboard column.
-
DataTable–A Devboard data table.
-
Devboard–The Devboard application.
-
Modal–A modal screen.
-
ModalMixin–Mixin class to add a modal method.
-
NotifyMixin–Mixin class to add notify methods.
-
Project–A class representing development projects.
-
Row–A Devboard row.
-
SelectableRow–A selectable row.
-
SelectableRowsDataTable–Data table with selectable rows.
-
Status–Git status data.
Functions:
-
get_parser–Return the CLI argument parser.
-
main–Run the main program.
Checkbox
dataclass
¤
Checkbox(checked: bool = False)
A checkbox, added to rows to make them selectable.
Methods:
Attributes:
check
¤
check() -> None
Uncheck the checkbox.
Source code in src/devboard/_internal/datatable.py
48 49 50 | |
toggle
¤
toggle() -> bool
Toggle the checkbox.
Source code in src/devboard/_internal/datatable.py
56 57 58 59 | |
uncheck
¤
uncheck() -> None
Uncheck the checkbox.
Source code in src/devboard/_internal/datatable.py
52 53 54 | |
Column
¤
Bases: Container, ModalMixin, NotifyMixin
A Devboard column.
Methods:
-
action_apply–Apply an action to selected rows.
-
apply–Apply action on given row.
-
compose–Compose column widgets.
-
list_projects–List projects for this column.
-
modal–Push a modal.
-
notify_error–Notify error.
-
notify_info–Notify information.
-
notify_success–Notify success.
-
notify_warning–Notify warning.
-
populate_rows–Populate rows for this column.
-
update–Update the column (ask the app to recompute its data).
Attributes:
-
DEFAULT_CLASSES–Textual CSS classes.
-
HEADERS(tuple[str, ...]) –The data table headers.
-
THREADED(bool) –Whether actions of this column should run in the background.
-
TITLE(str) –The title of the column.
-
app(App) –Textual application.
-
table(DataTable) –Data table.
THREADED
class-attribute
instance-attribute
¤
THREADED: bool = True
Whether actions of this column should run in the background.
action_apply
¤
action_apply(action: str = 'default') -> None
Apply an action to selected rows.
Source code in src/devboard/_internal/board.py
80 81 82 83 84 85 86 87 88 89 90 | |
apply
¤
Apply action on given row.
Source code in src/devboard/_internal/board.py
156 157 158 | |
compose
¤
compose() -> ComposeResult
Compose column widgets.
Source code in src/devboard/_internal/board.py
72 73 74 75 | |
list_projects
¤
List projects for this column.
Source code in src/devboard/_internal/board.py
147 148 149 | |
modal
¤
modal(text: str) -> None
Push a modal.
Source code in src/devboard/_internal/modal.py
68 69 70 | |
notify_error
¤
Notify error.
Source code in src/devboard/_internal/notifications.py
40 41 42 | |
notify_info
¤
Notify information.
Source code in src/devboard/_internal/notifications.py
28 29 30 | |
notify_success
¤
Notify success.
Source code in src/devboard/_internal/notifications.py
32 33 34 | |
notify_warning
¤
Notify warning.
Source code in src/devboard/_internal/notifications.py
36 37 38 | |
populate_rows
staticmethod
¤
Populate rows for this column.
Source code in src/devboard/_internal/board.py
151 152 153 154 | |
update
¤
update() -> None
Update the column (ask the app to recompute its data).
Source code in src/devboard/_internal/board.py
100 101 102 103 104 | |
DataTable
¤
Bases: SelectableRowsDataTable
A Devboard data table.
Methods:
-
action_reverse_select–Reverse selection.
-
action_toggle_select_all–Toggle-select all rows.
-
action_toggle_select_down–Toggle selection down.
-
action_toggle_select_row–Toggle-select current row.
-
action_toggle_select_up–Toggle selection up.
-
add_rows–Add rows.
-
clear–Clear rows and optionally columns.
-
force_refresh–Force refresh table.
Attributes:
-
BINDINGS(ClassVar) –Key bindings for selecting rows.
-
ROW–The class to instantiate rows.
-
current_row(SelectableRow) –Currently selected row.
-
selectable_rows(Iterator[SelectableRow]) –Rows, as selectable ones.
-
selected_rows(Iterator[SelectableRow]) –Selected rows.
BINDINGS
class-attribute
instance-attribute
¤
BINDINGS: ClassVar = [
Binding(
"space",
"toggle_select_row",
"Toggle select",
show=False,
),
Binding(
"ctrl+a, *",
"toggle_select_all",
"Toggle select all",
show=False,
),
Binding(
"exclamation_mark",
"reverse_select",
"Reverse select",
show=False,
),
Binding(
"shift+up",
"toggle_select_up",
"Expand select up",
show=False,
),
Binding(
"shift+down",
"toggle_select_down",
"Expand select down",
show=False,
),
]
Key bindings for selecting rows.
action_reverse_select
¤
action_reverse_select() -> None
Reverse selection.
Source code in src/devboard/_internal/datatable.py
189 190 191 192 193 | |
action_toggle_select_all
¤
action_toggle_select_all() -> None
Toggle-select all rows.
Source code in src/devboard/_internal/datatable.py
178 179 180 181 182 183 184 185 186 187 | |
action_toggle_select_down
¤
action_toggle_select_down() -> None
Toggle selection down.
Source code in src/devboard/_internal/datatable.py
207 208 209 210 211 212 213 214 215 216 217 | |
action_toggle_select_row
¤
action_toggle_select_row() -> None
Toggle-select current row.
Source code in src/devboard/_internal/datatable.py
169 170 171 172 173 174 175 176 | |
action_toggle_select_up
¤
action_toggle_select_up() -> None
Toggle selection up.
Source code in src/devboard/_internal/datatable.py
195 196 197 198 199 200 201 202 203 204 205 | |
add_rows
¤
Add rows.
Automatically insert a column with checkboxes in position 0.
Source code in src/devboard/_internal/datatable.py
149 150 151 152 153 154 | |
clear
¤
clear(columns: bool = True) -> SelectableRowsDataTable
Clear rows and optionally columns.
When clearing columns, automatically re-add a column for checkboxes.
Source code in src/devboard/_internal/datatable.py
156 157 158 159 160 161 162 163 164 | |
force_refresh
¤
force_refresh() -> None
Force refresh table.
Source code in src/devboard/_internal/datatable.py
222 223 224 225 226 227 | |
Devboard
¤
Devboard(
*args: Any,
board: str | Path | None = None,
background_tasks: bool = True,
workers: int | None = None,
**kwargs: Any,
)
Bases: App, ModalMixin
The Devboard application.
Parameters:
-
(board¤str | Path | None, default:None) –The board to display (name or file path).
-
(background_tasks¤bool, default:True) –Whether to fetch repositories in the background after the initial scan. Disabling this also disables the on-disk cache (useful for tests and screenshots).
-
(workers¤int | None, default:None) –How many projects to scan concurrently. Overrides the
workersconfig setting.
Methods:
-
action_exit–Exit application.
-
action_refresh–Refresh all columns.
-
action_show_help–Show help.
-
compose–Compose the layout.
-
fetch_all–Run
git fetchin all projects, in background. -
modal–Push a modal.
-
on_mount–Populate columns, then run background tasks.
-
scan–Recompute columns data in the background.
Attributes:
-
BINDINGS(ClassVar) –Application key bindings.
-
CSS_PATH–Path to the CSS file.
-
app(App) –Textual application.
Source code in src/devboard/_internal/app.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
BINDINGS
class-attribute
instance-attribute
¤
BINDINGS: ClassVar = [
Binding("F5, ctrl+r", "refresh", "Refresh"),
Binding("question_mark", "show_help", "Help"),
Binding(
"ctrl+q, q, escape", "exit", "Exit", key_display="Q"
),
]
Application key bindings.
CSS_PATH
class-attribute
instance-attribute
¤
CSS_PATH = Path(__file__).parent / 'devboard.tcss'
Path to the CSS file.
action_exit
¤
action_exit() -> None
Exit application.
Source code in src/devboard/_internal/app.py
133 134 135 136 | |
action_refresh
¤
action_refresh() -> None
Refresh all columns.
Source code in src/devboard/_internal/app.py
129 130 131 | |
action_show_help
¤
action_show_help() -> None
Show help.
Source code in src/devboard/_internal/app.py
119 120 121 122 123 124 125 126 127 | |
compose
¤
compose() -> ComposeResult
Compose the layout.
Source code in src/devboard/_internal/app.py
103 104 105 106 107 108 109 110 | |
fetch_all
¤
fetch_all() -> None
Run git fetch in all projects, in background.
Source code in src/devboard/_internal/app.py
160 161 162 163 164 165 166 | |
modal
¤
modal(text: str) -> None
Push a modal.
Source code in src/devboard/_internal/modal.py
68 69 70 | |
on_mount
¤
on_mount() -> None
Populate columns, then run background tasks.
Source code in src/devboard/_internal/app.py
112 113 114 | |
scan
¤
Recompute columns data in the background.
A single scan feeds all columns: each project is read once, by a small pool of threads, and the resulting rows are dispatched to every column as they arrive.
Parameters:
-
(columns¤Iterable[Column] | None, default:None) –The columns to update (all of them by default).
-
(initial¤bool, default:False) –Whether this is the initial scan at startup, which additionally displays cached data, saves fresh data to the cache, and triggers the background fetch when these features are enabled.
Source code in src/devboard/_internal/app.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
Modal
¤
Bases: ModalScreen
A modal screen.
Methods:
Attributes:
-
text–Text content.
Source code in src/devboard/_internal/modal.py
36 37 38 39 40 41 42 43 | |
compose
¤
compose() -> ComposeResult
Screen composition.
Source code in src/devboard/_internal/modal.py
45 46 47 | |
on_key
¤
on_key(event: Key) -> None
Dismiss on any unbound key.
Source code in src/devboard/_internal/modal.py
49 50 51 52 53 54 55 56 57 58 59 | |
NotifyMixin
¤
Mixin class to add notify methods.
Methods:
-
notify_error–Notify error.
-
notify_info–Notify information.
-
notify_success–Notify success.
-
notify_warning–Notify warning.
Attributes:
notify_error
¤
Notify error.
Source code in src/devboard/_internal/notifications.py
40 41 42 | |
notify_info
¤
Notify information.
Source code in src/devboard/_internal/notifications.py
28 29 30 | |
notify_success
¤
Notify success.
Source code in src/devboard/_internal/notifications.py
32 33 34 | |
notify_warning
¤
Notify warning.
Source code in src/devboard/_internal/notifications.py
36 37 38 | |
Project
¤
Project(path: Path)
A class representing development projects.
It is instantiated with a path, and then provides many utility properties and methods.
Methods:
-
__lt__–Ordering is based on the project name.
-
checkout–Checkout branch, restore previous one when exiting.
-
delete–Delete branch.
-
fetch–Fetch.
-
lock–Lock project.
-
pull–Pull branch.
-
push–Push branch.
-
unlock–Unlock project.
-
unpulled–Number of unpulled commits (compared to the branch upstream), per branch.
-
unpushed–Number of unpushed commits (compared to the branch upstream), per branch.
-
unreleased–List unreleased commits (commits since the latest tag reachable from the branch).
Attributes:
-
DEFAULT_BRANCHES(tuple[str, ...]) –Name of common default branches. Mainly useful to compute unreleased commits.
-
LOCKS(dict[Project, Lock]) –Locks for projects, to avoid concurrent operations.
-
branch(Head) –Currently checked out branch.
-
default_branch(str) –Default branch (or main branch), as checked out when cloning.
-
is_dirty(bool) –Whether the project is in a "dirty" state (uncommitted modifications).
-
latest_tag(TagReference) –Latest tag (by creation date).
-
name(str) –Name of the project.
-
path(Path) –Path of the project on the file-system.
-
repo(Repo) –GitPython's
Repoobject (cached per instance). -
status(Status) –Status of the project.
-
status_line(str) –Status of the project, as a string.
Source code in src/devboard/_internal/projects.py
67 68 69 | |
DEFAULT_BRANCHES
class-attribute
¤
Name of common default branches. Mainly useful to compute unreleased commits.
LOCKS
class-attribute
¤
LOCKS: dict[Project, Lock] = defaultdict(Lock)
Locks for projects, to avoid concurrent operations.
default_branch
property
¤
default_branch: str
Default branch (or main branch), as checked out when cloning.
is_dirty
property
¤
is_dirty: bool
Whether the project is in a "dirty" state (uncommitted modifications).
latest_tag
property
¤
latest_tag: TagReference
status
property
¤
status: Status
Status of the project.
Computed from a single git status --porcelain call,
which is much cheaper than diffing index and work tree separately.
Each file is counted once, in the first matching category:
untracked, renamed, added, deleted, type-changed, modified.
__lt__
¤
Ordering is based on the project name.
Total ordering is implemented on projects so they can be sorted in the application tables.
Source code in src/devboard/_internal/projects.py
74 75 76 77 78 79 80 81 | |
checkout
¤
Checkout branch, restore previous one when exiting.
Source code in src/devboard/_internal/projects.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | |
delete
¤
delete(branch: str) -> None
Delete branch.
Source code in src/devboard/_internal/projects.py
222 223 224 | |
fetch
¤
fetch() -> None
Fetch.
Source code in src/devboard/_internal/projects.py
244 245 246 247 248 249 | |
lock
¤
lock() -> bool
Lock project.
Source code in src/devboard/_internal/projects.py
263 264 265 | |
pull
¤
pull(branch: str | None = None) -> None
Pull branch.
Source code in src/devboard/_internal/projects.py
212 213 214 215 | |
push
¤
push(branch: str | None = None) -> None
Push branch.
Source code in src/devboard/_internal/projects.py
217 218 219 220 | |
unlock
¤
unlock() -> None
Unlock project.
Source code in src/devboard/_internal/projects.py
267 268 269 | |
unpulled
¤
Number of unpulled commits (compared to the branch upstream), per branch.
Source code in src/devboard/_internal/projects.py
173 174 175 | |
unpushed
¤
Number of unpushed commits (compared to the branch upstream), per branch.
Source code in src/devboard/_internal/projects.py
169 170 171 | |
unreleased
¤
List unreleased commits (commits since the latest tag reachable from the branch).
Source code in src/devboard/_internal/projects.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
Row
dataclass
¤
Row(table: SelectableRowsDataTable, key: RowKey)
Bases: SelectableRow
A Devboard row.
Methods:
-
remove–Remove row from the table.
-
select–Select this row.
-
toggle_select–Toggle-select this row.
-
unselect–Unselect this row.
Attributes:
-
app(App) –Textual application.
-
checkbox(Checkbox) –Row checkbox.
-
data(list) –Row data (without checkbox).
-
index(int) –Row index.
-
key(RowKey) –The row key.
-
next(SelectableRow) –Next row (down).
-
previous(SelectableRow) –Previous row (up).
-
project(Project) –Devboard project.
-
selected(bool) –Whether this row is selected.
-
table(SelectableRowsDataTable) –The data table containing this row.
remove
¤
remove() -> None
Remove row from the table.
Source code in src/devboard/_internal/datatable.py
112 113 114 | |
select
¤
select() -> None
Select this row.
Source code in src/devboard/_internal/datatable.py
95 96 97 | |
toggle_select
¤
toggle_select() -> bool
Toggle-select this row.
Source code in src/devboard/_internal/datatable.py
103 104 105 | |
unselect
¤
unselect() -> None
Unselect this row.
Source code in src/devboard/_internal/datatable.py
99 100 101 | |
SelectableRow
dataclass
¤
SelectableRow(table: SelectableRowsDataTable, key: RowKey)
A selectable row.
Methods:
-
remove–Remove row from the table.
-
select–Select this row.
-
toggle_select–Toggle-select this row.
-
unselect–Unselect this row.
Attributes:
-
app(App) –Textual application.
-
checkbox(Checkbox) –Row checkbox.
-
data(list) –Row data (without checkbox).
-
index(int) –Row index.
-
key(RowKey) –The row key.
-
next(SelectableRow) –Next row (down).
-
previous(SelectableRow) –Previous row (up).
-
selected(bool) –Whether this row is selected.
-
table(SelectableRowsDataTable) –The data table containing this row.
remove
¤
remove() -> None
Remove row from the table.
Source code in src/devboard/_internal/datatable.py
112 113 114 | |
select
¤
select() -> None
Select this row.
Source code in src/devboard/_internal/datatable.py
95 96 97 | |
toggle_select
¤
toggle_select() -> bool
Toggle-select this row.
Source code in src/devboard/_internal/datatable.py
103 104 105 | |
unselect
¤
unselect() -> None
Unselect this row.
Source code in src/devboard/_internal/datatable.py
99 100 101 | |
SelectableRowsDataTable
¤
Bases: DataTable
Data table with selectable rows.
Methods:
-
action_reverse_select–Reverse selection.
-
action_toggle_select_all–Toggle-select all rows.
-
action_toggle_select_down–Toggle selection down.
-
action_toggle_select_row–Toggle-select current row.
-
action_toggle_select_up–Toggle selection up.
-
add_rows–Add rows.
-
clear–Clear rows and optionally columns.
-
force_refresh–Force refresh table.
Attributes:
-
BINDINGS(ClassVar) –Key bindings for selecting rows.
-
ROW–The class to instantiate selectable rows.
-
current_row(SelectableRow) –Currently selected row.
-
selectable_rows(Iterator[SelectableRow]) –Rows, as selectable ones.
-
selected_rows(Iterator[SelectableRow]) –Selected rows.
BINDINGS
class-attribute
instance-attribute
¤
BINDINGS: ClassVar = [
Binding(
"space",
"toggle_select_row",
"Toggle select",
show=False,
),
Binding(
"ctrl+a, *",
"toggle_select_all",
"Toggle select all",
show=False,
),
Binding(
"exclamation_mark",
"reverse_select",
"Reverse select",
show=False,
),
Binding(
"shift+up",
"toggle_select_up",
"Expand select up",
show=False,
),
Binding(
"shift+down",
"toggle_select_down",
"Expand select down",
show=False,
),
]
Key bindings for selecting rows.
ROW
class-attribute
instance-attribute
¤
ROW = SelectableRow
The class to instantiate selectable rows.
action_reverse_select
¤
action_reverse_select() -> None
Reverse selection.
Source code in src/devboard/_internal/datatable.py
189 190 191 192 193 | |
action_toggle_select_all
¤
action_toggle_select_all() -> None
Toggle-select all rows.
Source code in src/devboard/_internal/datatable.py
178 179 180 181 182 183 184 185 186 187 | |
action_toggle_select_down
¤
action_toggle_select_down() -> None
Toggle selection down.
Source code in src/devboard/_internal/datatable.py
207 208 209 210 211 212 213 214 215 216 217 | |
action_toggle_select_row
¤
action_toggle_select_row() -> None
Toggle-select current row.
Source code in src/devboard/_internal/datatable.py
169 170 171 172 173 174 175 176 | |
action_toggle_select_up
¤
action_toggle_select_up() -> None
Toggle selection up.
Source code in src/devboard/_internal/datatable.py
195 196 197 198 199 200 201 202 203 204 205 | |
add_rows
¤
Add rows.
Automatically insert a column with checkboxes in position 0.
Source code in src/devboard/_internal/datatable.py
149 150 151 152 153 154 | |
clear
¤
clear(columns: bool = True) -> SelectableRowsDataTable
Clear rows and optionally columns.
When clearing columns, automatically re-add a column for checkboxes.
Source code in src/devboard/_internal/datatable.py
156 157 158 159 160 161 162 163 164 | |
force_refresh
¤
force_refresh() -> None
Force refresh table.
Source code in src/devboard/_internal/datatable.py
222 223 224 225 226 227 | |
Status
dataclass
¤
Status(
added: list[Path],
deleted: list[Path],
modified: list[Path],
renamed: list[Path],
typechanged: list[Path],
untracked: list[Path],
)
get_parser
¤
get_parser() -> ArgumentParser
Return the CLI argument parser.
Returns:
-
ArgumentParser–An argparse parser.
Source code in src/devboard/_internal/cli.py
51 52 53 54 55 56 57 58 59 60 61 62 | |
main
¤
Run the main program.
This function is executed when you type devboard or python -m devboard.
Parameters:
Returns:
-
int–An exit code.
Source code in src/devboard/_internal/cli.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |