Skip to content
Back to top
View this page
Edit this page

# valkey-py - Python Client for Valkey

## Getting Started

valkey-py requires a running Valkey server, and Python 3.9+. See the Valkey quickstart for Valkey installation instructions.

valkey-py can be installed using pip via `pip install valkey`.

## Quickly connecting to valkey

There are two quick ways to connect to Valkey.

Assuming you run Valkey on localhost:6379 (the default)

    import valkey
    r = valkey.Valkey()
    r.ping()

Running valkey on foo.bar.com, port 12345

    import valkey
    r = valkey.Valkey(host='foo.bar.com', port=12345)
    r.ping()

Another example with foo.bar.com, port 12345

    import valkey
    r = valkey.from_url('valkey://foo.bar.com:12345')
    r.ping()

After that, you probably want to run valkey commands.

## Valkey Command Functions

- Valkey Commands
  - Core Commands
  - Sentinel Commands
  - Valkey Cluster Commands

## Module Documentation

- Connecting to Valkey
- Clustering
- Exceptions
- Backoff
- Lock
- Retry Helpers
- Lua Scripting in default connections
- Pipelines
- Cluster Mode
- Integrating OpenTelemetry
- RESP 3 Features
- Advanced Features
- Examples

## Contributing

- How to contribute

- Issue Tracker

- Source Code

- Release History

- Valkey Slack

## License

This project is licensed under the MIT license.