Skip to main content

Terminal client for Redis with auto-completion and syntax highlighting.

Project description

Interactive Redis: A Cli for Redis with AutoCompletion and Syntax Highlighting.

Github Action PyPI version Python version Chat on telegram Open in Cloud Shell

demo

IRedis is a terminal client for redis with auto-completion and syntax highlighting. IRedis lets you type Redis commands smoothly, and displays results in a user-friendly format.

IRedis is an alternative for redis-cli. In most cases, IRedis behaves exactly the same as redis-cli. Besides, it is safer to use IRedis on production servers than redis-cli: IRedis will prevent accidentally running dangerous commands, like KEYS * (see Redis docs / Latency generated by slow commands).

Features

  • Advanced code completion. If you run command KEYS then run DEL, IRedis will auto-complete your command based on KEYS result.
  • Command validation. E.g. try CLUSTER MEET IP PORT, iredis will validate IP and PORT for you.
  • Command highlighting, fully based on redis grammar. Any valid command in IRedis shell is a valid redis command.
  • Human-friendly result display.
  • peek command to check the key's type then automatically call get/lrange/sscan, etc, depending on types. You don't need to call the type command then type another command to get the value. peek will also display the key's length and memory usage.
  • Ctrl + C to cancel the current typed command, this won't exit iredis, exactly like bash behaviour. Use Ctrl + D to send a EOF to exit iredis.
  • Says "Goodbye!" to you when you exit!
  • Ctrl + R to open reverse-i-search to search through your command history.
  • Auto suggestions. (Like fish shell.)
  • Support --encode=utf-8, to decode Redis' bytes responses.
  • Command hint on bottom, include command syntax, supported redis version, and time complexity.
  • Offcial docs with built-in HELP command, try HELP SET!
  • Written in pure Python, but IRedis was packaged into a single binary with PyOxidizer, you can use cURL to download and run, it just works, even you don't have a Python interpreter.
  • For full features, please see: iredis.io/show

Install

Install via pip:

pip install iredis

pipx is recommended:

pipx install iredis

Or you can download the executable binary with cURL(or wget), untar, then run. It is especially useful when you don't have a python interpreter(E.g. the official docker image of redis doesn't have python):

wget  https://github.com/laixintao/iredis/releases/latest/download/iredis.tar.gz \
 && tar -xzf iredis.tar.gz \
 && ./iredis

(Check the release page if you want to download an old version of IRedis.)

Usage

Once you install IRedis, you will know how to use it. Just remember, IRedis supports similar options like redis-cli, like -h for redis-server's host and -p for port.

$ iredis --help

Configuration

IRedis supports config files. Command-line options will always take precedence over config. Configuration resolution from highest to lowest precedence is:

  • Options from command line
  • $PWD/.iredisrc
  • ~/.iredisrc (this path can be changed with iredis --iredisrc $YOUR_PATH)
  • /etc/iredisrc
  • default config in IRedis package.

You can copy the self-explained default config here:

https://raw.githubusercontent.com/laixintao/iredis/master/iredis/data/iredisrc

And then make your own changes.

(If you are using an old verions of iredis, please use the config file below, and change the version in url):

https://raw.githubusercontent.com/laixintao/iredis/v1.0.4/iredis/data/iredisrc

Keys

IRedis support unix/readline-style REPL keyboard shortcuts, which means keys like Ctrl + F to forward work.

Also:

  • Ctrl + F (i.e. EOF) to exit; you can also use the exit command.
  • Ctrl + L to clear screen; you can also use the clear command.
  • Ctrl + X Ctrl + E to open an editor to edit command, or V in vi-mode.

Development

Release Strategy

IRedis is built and released by CircleCI. Whenever a tag is pushed to the master branch, a new release is built and uploaded to pypi.org, it's very convenient.

Thus, we release as often as possible, so that users can always enjoy the new features and bugfixes quickly. Any bugfix or new feature will get at least a patch release, whereas big features will get a minor release.

Setup Environment

IRedis favors poetry as package management tool. To setup a develop enviroment on your computer:

First, install poetry (you can do it in a python's virtualenv):

pip install poetry

Then run (which is similar to pip install -e .):

poetry install

Be careful running testcases locally, it may flush you db!!!

Development Logs

This is a command-line tool, so we don't write logs to stdout.

You can tail -f ~/.iredis.log to see logs, the log is pretty clear, you can see what actually happens from log files.

CI

We use pexpect to test command-line behavior. And since there are problems with CircleCI's tty, we run pexpect-related tests on travis, and run unittest/black style check/flake8 check on CircleCI.

For local development, just run pytest. If all tests pass locally, CI shall pass.

Command Reference

There is a full Redis command list in commands.csv file, downloaded by:

python scripts/download_redis_commands.py > data/commands.csv

commands.csv is here only for test if redis.io was updated, do not package it into release.

Current implemented commands: command_syntax.csv.

Related Projects

If you like iredis, you may also like other cli tools by dbcli:

  • pgcli - Postgres Client with Auto-completion and Syntax Highlighting
  • mycli - MySQL/MariaDB/Percona Client with Auto-completion and Syntax Highlighting
  • litecli - SQLite Client with Auto-completion and Syntax Highlighting
  • mssql-cli - Microsoft SQL Server Client with Auto-completion and Syntax Highlighting
  • athenacli - AWS Athena Client with Auto-completion and Syntax Highlighting
  • vcli - VerticaDB client
  • iredis - Client for Redis with AutoCompletion and Syntax Highlighting

IRedis is build on the top of prompt_toolkit, a Python library (by Jonathan Slenders) for building rich commandline applications.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iredis-1.1.1.tar.gz (178.8 kB view details)

Uploaded Source

Built Distribution

iredis-1.1.1-py3-none-any.whl (258.8 kB view details)

Uploaded Python 3

File details

Details for the file iredis-1.1.1.tar.gz.

File metadata

  • Download URL: iredis-1.1.1.tar.gz
  • Upload date:
  • Size: 178.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.7.6 Linux/4.15.0-1069-azure

File hashes

Hashes for iredis-1.1.1.tar.gz
Algorithm Hash digest
SHA256 3c28280807fd7e5ab4775891467813a02f44b82ca290adf6ae77dea5cad8d11e
MD5 9d6f31e50c968751e3ba102d1c6f5f2f
BLAKE2b-256 31e308068ff6e2de49806456a7eecf64df6aeaf5b994a0bdf84b4f6cdfc85376

See more details on using hashes here.

File details

Details for the file iredis-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: iredis-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 258.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.3 CPython/3.7.6 Linux/4.15.0-1069-azure

File hashes

Hashes for iredis-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ccf2d6f2a884cae38dcc852e03faa0a07ad7b3a64d0d7cff90cb7c4a29e44479
MD5 0eaa8ecc3728d7a7a374f918f72dc219
BLAKE2b-256 4a29fce6988dcbe7f22537877f1bee644852379dc594e5cbc7c548a1b3f81abf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page