All Projects → ericdwang → pybart

ericdwang / pybart

Licence: BSD-3-Clause license
Real time BART (Bay Area Rapid Transit) information in your terminal!

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pybart

Pulsemixer
CLI and curses mixer for PulseAudio
Stars: ✭ 441 (+2494.12%)
Mutual labels:  tui, curses
Brick
A declarative Unix terminal UI programming library written in Haskell
Stars: ✭ 1,070 (+6194.12%)
Mutual labels:  tui, curses
Rtv
Browse Reddit from your terminal
Stars: ✭ 4,558 (+26711.76%)
Mutual labels:  tui, curses
croatoan
Common Lisp bindings for the ncurses terminal library.
Stars: ✭ 111 (+552.94%)
Mutual labels:  tui, curses
Tuicss
Text-based user interface CSS library
Stars: ✭ 167 (+882.35%)
Mutual labels:  tui, curses
Termox
C++17 Terminal User Interface(TUI) Library.
Stars: ✭ 306 (+1700%)
Mutual labels:  tui, curses
Ltui
🍖 A cross-platform terminal ui library based on Lua
Stars: ✭ 624 (+3570.59%)
Mutual labels:  tui, curses
Picotui
Lightweight, pure-Python Text User Interface (TUI) widget toolkit with minimal dependencies. Dedicated to the Pycopy project.
Stars: ✭ 547 (+3117.65%)
Mutual labels:  tui, curses
Dte
A small, configurable console text editor (moved to https://gitlab.com/craigbarnes/dte)
Stars: ✭ 98 (+476.47%)
Mutual labels:  tui, curses
Zui
⬢ Zsh User Interface library – CGI+DHTML-like rapid application development with Zsh
Stars: ✭ 95 (+458.82%)
Mutual labels:  tui, curses
AbsTK
The Abstract Toolkit – a widget toolkit for GUI and text-mode applications.
Stars: ✭ 67 (+294.12%)
Mutual labels:  tui, curses
hledger-iadd
A terminal UI as drop-in replacement for hledger add.
Stars: ✭ 61 (+258.82%)
Mutual labels:  tui, curses
cxxcurses
Header only ncurses wrapper
Stars: ✭ 24 (+41.18%)
Mutual labels:  tui, curses
Castero
TUI podcast client for the terminal
Stars: ✭ 375 (+2105.88%)
Mutual labels:  tui, curses
Pacmixer
an alsamixer alike for PulseAudio.
Stars: ✭ 78 (+358.82%)
Mutual labels:  tui, curses
Asciimatics
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
Stars: ✭ 2,869 (+16776.47%)
Mutual labels:  tui, curses
git-tui
Collection of human friendly terminal interface for git.
Stars: ✭ 95 (+458.82%)
Mutual labels:  tui, curses
notcurses-zig-example
Demo showing how to use Notcurses library for building terminal UIs with Zig
Stars: ✭ 32 (+88.24%)
Mutual labels:  tui
dbui
Universal Database CLI for MySQL, PostgreSQL, and SQLite. Terminal User Interface Application.
Stars: ✭ 110 (+547.06%)
Mutual labels:  tui
deltachat-cursed
[WIP] Cursed Delta, a lightweight Delta Chat client for the command line
Stars: ✭ 33 (+94.12%)
Mutual labels:  curses

pybart

Version Python versions Wheel status License

Real time BART (Bay Area Rapid Transit) information in your terminal!

Screenshot

Features

  • Real time estimates and service advisories
  • Curses-based TUI with auto-refreshing and resizing
  • View multiple stations at the same time
  • Colors indicating transit lines, estimate times, and train lengths
  • Ability to configure a default set of stations
  • Other non-TUI commands like opening a map and getting the fare for a trip
  • Includes a low-level Python wrapper for the full BART API
  • No dependencies; built with only standard libraries

Requirements

  • Python 2.6+ or Python 3.0+ with the curses module installed (i.e. not Windows)
  • Terminal with 256 color support to correctly display the Richmond-Fremont line as orange (magenta otherwise)
    • Note: this usually involves setting the TERM environment variable to xterm-256color

Installation

pip install pybart

Usage

usage: bart [-h] [-v] {map,list,est,fare} ...

Display real time BART estimates.

optional arguments:
  -h, --help           show this help message and exit
  -v, --version        show program's version number and exit

commands:
  {map,list,est,fare}
    map                open station map in web browser
    list               show list of stations and their abbreviations
    est                display estimates for specified stations
    fare               show fare for a trip between two stations

examples:
  bart                 get estimates for $BART_STATIONS
  bart map             open station map
  bart list            list all stations
  bart est mcar        get estimates for MacArthur station
  bart est embr cols   get estimates for Embarcadero and Coliseum stations
  bart fare conc sfia  get fare for a trip between Concord and SFO stations

Configuration

The following (optional) environment variables can be used to configure pybart:

  • BART_STATIONS - a comma-separated string (e.g. mcar,embr,cols) specifying the default stations to use when running bart with no arguments.
  • BART_API_KEY - the BART API key to use when fetching information. A public one is used by default, but you can get your own here.

API

Even though it doesn't use everything, pybart includes a low-level Python wrapper for the full BART API with pybart.api.BART. Every call by default returns the root element of the XML response using ElementTree. JSON is also supported but the format is currently in beta.

Example usage:

>>> from pybart.api import BART
>>> bart = BART()  # Uses the public API key by default
>>> root = bart.stn.stninfo('dbrk')
>>> station = root.find('stations').find('station')
>>> print(station.find('address').text + ', ' + station.find('city').text)
2160 Shattuck Avenue, Berkeley
>>> print(bart.version().find('apiVersion').text)
3.10
>>> bart = BART(json_format=True)  # Now with JSON
>>> root = bart.stn.stninfo('dbrk')
>>> station = root['stations']['station']
>>> print(station['address'] + ', ' + station['city'])
2160 Shattuck Avenue, Berkeley

License

BSD 3-Clause

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].