python-lucide 0.5.14__tar.gz → 0.5.16__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. {python_lucide-0.5.14 → python_lucide-0.5.16}/Makefile +36 -22
  2. {python_lucide-0.5.14 → python_lucide-0.5.16}/PKG-INFO +84 -44
  3. {python_lucide-0.5.14 → python_lucide-0.5.16}/README.md +81 -42
  4. {python_lucide-0.5.14 → python_lucide-0.5.16}/pyproject.toml +19 -48
  5. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/__init__.py +6 -1
  6. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/cli.py +177 -282
  7. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/config.py +30 -20
  8. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/core.py +87 -22
  9. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/data/gemini-icon-descriptions.jsonl +2151 -2228
  10. python_lucide-0.5.16/src/lucide/data/lucide-icon-clusters-fit.npy +0 -0
  11. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/data/lucide-icon-clusters.json +8675 -6475
  12. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/data/lucide-icons.sql +24694 -2856
  13. python_lucide-0.5.16/src/lucide/db.py +129 -0
  14. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/dev_utils.py +16 -23
  15. python_lucide-0.5.16/src/lucide/py.typed +0 -0
  16. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/search.py +187 -80
  17. python_lucide-0.5.16/src/lucide_data/__init__.py +7 -0
  18. python_lucide-0.5.16/src/lucide_data/__main__.py +7 -0
  19. python_lucide-0.5.16/src/lucide_data/build_clusters.py +535 -0
  20. python_lucide-0.5.16/src/lucide_data/build_search.py +1278 -0
  21. python_lucide-0.5.16/src/lucide_data/cli.py +384 -0
  22. python_lucide-0.5.16/tests/build_clusters_test.py +272 -0
  23. python_lucide-0.5.16/tests/build_search_test.py +983 -0
  24. {python_lucide-0.5.14 → python_lucide-0.5.16}/tests/cli_test.py +173 -4
  25. {python_lucide-0.5.14 → python_lucide-0.5.16}/tests/conftest.py +1 -0
  26. {python_lucide-0.5.14 → python_lucide-0.5.16}/tests/core_test.py +147 -21
  27. python_lucide-0.5.16/tests/data_structure_test.py +173 -0
  28. python_lucide-0.5.16/tests/dev_utils_test.py +160 -0
  29. python_lucide-0.5.16/tests/readme_test.py +19 -0
  30. {python_lucide-0.5.14 → python_lucide-0.5.16}/tests/search_test.py +184 -24
  31. python_lucide-0.5.16/tests/web_export_test.py +167 -0
  32. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/lib/types.ts +1 -1
  33. python_lucide-0.5.14/src/lucide/build_clusters.py +0 -324
  34. python_lucide-0.5.14/src/lucide/build_search.py +0 -794
  35. python_lucide-0.5.14/src/lucide/db.py +0 -104
  36. python_lucide-0.5.14/tests/build_clusters_test.py +0 -107
  37. python_lucide-0.5.14/tests/build_search_test.py +0 -364
  38. {python_lucide-0.5.14 → python_lucide-0.5.16}/.gitignore +0 -0
  39. {python_lucide-0.5.14 → python_lucide-0.5.16}/LICENSE +0 -0
  40. {python_lucide-0.5.14 → python_lucide-0.5.16}/build_support.py +0 -0
  41. {python_lucide-0.5.14 → python_lucide-0.5.16}/hatch_build.py +0 -0
  42. {python_lucide-0.5.14 → python_lucide-0.5.16}/src/lucide/data/__init__.py +0 -0
  43. {python_lucide-0.5.14 → python_lucide-0.5.16}/tests/__init__.py +0 -0
  44. {python_lucide-0.5.14 → python_lucide-0.5.16}/tests/db_source_test.py +0 -0
  45. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/App.svelte +0 -0
  46. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/app.css +0 -0
  47. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/components/DetailPanel.svelte +0 -0
  48. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/lib/clusters.ts +0 -0
  49. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/lib/embeddings.ts +0 -0
  50. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/lib/model-loader.ts +0 -0
  51. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/main.ts +0 -0
  52. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/pages/ExplorePage.svelte +0 -0
  53. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/pages/SearchPage.svelte +0 -0
  54. {python_lucide-0.5.14 → python_lucide-0.5.16}/web/src/vite-env.d.ts +0 -0
