Skip to content

Commit 6898eae

Browse files
committed
Merge branch 'main' into DOC-5330
2 parents a49370d + d95e995 commit 6898eae

File tree

290 files changed

+35546
-740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

290 files changed

+35546
-740
lines changed

assets/css/index.css

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,100 @@ a[href*="#no-click"], img[src*="#no-click"] {
15311531
@apply bg-redis-pen-200 font-semibold;
15321532
}
15331533

1534+
/* Deprecated Command Styles */
1535+
.deprecated-badge {
1536+
display: inline-flex !important;
1537+
align-items: center !important;
1538+
padding: 0.25rem 0.5rem !important;
1539+
font-size: 0.75rem !important;
1540+
font-weight: 700 !important;
1541+
background-color: rgb(220, 255, 30) !important;
1542+
color: #000000 !important;
1543+
border-radius: 9999px !important;
1544+
border: none !important;
1545+
flex-shrink: 0 !important;
1546+
}
1547+
1548+
.deprecated-tooltip {
1549+
position: absolute !important;
1550+
z-index: 9999 !important;
1551+
padding: 0.5rem 0.75rem !important;
1552+
font-size: 0.875rem !important;
1553+
font-weight: 500 !important;
1554+
color: white !important;
1555+
background-color: #111827 !important;
1556+
border-radius: 0.5rem !important;
1557+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
1558+
opacity: 0 !important;
1559+
visibility: hidden !important;
1560+
transition: opacity 300ms ease-in-out !important;
1561+
pointer-events: none !important;
1562+
white-space: nowrap !important;
1563+
bottom: calc(100% + 8px) !important;
1564+
left: 50% !important;
1565+
transform: translateX(-50%) !important;
1566+
max-width: 250px !important;
1567+
white-space: normal !important;
1568+
word-wrap: break-word !important;
1569+
}
1570+
1571+
/* Adjust tooltip position when near right edge */
1572+
.deprecated-tooltip-trigger:nth-last-child(-n+2) .deprecated-tooltip,
1573+
.deprecated-tooltip-trigger:last-child .deprecated-tooltip {
1574+
left: auto !important;
1575+
right: 0 !important;
1576+
transform: none !important;
1577+
}
1578+
1579+
/* Adjust tooltip position when near left edge */
1580+
.deprecated-tooltip-trigger:nth-child(-n+2) .deprecated-tooltip,
1581+
.deprecated-tooltip-trigger:first-child .deprecated-tooltip {
1582+
left: 0 !important;
1583+
right: auto !important;
1584+
transform: none !important;
1585+
}
1586+
1587+
.deprecated-tooltip::before {
1588+
content: '' !important;
1589+
position: absolute !important;
1590+
top: 100% !important;
1591+
left: 50% !important;
1592+
transform: translateX(-50%) !important;
1593+
width: 0 !important;
1594+
height: 0 !important;
1595+
border-left: 5px solid transparent !important;
1596+
border-right: 5px solid transparent !important;
1597+
border-top: 5px solid #111827 !important;
1598+
}
1599+
1600+
.deprecated-tooltip-trigger {
1601+
position: relative !important;
1602+
display: inline-flex !important;
1603+
z-index: 10 !important;
1604+
}
1605+
1606+
.deprecated-tooltip-trigger:hover .deprecated-tooltip {
1607+
opacity: 1 !important;
1608+
visibility: visible !important;
1609+
}
1610+
1611+
.command-title-deprecated {
1612+
display: flex !important;
1613+
align-items: center !important;
1614+
gap: 0.5rem !important;
1615+
flex-wrap: nowrap !important;
1616+
}
1617+
1618+
.command-title-deprecated .truncate {
1619+
flex: 1 1 0% !important;
1620+
min-width: 0 !important;
1621+
}
1622+
1623+
/* Fix alignment on individual command pages */
1624+
.prose h1.command-name .command-title-deprecated {
1625+
align-items: center !important;
1626+
}
1627+
15341628
/* Utility Classes */
15351629
.agent-builder-hidden {
15361630
display: none !important;

build/components/component.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,11 @@ def _copy_examples(self):
273273
example_metadata['sourceUrl'] = (
274274
f'{ex["git_uri"]}/tree/{default_branch}/{ex["path"]}/{os.path.basename(f)}'
275275
)
276+
277+
# Add binderId only if it exists
278+
if e.binder_id:
279+
example_metadata['binderId'] = e.binder_id
280+
276281
examples = self._root._examples
277282
if example_id not in examples:
278283
examples[example_id] = {}

build/components/example.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
STEP_START = 'STEP_START'
99
STEP_END = 'STEP_END'
1010
EXAMPLE = 'EXAMPLE:'
11+
BINDER_ID = 'BINDER_ID'
1112
GO_OUTPUT = 'Output:'
1213
TEST_MARKER = {
1314
'java': '@Test',
@@ -45,6 +46,7 @@ class Example(object):
4546
hidden = None
4647
highlight = None
4748
named_steps = None
49+
binder_id = None
4850

4951
def __init__(self, language: str, path: str) -> None:
5052
logging.debug("ENTERING: ")
@@ -59,6 +61,7 @@ def __init__(self, language: str, path: str) -> None:
5961
self.hidden = []
6062
self.highlight = []
6163
self.named_steps = {}
64+
self.binder_id = None
6265
self.make_ranges()
6366
self.persist(self.path)
6467
logging.debug("EXITING: ")
@@ -88,6 +91,7 @@ def make_ranges(self) -> None:
8891
rstart = re.compile(f'{PREFIXES[self.language]}\\s?{REMOVE_START}')
8992
rend = re.compile(f'{PREFIXES[self.language]}\\s?{REMOVE_END}')
9093
exid = re.compile(f'{PREFIXES[self.language]}\\s?{EXAMPLE}')
94+
binder = re.compile(f'{PREFIXES[self.language]}\\s?{BINDER_ID}\\s+([a-zA-Z0-9_-]+)')
9195
go_output = re.compile(f'{PREFIXES[self.language]}\\s?{GO_OUTPUT}')
9296
go_comment = re.compile(f'{PREFIXES[self.language]}')
9397
test_marker = re.compile(f'{TEST_MARKER.get(self.language)}')
@@ -150,6 +154,13 @@ def make_ranges(self) -> None:
150154
elif re.search(exid, l):
151155
output = False
152156
pass
157+
elif re.search(binder, l):
158+
# Extract BINDER_ID hash value
159+
match = re.search(binder, l)
160+
if match:
161+
self.binder_id = match.group(1)
162+
logging.debug(f'Found BINDER_ID: {self.binder_id} in {self.path}:L{curr+1}')
163+
output = False
153164
elif self.language == "go" and re.search(go_output, l):
154165
if output:
155166
logging.error("Nested Go Output anchor in {self.path}:L{curr+1} - aborting.")

build/jupyterize/QUICKSTART.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Jupyterize - Quick Start Guide
2+
3+
## Installation
4+
5+
```bash
6+
pip install nbformat
7+
```
8+
9+
## Basic Usage
10+
11+
```bash
12+
# Convert a file (creates example.ipynb)
13+
python build/jupyterize/jupyterize.py example.py
14+
15+
# Specify output location
16+
python build/jupyterize/jupyterize.py example.py -o notebooks/example.ipynb
17+
18+
# Enable verbose logging
19+
python build/jupyterize/jupyterize.py example.py -v
20+
```
21+
22+
## What It Does
23+
24+
Converts code example files → Jupyter notebooks (`.ipynb`)
25+
26+
**Automatic:**
27+
- ✅ Detects language from file extension
28+
- ✅ Selects appropriate Jupyter kernel
29+
- ✅ Excludes `EXAMPLE:` and `BINDER_ID` markers
30+
- ✅ Includes code in `HIDE_START`/`HIDE_END` blocks
31+
- ✅ Excludes code in `REMOVE_START`/`REMOVE_END` blocks
32+
- ✅ Creates separate cells for each `STEP_START`/`STEP_END` block
33+
34+
## Supported Languages
35+
36+
| Extension | Language | Kernel |
37+
|-----------|------------|--------------|
38+
| `.py` | Python | python3 |
39+
| `.js` | JavaScript | javascript |
40+
| `.go` | Go | gophernotes |
41+
| `.cs` | C# | csharp |
42+
| `.java` | Java | java |
43+
| `.php` | PHP | php |
44+
| `.rs` | Rust | rust |
45+
46+
## Input File Format
47+
48+
```python
49+
# EXAMPLE: example_id
50+
# BINDER_ID optional-binder-id
51+
import redis
52+
53+
# STEP_START connect
54+
r = redis.Redis()
55+
# STEP_END
56+
57+
# STEP_START set_get
58+
r.set('foo', 'bar')
59+
r.get('foo')
60+
# STEP_END
61+
```
62+
63+
## Output Structure
64+
65+
Creates a Jupyter notebook with:
66+
- **Preamble cell** - Code before first `STEP_START`
67+
- **Step cells** - Each `STEP_START`/`STEP_END` block
68+
- **Kernel metadata** - Automatically set based on language
69+
- **Step metadata** - Step names stored in cell metadata
70+
71+
## Common Issues
72+
73+
**"Unsupported file extension"**
74+
→ Use a supported extension (.py, .js, .go, .cs, .java, .php, .rs)
75+
76+
**"File must start with EXAMPLE: marker"**
77+
→ Add `# EXAMPLE: <id>` (or `//` for JS/Go/etc.) as first line
78+
79+
**"Input file not found"**
80+
→ Check file path is correct
81+
82+
## Testing
83+
84+
```bash
85+
# Run automated tests
86+
python build/jupyterize/test_jupyterize.py
87+
```
88+
89+
## More Information
90+
91+
- **User Guide**: `build/jupyterize/README.md`
92+
- **Technical Spec**: `build/jupyterize/SPECIFICATION.md`
93+
- **Implementation**: `build/jupyterize/IMPLEMENTATION.md`
94+

0 commit comments

Comments
 (0)