splent_feature_redis
Redis infrastructure for SPLENT products (config archetype). It brings a
Redis 7.4 container and puts in the app's configuration how to reach it, so
other features can use Redis without knowing where it runs or what its
password is. Sessions are a separate feature, splent_feature_session_redis,
which requires this one.
What it provides
In app.config:
| Key | Value |
|---|---|
REDIS_URL |
The server, with REDIS_PASSWORD in it when one is set. |
REDIS_SESSION_URL |
The same server on the sessions database, REDIS_SESSION_DB. |
REDIS_TASKS_URL |
The same server on the tasks database, REDIS_TASKS_DB. |
REDIS_CACHE_URL |
The same server on the cache database, REDIS_CACHE_DB. |
REDIS_SESSION_DB, REDIS_TASKS_DB, REDIS_CACHE_DB |
The database numbers. |
A feature that keeps something in Redis reads the URL for its use and hands
it to redis.from_url. Each use has a logical database of its own: a cache
may be flushed whenever it is in the way, queued tasks may not, and neither
may take the sessions with it.
Docker, one redis:7.4 service named splent_feature_redis with its data
in the redis_data volume:
docker/docker-compose.dev.ymlpublishes port 6379 on the host asREDIS_HOST_PORT, and runs without a password unlessREDIS_PASSWORDsets one, like the rest of the development stack.docker/docker-compose.prod.ymlpublishes no port, so only the product's own containers reach Redis, and always runs withrequirepass. It refuses to start untilREDIS_PASSWORDis set.
Configuration
| Env var | Default | Purpose |
|---|---|---|
REDIS_URL |
redis://localhost:6379 |
Where the server is. The Docker .env sets redis://splent_feature_redis:6379 for container-to-container access. Leave the password out of it. |
REDIS_PASSWORD |
empty | Password of the server. Empty in development (docker/.env.example); <SET> in production (docker/.env.prod.example), so product:deploy generates one and docker compose up refuses to start without it. The server and the app read this same variable. |
REDIS_SESSION_DB |
0 |
Logical database of the sessions. |
REDIS_TASKS_DB |
1 |
Logical database of background tasks and their queue. |
REDIS_CACHE_DB |
2 |
Logical database of caches, which may be flushed at any time. |
REDIS_HOST_PORT |
6380 |
Host port published in development only. Gets the product's port offset. |
Credentials written into REDIS_URL (rediss://user:password@host:6380) win
over REDIS_PASSWORD. That is how a product points at a Redis it does not
run, such as a managed one with a user of its own. A database in the URL is
replaced by the one each use is configured with.
The database settings are declared in [tool.splent.config], so a product
changes them there. A value that is not a database number, or one that two
uses share, stops the app at start-up rather than quietly putting two uses
in one database. A number the server does not have fails at the first
connection instead, since only the server knows how many it has: the
feature's own has 16, from 0 to 15.
Upgrading from 1.5
- A production deployment needs
REDIS_PASSWORD.product:deployasks for it and offers a random one; on a host without the CLI, set it indeploy/.envbeforedocker compose up. - Redis is no longer published on the host in production. Anything that
reached it through
REDIS_HOST_PORThas to run inside the product's network now. - The data moves to the
redis_datavolume, which survivesdocker compose down. The first start of this version begins with it empty, so everyone signs in once more. REDIS_WORKER_TIMEOUTis gone. Nothing read it.
Use it in a product
splent feature:add splent_feature_redis
Tests
splent feature:test splent_feature_redis
The unit tests build the URLs against a bare Flask app and parse them with redis-py, which opens no connection, so no server is needed.
Metadata
Release files for splent-feature-redis 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| splent_feature_redis-1.6.0.tar.gz | 19.9 kB | Without provenance | Details for splent_feature_redis-1.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| splent_feature_redis-1.6.0-py3-none-any.whl | Python 3 | none | any | Details for splent_feature_redis-1.6.0-py3-none-any.whl |
Total release size: 40.4 kB
Release files / splent_feature_redis-1.6.0.tar.gz
| Download URL | splent_feature_redis-1.6.0.tar.gz |
|---|---|
| Size | 19.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72a4ff3b5be8105e4ae2b7c39a935a517d60dff0122477bcc708fce55e385a1e
|
|
BLAKE2b-256 checksum How to use checksums |
7cde1f02a64054761a50ba7d8096ca884a65ad1ff51f885f8fcbef2e4a9d62de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.16
|
Release files / splent_feature_redis-1.6.0-py3-none-any.whl
| Download URL | splent_feature_redis-1.6.0-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7d8a4c79325a98a67e764fae839ea845e4934a518218cff1f0f175f21ad0ee3
|
|
BLAKE2b-256 checksum How to use checksums |
f2e13b29e1e710d3f45104dfd30b7aa3b8b2927ff086f82389a6ba50df7008f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.16
|
Security for splent-feature-redis 1.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.