@@ -5,6 +5,8 @@ UV_CMD := uv
5
5
  PRE_COMMIT_CMD := $(UV_CMD) run pre-commit
6
6
  PYTEST_CMD := $(UV_CMD) run pytest
7
7
  LUCIDE_CMD := $(UV_CMD) run lucide
8
+ # Maintainer-only search-data pipeline (dev-only package, not in the wheel)
9
+ LUCIDE_DATA_CMD := $(UV_CMD) run python -m lucide_data
8
10
 
9
11
  # Get default Lucide tag from the package's config.py
10
12
  PYTHON_CMD_FOR_TAG := $(UV_CMD) run python -c "from lucide.config import DEFAULT_LUCIDE_TAG; print(DEFAULT_LUCIDE_TAG)"
@@ -17,7 +19,7 @@ DESCRIPTIONS_JSONL := src/lucide/data/gemini-icon-descriptions.jsonl
17
19
  VENV_DIR := .venv
18
20
 
19
21
  # Phony targets prevent conflicts with files of the same name.
20
- .PHONY: help default env lucide-db restore-db describe build-search cluster search-data lucide-db-full test install-hooks run-hooks-all-files check-lucide-version clean nuke
22
+ .PHONY: help default env lucide-db restore-db describe build-search recluster data-check search-data lucide-db-full test install-hooks run-hooks-all-files check-lucide-version clean nuke
21
23
 
22
24
  # Default target
23
25
  default: help
@@ -34,10 +36,11 @@ help:
34
36
  @echo " Uses TAG=$(TAG). Default TAG is read from src/lucide/config.py (currently $(DEFAULT_LUCIDE_TAG))."
35
37
  @echo " Example: make lucide-db TAG=0.520.0"
36
38
  @echo " restore-db Restore SQLite from the checked-in SQL without downloading icons."
37
- @echo " describe Generate icon descriptions via VLM (requires GEMINI_API_KEY)."
38
- @echo " build-search Build search SQLite DB from descriptions JSONL."
39
- @echo " cluster Regenerate semantic clusters from the search DB (requires GEMINI_API_KEY)."
40
- @echo " search-data Run describe + build-search + cluster, then rebuild with fresh clusters."
39
+ @echo " describe Describe new/stale icons via VLM (paid: needs ALLOW_PAID=1 and GEMINI_API_KEY; dry run otherwise)."
40
+ @echo " build-search Embed descriptions, place new icons on the map, build the search DB (free)."
41
+ @echo " recluster Re-fit the cluster layout and rename clusters (paid: ALLOW_PAID=1)."
42
+ @echo " data-check Report missing/stale/legacy descriptions and layout coverage (read-only)."
43
+ @echo " search-data Run describe + build-search."
41
44
  @echo " lucide-db-full Build icons database + search data."
42
45
  @echo " test Run tests using pytest."
43
46
  @echo " install-hooks Install pre-commit hooks."
@@ -48,15 +51,11 @@ help:
48
51
  @echo " nuke A more thorough clean: runs 'clean', 'uv cache clean', and removes $(VENV_DIR)."
49
52
  @echo ""
50
53
 
51
- env: $(VENV_DIR)/pyvenv.cfg
54
+ env:
52
55
  @echo "Installing/updating development dependencies into $(VENV_DIR)..."
53
- $(UV_CMD) pip install -e ".[dev]"
56
+ $(UV_CMD) sync --dev
54
57
  @echo "Development environment ready in $(VENV_DIR)/."
55
58
 
56
- $(VENV_DIR)/pyvenv.cfg:
57
- @echo "Creating virtual environment in $(VENV_DIR)/ using $(UV_CMD)..."
58
- $(UV_CMD) venv $(VENV_DIR)
59
-
60
59
  lucide-db:
61
60
  @echo "Building Lucide icon database with tag $(TAG) into $(DB_OUTPUT_PATH)..."
62
61
  @mkdir -p src/lucide/data # Ensure data directory exists
@@ -67,24 +66,39 @@ lucide-db:
67
66
  restore-db:
68
67
  $(UV_CMD) run python build_support.py restore
69
68
 
69
+ # Paid steps (describe, recluster) only run with ALLOW_PAID=1; without it,
70
+ # describe reports what it would do and recluster refuses.
71
+ ALLOW_PAID ?=
72
+ PAID_FLAG := $(if $(ALLOW_PAID),--allow-paid,)
73
+
70
74
  describe:
71
75
  @echo "Generating icon descriptions..."
