You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

textual-timepiece

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

textual-timepiece

Various time related widgets & functionality for Textual.

0.5.1
pipPyPI
Maintainers
1

PyPI - Version PyPI - Python Version GitHub Actions Workflow Status codecov

Textual Timepiece

Various time management related widgets for the Textual framework.

Documentation | Changelog | PyPi

Included Widgets
PickersDescription
DatePickerA visual date picker with an input and overlay.
DurationPickerVisual duration picker with duration up to 99 hours.
TimePickerVisual time picker for setting a time in a 24 hour clock.
DateTimePickerDatetime picker that combines a date and time.
DateRangePickerDate range picker for picking an interval between two dates.
DateTimeRangePickerRange picker for picking an interval between two times.
DateTimeDurationPickerPick an interval between two times, including a duration input.
Activity HeatmapDescription
ActivityHeatmapActivity Heatmap for displaying yearly data similar to the GitHub contribution graph.
HeatmapManagerWidget for browsing the Activity Heatmap with yearly navigation builtin.
TimelineDescription
HorizontalEntryHorizontal entry for a horizontal timeline layout.
HorizontalRulerHorizontal ruler for marking horizontal timelines.
HorizontalTimelineBasic timeline widget that displays entries in a horizontal view.
HorizontalTimelineNavigationHorizontal widget containing a horizontal timeline and header.
RuledHorizontalTimelineRuled horizontal timeline with markers.
RuledVerticalTimelineRuled vertical timeline with markers.
VerticalEntryVertical entry for a vertical timeline layout.
VerticalRulerVertical ruler for marking vertical timelines.
VerticalTimelineBasic timeline widget that displays entries in a vertical view.
VerticalTimelineNavigationVertical widget containing a vertical timeline and header.
SelectorDescription
DateSelectDate selection widget with calendar panes.
TimeSelectTime selection widget with various times in 30 minute intervals.
DurationSelectDuration selection widget with modifiers for adjust time or duration.
InputDescription
DateInputDate input which takes in a iso-format date.
TimeInputTime input that takes in 24 hour clocked in a HH:MM:SS format.
DurationInputDuration input with a duration up to 99 hours.
DateTimeInputAn input with a combination of a date and time in iso-format.

Demo

UVX

uvx textual-timepiece

PIPX

pipx run textual-timepiece

Install

Pip

pip install textual-timepiece

UV

uv add textual-timepiece

Poetry

poetry add textual-timepiece

[!NOTE] Requires whenever as an additional dependency.

Quick Start

DatePicker

Code
from textual.app import App, ComposeResult
from textual_timepiece.pickers import DatePicker
from whenever import Date

class DatePickerApp(App[None]):
    def compose(self) -> ComposeResult:
        yield DatePicker(Date(2025, 3, 4))

if __name__ == "__main__":
    DatePickerApp().run()
Result

DateTimePicker Example

DateTimePicker

Code
from textual.app import App, ComposeResult
from textual_timepiece.pickers import DateTimePicker
from whenever import SystemDateTime

class DateTimePickerApp(App[None]):
    def compose(self) -> ComposeResult:
        yield DateTimePicker(SystemDateTime(2025, 3, 4, 9, 42, 47)))

if __name__ == "__main__":
    DateTimePickerApp().run()
Result

DatePicker Example

ActivityHeatmap

Code
import random
from collections import defaultdict

from textual.app import App, ComposeResult
from textual_timepiece.activity_heatmap import ActivityHeatmap, HeatmapManager


class ActivityApp(App[None]):
    def _on_heatmap_manager_year_changed(
        self,
        message: HeatmapManager.YearChanged,
    ) -> None:
        message.stop()
        self.set_heatmap_data(message.year)

    def retrieve_data(self, year: int) -> ActivityHeatmap.ActivityData:
        """Placeholder example on how the data could be generated."""
        random.seed(year)
        template = ActivityHeatmap.generate_empty_activity(year)
        return defaultdict(
            lambda: 0,
            {
                day: random.randint(6000, 20000)
                for week in template
                for day in week
                if day
            },
        )

    def set_heatmap_data(self, year: int) -> None:
        """Sets the data based on the current data."""
        self.query_one(ActivityHeatmap).values = self.retrieve_data(year)

    def _on_mount(self) -> None:
        self.set_heatmap_data(2025)

    def compose(self) -> ComposeResult:
        yield HeatmapManager(2025)


if __name__ == "__main__":
    ActivityApp().run()
Result

ActivityHeatmap Example

  • More examples can be found here

License

MIT. Check LICENSE for more information.

Keywords

activity

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts