Skip to content

Commit 881f655

Browse files
authored
DEV: support both redis-py and redisvl in TCEs (#495)
* Support both redis-py and redisvl in the same TCE (part 1) * Support both redis-py and redisvl in the same TCE (part 2)
1 parent ef33846 commit 881f655

File tree

9 files changed

+85
-12
lines changed

9 files changed

+85
-12
lines changed

build/components/example.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
'java': '//',
2020
'go': '//',
2121
'c#': '//',
22+
'redisvl': '#'
2223
}
2324

2425
class Example(object):

config.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ tagManagerId = "GTM-TKZ6J9R"
4545
gitHubRepo = "https://github.com/redis/docs"
4646

4747
# Display and sort order for client examples
48-
clientsExamples = ["Python", "Node.js", "Java", "Go", "C#"]
48+
clientsExamples = ["Python", "Node.js", "Java", "Go", "C#", "RedisVL"]
4949
searchService = "/convai/api/search-service"
5050
ratingsService = "/docusight/api/rate"
5151

@@ -56,6 +56,14 @@ rdi_debezium_server_version = "2.3.0.Final"
5656
rdi_db_types = "cassandra|mysql|oracle|postgresql|sqlserver"
5757
rdi_cli_latest = "latest"
5858

59+
[params.clientsConfig]
60+
"Python"={lang="python", quickstartSlug="python/redis-py"}
61+
"Node.js"={lang="javascript", quickstartSlug="nodejs"}
62+
"Java"={lang="java", quickstartSlug="java/jedis"}
63+
"Go"={lang="go", quickstartSlug="go"}
64+
"C#"={lang="C#", quickstartSlug="dotnet"}
65+
"RedisVL"={lang="python", quickstartSlug="python/redis-vl"}
66+
5967
# Markup
6068
[markup]
6169
[markup.goldmark]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
categories:
3+
- docs
4+
- develop
5+
- stack
6+
- oss
7+
- rs
8+
- rc
9+
- oss
10+
- kubernetes
11+
- clients
12+
hideListLinks: true
13+
description: Connect your application to a Redis database using Python and try an example
14+
linkTitle: Python
15+
title: Connect with Redis Python clients
16+
weight: 4
17+
---
18+
19+
You have two choices of Python clients that you can use with Redis:
20+
21+
- [Redis Python library (redis-py)]({{< relref "/develop/connect/clients/python/redis-py" >}})
22+
- [Redis vector library (RedisVL)]({{< relref "/develop/connect/clients/python/redis-vl" >}})
23+
24+
You can also access Redis with an object-mapping client interface. See
25+
[RedisOM for Python]({{< relref "/integrate/redisom-for-python" >}})
26+
for more information.

content/develop/connect/clients/python.md renamed to content/develop/connect/clients/python/redis-py.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ categories:
1010
- kubernetes
1111
- clients
1212
description: Connect your Python application to a Redis database
13-
linkTitle: Python
14-
title: Python guide
13+
linkTitle: Redis Python library
14+
title: Redis Python library guide
1515
weight: 1
1616
---
1717

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
categories:
3+
- docs
4+
- develop
5+
- stack
6+
- oss
7+
- rs
8+
- rc
9+
- oss
10+
- kubernetes
11+
- clients
12+
description: Connect your Python vector application to a Redis vector database
13+
linkTitle: Redis vector library
14+
title: Redis vector library guide
15+
weight: 1
16+
---
17+
18+
See the [RedisVL Guide]({{< relref "/integrate/redisvl" >}}) for more information.

data/components/index.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"go_redis",
1212
"node_redis",
1313
"redis_py",
14-
"jedis"
14+
"jedis",
15+
"redis_vl"
1516
],
1617
"assets": [],
1718
"_assets": [

data/components/redis_vl.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"id": "redisvl",
3+
"type": "client",
4+
"name": "RedisVL",
5+
"language": "RedisVL",
6+
"repository": {
7+
"git_uri": "https://github.com/redis/redis-vl-python"
8+
},
9+
"examples": {
10+
"git_uri": "https://github.com/redis/redis-vl-python",
11+
"dev_branch": "main",
12+
"path": "doctests",
13+
"pattern": "*.py"
14+
}
15+
}

layouts/partials/tabbed-clients-example.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515
{{ $tabs = $tabs | append (dict "title" "redis-cli" "content" $redisCliContent "limit" $redisCommandsLineLimit) }}
1616
{{ end }}
1717

18-
{{ $languages := index $.Site.Data.examples $id }}
19-
{{ range $language := $.Site.Params.clientsexamples }}
20-
{{ $example := index $languages $language }}
21-
{{ if and ($example) (or (eq $lang "") (eq $lang $language)) }}
18+
{{ $clientExamples := index $.Site.Data.examples $id }}
19+
{{ range $client := $.Site.Params.clientsexamples }}
20+
{{ $example := index $clientExamples $client }}
21+
{{ $clientConfig := index $.Site.Params.clientsconfig $client }}
22+
{{ $language := index $clientConfig "lang" }}
23+
{{ $quickstartSlug := index $clientConfig "quickstartSlug" }}
24+
25+
{{ if and ($example) (or (eq $lang "") (eq $lang $client)) }}
2226
{{ $examplePath := index $example "target" }}
2327
{{ $options := printf "linenos=false" }}
2428

@@ -31,7 +35,7 @@
3135
{{ end }}
3236
{{ $params := dict "language" $language "contentPath" $examplePath "options" $options }}
3337
{{ $content := partial "tabs/source.html" $params }}
34-
{{ $tabs = $tabs | append (dict "title" $language "content" $content "sourceUrl" (index $example "sourceUrl")) }}
38+
{{ $tabs = $tabs | append (dict "title" $client "language" $language "quickstartSlug" $quickstartSlug "content" $content "sourceUrl" (index $example "sourceUrl")) }}
3539
{{ end }}
3640
{{ end }}
3741

layouts/partials/tabs/wrapper.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
{{ range $i, $tab := $tabs }}
1313
{{ $tid := printf "%s_%s" (replace (replace (index $tab "title") "#" "sharp") "." "") $id }}
1414
{{ $pid := printf "panel_%s" $tid }}
15-
{{ $quickStartSlug := (replace (replace (index $tab "title") "." "") "C#" "dotnet" | lower) }}
16-
<input tabindex="1" type="radio" name="{{ $id }}" id="{{ $tid }}" data-lang="{{ $quickStartSlug }}" class="radiotab w-0 h-0"
15+
<input tabindex="1" type="radio" name="{{ $id }}" id="{{ $tid }}" data-lang="{{ index $tab "language" }}" class="radiotab w-0 h-0"
1716
{{ if eq $i 0 }}checked{{ end }}
1817
/>
1918
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900
@@ -72,7 +71,8 @@
7271
</a>
7372
</div>
7473
{{ else }}
75-
<a href='/docs/develop/connect/clients/{{ $quickStartSlug }}/' tabindex="1" class="rounded rounded-mx px-3 py-1 text-white text-xs
74+
<!--<a href='/docs/latest/develop/connect/clients/{{ index $tab "quickstartSlug" }}/' tabindex="1" class="rounded rounded-mx px-3 py-1 text-white text-xs-->
75+
<a href='/develop/connect/clients/{{ index $tab "quickstartSlug" }}/' tabindex="1" class="rounded rounded-mx px-3 py-1 text-white text-xs
7676
hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none
7777
focus:ring-2 focus:white focus:border-slate-500" title="{{$btnQuickStartText}}">
7878
{{ index $tab "title" }} {{ $btnQuickStartText }}

0 commit comments

Comments
 (0)