72
- $(LUCIDE_CMD) describe --icons-db $(DB_OUTPUT_PATH) -o $(DESCRIPTIONS_JSONL) -v
76
+ $(LUCIDE_DATA_CMD) describe --icons-db $(DB_OUTPUT_PATH) --descriptions-file $(DESCRIPTIONS_JSONL) $(PAID_FLAG) -v
73
77
 
74
78
  CLUSTERS_JSON := src/lucide/data/lucide-icon-clusters.json
75
79
 
80
+ DATA_PATHS := --icons-db $(DB_OUTPUT_PATH) --descriptions-file $(DESCRIPTIONS_JSONL) --clusters-file $(CLUSTERS_JSON)
81
+
82
+ # Embeds once, places icons new since the last fit into the existing map
83
+ # (free), and writes the search DB.
76
84
  build-search:
77
85
  @echo "Building search DB from descriptions..."
78
- $(LUCIDE_CMD) build-search --descriptions-file $(DESCRIPTIONS_JSONL) --clusters-file $(CLUSTERS_JSON) --icons-db $(DB_OUTPUT_PATH) -o $(SEARCH_DB_OUTPUT_PATH) -v
79
-
80
- cluster:
81
- @echo "Discovering and naming semantic clusters..."
82
- $(LUCIDE_CMD) cluster --search-db $(SEARCH_DB_OUTPUT_PATH) -o $(CLUSTERS_JSON) -v
83
-
84
- # build-search runs twice: clustering needs the embeddings from the first
85
- # pass, then the DB is rebuilt so it carries the refreshed cluster data.
86
- search-data: describe build-search cluster
87
- @$(MAKE) build-search
86
+ $(LUCIDE_DATA_CMD) build-search $(DATA_PATHS) -o $(SEARCH_DB_OUTPUT_PATH) -v
87
+
88
+ # Full re-fit and rename of every cluster (paid naming). A deliberate step,
89
+ # not part of the weekly update.
90
+ # Extra flags, e.g. RECLUSTER_FLAGS="--summary-json summary.json"
91
+ RECLUSTER_FLAGS ?=
92
+ recluster:
93
+ @echo "Re-fitting and renaming semantic clusters..."
94
+ $(LUCIDE_DATA_CMD) cluster $(DATA_PATHS) -o $(SEARCH_DB_OUTPUT_PATH) $(PAID_FLAG) $(RECLUSTER_FLAGS) -v
95
+
96
+ # Strict by default (the release gate); CHECK_FLAGS=--report-only to only report
97
+ CHECK_FLAGS ?=
98
+ data-check:
99
+ $(LUCIDE_DATA_CMD) data check $(DATA_PATHS) --search-db $(SEARCH_DB_OUTPUT_PATH) $(CHECK_FLAGS)
100
+
101
+ search-data: describe build-search
88
102
 
89
103
  lucide-db-full: lucide-db search-data
90
104
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-lucide
3
- Version: 0.5.14
3
+ Version: 0.5.16
4
4
  Summary: A Python package for working with Lucide icons
5
5
  Project-URL: Bug Tracker, https://github.com/mmacpherson/python-lucide/issues
6
6
  Project-URL: Homepage, https://github.com/mmacpherson/python-lucide
@@ -17,11 +17,12 @@ Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
18
  Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: 3.15
20
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
22
  Requires-Python: >=3.11
22
23
  Provides-Extra: search
23
24
  Requires-Dist: cairosvg>=2.7.0; extra == 'search'
24
- Requires-Dist: fastembed>=0.4.0; extra == 'search'
25
+ Requires-Dist: candle-embed>=0.1.0; extra == 'search'
25
26
  Description-Content-Type: text/markdown
26
27
 
27
28
  # python-lucide
@@ -43,7 +44,7 @@ icons](https://lucide.dev/) as SVG strings. Just import and use any Lucide icon
43
44
  in your Python projects, with no javascript in sight.
44
45
 
45
46
  ## Features
46
- - 🎨 **Access 1600+ Lucide icons** directly from Python
47
+ - 🎨 **Access 2,100+ Lucide icons** directly from Python
47
48
  - 🔍 **Semantic search** - find icons by meaning, in the terminal or [in the browser](https://mmacpherson.github.io/python-lucide/)
48
49
  - 🛠 **Customize icons** with classes, sizes, colors, and other SVG attributes
49
50
  - 🚀 **Framework-friendly** with examples for FastHTML, Flask, Django, and more
@@ -56,20 +57,8 @@ pip install python-lucide
56
57
  ```
57
58
  This installs the package with a pre-built database of all Lucide icons, ready to use immediately.
58
59
 
59
- Python 3.11–3.14 are supported. **Python 3.15 support is experimental:** core
60
- rendering, aliases, and SQL-backed package builds pass tests on 3.15 RC2 and have
61
- a dedicated CI job, but semantic search is currently unsupported because ONNX
62
- Runtime does not yet provide compatible wheels. Core installation remains
63
- available on 3.15; full support will be advertised once search is validated too.
64
- Use Python 3.11–3.14 for search and full development tooling. HDBSCAN and UMAP's
65
- dependencies affect cluster generation during development, not ordinary searches.
66
-
67
- To run the core tests on Python 3.15 from a source checkout:
68
-
69
- ```bash
70
- uv sync --python 3.15 --no-dev --group test-core
71
- uv run --no-sync python -m pytest tests/core_test.py tests/db_source_test.py
72
- ```
60
+ Python 3.11–3.15 are supported, including semantic search (`python-lucide[search]`)
61
+ and full development/clustering tooling.
73
62
 
74
63
  ## Quick Start
75
64
  ```python
@@ -165,23 +154,14 @@ pip install "python-lucide[search]"
165
154
  lucide search "celebrate a big achievement"
166
155
  ```
167
156
 
168
- If your application uses Python 3.15, run the search CLI separately under Python
169
- 3.14, or use the [browser search](https://mmacpherson.github.io/python-lucide/):
170
-
171
- ```bash
172
- uvx --python 3.14 --from "python-lucide[search]" lucide search "payment"
173
- ```
174
-
175
- This runs the CLI in a separate environment; calling `search_icons()` from your
176
- application still requires a supported Python version with the search extra.
177
-
178
157
  <img src="https://raw.githubusercontent.com/mmacpherson/python-lucide/main/.github/images/search-cli.png" width="360" alt="Terminal output of lucide search: each result icon renders inline next to its name and match score">
179
158
 
180
159
  In terminals supporting the Kitty graphics protocol (kitty, Ghostty,
181
160
  WezTerm), the icons render inline as above — inside tmux too, with
182
161
  `tmux set -g allow-passthrough on`. Elsewhere you get the plain text
183
- list. (Rendering uses the cairo system library; if it's missing, the
184
- CLI prints a hint.)
162
+ list, as you do when output is piped. Setting `NO_COLOR` turns off colour.
163
+ (Rendering uses the cairo system library; if it's missing, the CLI prints a
164
+ hint.)
185
165
 
186
166
  Icons are matched against AI-generated descriptions using the same embedding
187
167
  model the [web app](https://mmacpherson.github.io/python-lucide/) uses,
@@ -192,9 +172,17 @@ keywords. Options:
192
172
  best for English)
193
173
  - `--limit N` — number of results; `--verbose` — include each icon's description
194
174
 
195
- The first search downloads the embedding model (~67 MB) and the pre-built
196
- search index (11 MB); both are cached, and every search after that runs
197
- locally in well under a second.
175
+ The first search downloads the embedding model (~133 MB for `bge-small`,
176
+ ~471 MB for `multilingual`) and the pre-built search index (~10 MB). Both are
177
+ cached, and later searches run locally. The index is stored in
178
+ `~/.cache/python-lucide/` and the models in `~/.cache/candle-embed/`.
179
+
180
+ To use a search database you built or downloaded yourself, set
181
+ `LUCIDE_SEARCH_DB_PATH` or pass `lucide search --search-db`. Without either,
182
+ `lucide search` uses a `lucide-search.db` sitting next to the icons database if
183
+ there is one. A path you name explicitly must exist and match this package's
184
+ search schema; otherwise you get an error, not a silent fallback to the cache or
185
+ a download.
198
186
 
199
187
  The same search is available as a Python API:
200
188
 
@@ -205,6 +193,17 @@ for r in search_icons("secure login", limit=5):
205
193
  print(r.name, r.score)
206
194
  ```
207
195
 
196
+ `search_icons` and the two helpers below also accept `db_path=`, which takes
197
+ precedence over `LUCIDE_SEARCH_DB_PATH`. The helpers inspect local search data
198
+ without ever downloading it:
199
+
200
+ ```python
201
+ from lucide import get_icon_description, search_available
202
+
203
+ search_available() # True once the search index is available locally
204
+ get_icon_description("house") # Its AI-generated description, or None
205
+ ```
206
+
208
207
  Prefer not to install anything? The [browser version](https://mmacpherson.github.io/python-lucide/)
209
208
  runs the whole pipeline client-side.
210
209
 
@@ -323,7 +322,9 @@ lucide_icon(
323
322
  - `stroke_linecap`: How the ends of strokes are rendered ("round", "butt", "square")
324
323
  - `stroke_linejoin`: How corners are rendered ("round", "miter", "bevel")
325
324
 
326
- **Returns:** SVG string
325
+ **Returns:** SVG string. If the icon or database is unavailable, you get a
326
+ placeholder SVG instead. Successful renders are cached; placeholders are not, so
327
+ a repaired database or newly added icon is picked up without a restart.
327
328
 
328
329
  **Example:**
329
330
  ```python
@@ -350,19 +351,34 @@ print(f"Available icons: {len(icons)}")
350
351
  print(icons[:5]) # ['activity', 'airplay', 'alarm-check', ...]
351
352
  ```
352
353
 
354
+ ## Command Line
355
+
356
+ | Command | Purpose |
357
+ | --- | --- |
358
+ | `lucide search` | Find icons by meaning (needs the `search` extra) |
359
+ | `lucide db` | Build an icon database from a Lucide release |
360
+ | `lucide version` | Check for Lucide version updates |
361
+
362
+ Run `lucide <command> --help` for options. `lucide-db` is shorthand for
363
+ `lucide db`.
364
+
365
+ The search-data pipeline is not part of the installed package; in a checkout,
366
+ see [Search Data Maintenance](#search-data-maintenance) or run
367
+ `uv run python -m lucide_data --help`.
368
+
353
369
  ## Advanced Usage
354
370
 
355
371
  ### Building a Custom Icon Set
356
372
  If you want to include only specific icons or use a different version of Lucide:
357
373
  ```bash
358
374
  # Build with specific icons only
359
- lucide-db -i home,settings,user,heart,star -o custom-icons.db
375
+ lucide-db -i house,settings,user,heart,star -o custom-icons.db
360
376
 
361
377
  # Use a specific Lucide version
362
378
  lucide-db -t 0.350.0 -o lucide-v0.350.0.db
363
379
 
364
380
  # Build from a file listing icon names
365
- echo -e "home\nsettings\nuser" > my-icons.txt
381
+ echo -e "house\nsettings\nuser" > my-icons.txt
366
382
  lucide-db -f my-icons.txt -o my-icons.db
367
383
  ```
368
384
 
@@ -399,6 +415,9 @@ make install-hooks
399
415
 
400
416
  # Run tests
401
417
  make test
418
+
419
+ # Type check with ty (also run by pre-commit)
420
+ uv run ty check
402
421
  ```
403
422
 
404
423
  ### Rebuilding the Icon Database
@@ -424,23 +443,41 @@ make check-lucide-version
424
443
  uv run check-lucide-version
425
444
  ```
426
445
 
427
- **Weekly Automation**: The repository automatically checks for new Lucide releases every Monday and creates update PRs when new versions are available.
446
+ **Weekly Automation**: The repository automatically checks for new Lucide releases every Sunday and creates update PRs when new versions are available.
447
+
448
+ ### Search Data Maintenance
449
+ Descriptions and cluster theme names come from Gemini, so those steps only run
450
+ when you pass `ALLOW_PAID=1`:
451
+
452
+ ```bash
453
+ make search-data # Report what would be described, then build (free)
454
+ make search-data ALLOW_PAID=1 # Describe new and stale icons, then build
455
+ make data-check # Strict, read-only check; the release gate
456
+ make recluster ALLOW_PAID=1 # Re-fit and rename every cluster
457
+ ```
458
+
459
+ The weekly update places new icons into the existing cluster map. To re-fit the
460
+ map, run the **Re-cluster icons** workflow, which opens a PR listing the renamed
461
+ themes.
428
462
 
429
463
  ### Release Process
430
- This project follows a manual release process:
464
+ This project follows a manual release process (replace `X.Y.Z` with the new
465
+ version). The release stops if `make data-check` fails, so bring the search
466
+ data up to date on main first, and run **Re-cluster icons** if you want a fresh
467
+ map.
431
468
 
432
469
  1. **Update version** in `pyproject.toml`:
433
470
  ```bash
434
471
  # Create release branch
435
- git checkout -b release/v0.2.0
472
+ git checkout -b release/vX.Y.Z
436
473
 
437
474
  # Edit pyproject.toml to bump version
438
- # version = "0.2.0"
475
+ # version = "X.Y.Z"
439
476
 
440
477
  # Commit and push
441
478
  git add pyproject.toml
442
- git commit -m "Bump version to 0.2.0"
443
- git push -u origin release/v0.2.0
479
+ git commit -m "Bump version to X.Y.Z"
480
+ git push -u origin release/vX.Y.Z
444
481
  ```
445
482
 
446
483
  2. **Create and merge PR** for the version bump
@@ -448,14 +485,17 @@ This project follows a manual release process:
448
485
  3. **Tag the merged commit on main** with the same version:
449
486
  ```bash
450
487
  git checkout main && git pull
451
- git tag v0.2.0
452
- git push origin v0.2.0
488
+ git tag vX.Y.Z
489
+ git push origin vX.Y.Z
453
490
  ```
454
491
 
455
492
  4. **Automatic publishing**: The `release.yml` workflow checks that the tag
456
493
  matches `pyproject.toml` and is on main, runs CI on the tagged commit,
457
494
  publishes that build to PyPI using trusted publishing, creates the GitHub
458
- Release, and attaches the rebuilt search database to its `search-v*` release.
495
+ Release, and attaches the search database built for that package version to
496
+ the Lucide version's `search-v*` release.
497
+ It then redeploys the web app, which shows the data of the latest release
498
+ rather than whatever is on main.
459
499
 
460
500
  ## How It Works
461
501
  The package comes with a pre-built SQLite database containing all Lucide icons. When you call `lucide_icon()`, it fetches the icon's SVG from the database and applies your customizations. This approach means:
@@ -17,7 +17,7 @@ icons](https://lucide.dev/) as SVG strings. Just import and use any Lucide icon
17
17
  in your Python projects, with no javascript in sight.
18
18
 
19
19
  ## Features
20
- - 🎨 **Access 1600+ Lucide icons** directly from Python
20
+ - 🎨 **Access 2,100+ Lucide icons** directly from Python
21
21
  - 🔍 **Semantic search** - find icons by meaning, in the terminal or [in the browser](https://mmacpherson.github.io/python-lucide/)
22
22
  - 🛠 **Customize icons** with classes, sizes, colors, and other SVG attributes
23
23
  - 🚀 **Framework-friendly** with examples for FastHTML, Flask, Django, and more
@@ -30,20 +30,8 @@ pip install python-lucide
30
30
  ```
31
31
  This installs the package with a pre-built database of all Lucide icons, ready to use immediately.
32
32
 
33
- Python 3.11–3.14 are supported. **Python 3.15 support is experimental:** core
34
- rendering, aliases, and SQL-backed package builds pass tests on 3.15 RC2 and have
35
- a dedicated CI job, but semantic search is currently unsupported because ONNX
36
- Runtime does not yet provide compatible wheels. Core installation remains
37
- available on 3.15; full support will be advertised once search is validated too.
38
- Use Python 3.11–3.14 for search and full development tooling. HDBSCAN and UMAP's
39
- dependencies affect cluster generation during development, not ordinary searches.
40
-
41
- To run the core tests on Python 3.15 from a source checkout:
42
-
43
- ```bash
44
- uv sync --python 3.15 --no-dev --group test-core
45
- uv run --no-sync python -m pytest tests/core_test.py tests/db_source_test.py
46
- ```
33
+ Python 3.11–3.15 are supported, including semantic search (`python-lucide[search]`)
34
+ and full development/clustering tooling.
47
35
 
48
36
  ## Quick Start
49
37
  ```python
@@ -139,23 +127,14 @@ pip install "python-lucide[search]"
139
127
  lucide search "celebrate a big achievement"
140
128
  ```
141
129
 
142
- If your application uses Python 3.15, run the search CLI separately under Python
143
- 3.14, or use the [browser search](https://mmacpherson.github.io/python-lucide/):
144
-
145
- ```bash
146
- uvx --python 3.14 --from "python-lucide[search]" lucide search "payment"
147
- ```
148
-
149
- This runs the CLI in a separate environment; calling `search_icons()` from your
150
- application still requires a supported Python version with the search extra.
151
-
152
130
  <img src="https://raw.githubusercontent.com/mmacpherson/python-lucide/main/.github/images/search-cli.png" width="360" alt="Terminal output of lucide search: each result icon renders inline next to its name and match score">
153
131
 
154
132
  In terminals supporting the Kitty graphics protocol (kitty, Ghostty,
155
133
  WezTerm), the icons render inline as above — inside tmux too, with
156
134
  `tmux set -g allow-passthrough on`. Elsewhere you get the plain text
157
- list. (Rendering uses the cairo system library; if it's missing, the
158
- CLI prints a hint.)
135
+ list, as you do when output is piped. Setting `NO_COLOR` turns off colour.
136
+ (Rendering uses the cairo system library; if it's missing, the CLI prints a
137
+ hint.)
159
138
 
160
139
  Icons are matched against AI-generated descriptions using the same embedding
161
140
  model the [web app](https://mmacpherson.github.io/python-lucide/) uses,
@@ -166,9 +145,17 @@ keywords. Options:
166
145
  best for English)
167
146
  - `--limit N` — number of results; `--verbose` — include each icon's description
168
147
 
169
- The first search downloads the embedding model (~67 MB) and the pre-built
170
- search index (11 MB); both are cached, and every search after that runs
171
- locally in well under a second.
148
+ The first search downloads the embedding model (~133 MB for `bge-small`,
149
+ ~471 MB for `multilingual`) and the pre-built search index (~10 MB). Both are
150
+ cached, and later searches run locally. The index is stored in
151
+ `~/.cache/python-lucide/` and the models in `~/.cache/candle-embed/`.
152
+
153
+ To use a search database you built or downloaded yourself, set
154
+ `LUCIDE_SEARCH_DB_PATH` or pass `lucide search --search-db`. Without either,
155
+ `lucide search` uses a `lucide-search.db` sitting next to the icons database if
156
+ there is one. A path you name explicitly must exist and match this package's
157
+ search schema; otherwise you get an error, not a silent fallback to the cache or
158
+ a download.
172
159
 
173
160
  The same search is available as a Python API:
174
161
 
@@ -179,6 +166,17 @@ for r in search_icons("secure login", limit=5):
179
166
  print(r.name, r.score)
180
167
  ```
181
168
 
169
+ `search_icons` and the two helpers below also accept `db_path=`, which takes
170
+ precedence over `LUCIDE_SEARCH_DB_PATH`. The helpers inspect local search data
171
+ without ever downloading it:
172
+
173
+ ```python
174
+ from lucide import get_icon_description, search_available
175
+
176
+ search_available() # True once the search index is available locally
177
+ get_icon_description("house") # Its AI-generated description, or None
178
+ ```
179
+
182
180
  Prefer not to install anything? The [browser version](https://mmacpherson.github.io/python-lucide/)
183
181
  runs the whole pipeline client-side.
184
182
 
@@ -297,7 +295,9 @@ lucide_icon(
297
295
  - `stroke_linecap`: How the ends of strokes are rendered ("round", "butt", "square")
298
296
  - `stroke_linejoin`: How corners are rendered ("round", "miter", "bevel")
299
297
 
300
- **Returns:** SVG string
298
+ **Returns:** SVG string. If the icon or database is unavailable, you get a
299
+ placeholder SVG instead. Successful renders are cached; placeholders are not, so
300
+ a repaired database or newly added icon is picked up without a restart.
301
301
 
302
302
  **Example:**
303
303
  ```python
@@ -324,19 +324,34 @@ print(f"Available icons: {len(icons)}")
324
324
  print(icons[:5]) # ['activity', 'airplay', 'alarm-check', ...]
325
325
  ```
326
326
 
327
+ ## Command Line
328
+
329
+ | Command | Purpose |
330
+ | --- | --- |
331
+ | `lucide search` | Find icons by meaning (needs the `search` extra) |
332
+ | `lucide db` | Build an icon database from a Lucide release |
333
+ | `lucide version` | Check for Lucide version updates |
334
+
335
+ Run `lucide <command> --help` for options. `lucide-db` is shorthand for
336
+ `lucide db`.
337
+
338
+ The search-data pipeline is not part of the installed package; in a checkout,
339
+ see [Search Data Maintenance](#search-data-maintenance) or run
340
+ `uv run python -m lucide_data --help`.
341
+
327
342
  ## Advanced Usage
328
343
 
329
344
  ### Building a Custom Icon Set
330
345
  If you want to include only specific icons or use a different version of Lucide:
331
346
  ```bash
332
347
  # Build with specific icons only
333
- lucide-db -i home,settings,user,heart,star -o custom-icons.db
348
+ lucide-db -i house,settings,user,heart,star -o custom-icons.db
334
349
 
335
350
  # Use a specific Lucide version
336
351
  lucide-db -t 0.350.0 -o lucide-v0.350.0.db
337
352
 
338
353
  # Build from a file listing icon names
339
- echo -e "home\nsettings\nuser" > my-icons.txt
354
+ echo -e "house\nsettings\nuser" > my-icons.txt
340
355
  lucide-db -f my-icons.txt -o my-icons.db
341
356
  ```
342
357
 
@@ -373,6 +388,9 @@ make install-hooks
373
388
 
374
389
  # Run tests
375
390
  make test
391
+
392
+ # Type check with ty (also run by pre-commit)
393
+ uv run ty check
376
394
  ```
377
395
 
378
396
  ### Rebuilding the Icon Database
@@ -398,23 +416,41 @@ make check-lucide-version
398
416
  uv run check-lucide-version
399
417
  ```
400
418
 
401
- **Weekly Automation**: The repository automatically checks for new Lucide releases every Monday and creates update PRs when new versions are available.
419
+ **Weekly Automation**: The repository automatically checks for new Lucide releases every Sunday and creates update PRs when new versions are available.
420
+
421
+ ### Search Data Maintenance
422
+ Descriptions and cluster theme names come from Gemini, so those steps only run
423
+ when you pass `ALLOW_PAID=1`:
424
+
425
+ ```bash
426
+ make search-data # Report what would be described, then build (free)
427
+ make search-data ALLOW_PAID=1 # Describe new and stale icons, then build
428
+ make data-check # Strict, read-only check; the release gate
429
+ make recluster ALLOW_PAID=1 # Re-fit and rename every cluster
430
+ ```
431
+
432
+ The weekly update places new icons into the existing cluster map. To re-fit the
433
+ map, run the **Re-cluster icons** workflow, which opens a PR listing the renamed
434
+ themes.
402
435
 
403
436
  ### Release Process
404
- This project follows a manual release process:
437
+ This project follows a manual release process (replace `X.Y.Z` with the new
438
+ version). The release stops if `make data-check` fails, so bring the search
439
+ data up to date on main first, and run **Re-cluster icons** if you want a fresh
440
+ map.
405
441
 
406
442
  1. **Update version** in `pyproject.toml`:
407
443
  ```bash
408
444
  # Create release branch
409
- git checkout -b release/v0.2.0
445
+ git checkout -b release/vX.Y.Z
410
446
 
411
447
  # Edit pyproject.toml to bump version
412
- # version = "0.2.0"
448
+ # version = "X.Y.Z"
413
449
 
414
450
  # Commit and push
415
451
  git add pyproject.toml
416
- git commit -m "Bump version to 0.2.0"
417
- git push -u origin release/v0.2.0
452
+ git commit -m "Bump version to X.Y.Z"
453
+ git push -u origin release/vX.Y.Z
418
454
  ```
419
455
 
420
456
  2. **Create and merge PR** for the version bump
@@ -422,14 +458,17 @@ This project follows a manual release process:
422
458
  3. **Tag the merged commit on main** with the same version:
423
459
  ```bash
424
460
  git checkout main && git pull
425
- git tag v0.2.0
426
- git push origin v0.2.0
461
+ git tag vX.Y.Z
462
+ git push origin vX.Y.Z
427
463
  ```
428
464
 
429
465
  4. **Automatic publishing**: The `release.yml` workflow checks that the tag
430
466
  matches `pyproject.toml` and is on main, runs CI on the tagged commit,
431
467
  publishes that build to PyPI using trusted publishing, creates the GitHub
432
- Release, and attaches the rebuilt search database to its `search-v*` release.
468
+ Release, and attaches the search database built for that package version to
469
+ the Lucide version's `search-v*` release.
470
+ It then redeploys the web app, which shows the data of the latest release
471
+ rather than whatever is on main.
433
472
 
434
473
  ## How It Works
435
474
  The package comes with a pre-built SQLite database containing all Lucide icons. When you call `lucide_icon()`, it fetches the icon's SVG from the database and applies your customizations. This approach means: