python-lucide 0.5.15__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 (53) hide show
  1. {python_lucide-0.5.15 → python_lucide-0.5.16}/Makefile +34 -16
  2. {python_lucide-0.5.15 → python_lucide-0.5.16}/PKG-INFO +80 -19
  3. {python_lucide-0.5.15 → python_lucide-0.5.16}/README.md +79 -18
  4. {python_lucide-0.5.15 → python_lucide-0.5.16}/pyproject.toml +13 -32
  5. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/cli.py +170 -263
  6. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/config.py +28 -19
  7. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/core.py +63 -15
  8. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/data/gemini-icon-descriptions.jsonl +2151 -2228
  9. python_lucide-0.5.16/src/lucide/data/lucide-icon-clusters-fit.npy +0 -0
  10. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/data/lucide-icon-clusters.json +8675 -6475
  11. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/data/lucide-icons.sql +24694 -2856
  12. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/db.py +56 -35
  13. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/dev_utils.py +15 -22
  14. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/search.py +138 -47
  15. python_lucide-0.5.16/src/lucide_data/__init__.py +7 -0
  16. python_lucide-0.5.16/src/lucide_data/__main__.py +7 -0
  17. python_lucide-0.5.16/src/lucide_data/build_clusters.py +535 -0
  18. python_lucide-0.5.16/src/lucide_data/build_search.py +1278 -0
  19. python_lucide-0.5.16/src/lucide_data/cli.py +384 -0
  20. python_lucide-0.5.16/tests/build_clusters_test.py +272 -0
  21. python_lucide-0.5.16/tests/build_search_test.py +983 -0
  22. {python_lucide-0.5.15 → python_lucide-0.5.16}/tests/cli_test.py +162 -2
  23. {python_lucide-0.5.15 → python_lucide-0.5.16}/tests/core_test.py +91 -22
  24. python_lucide-0.5.16/tests/data_structure_test.py +173 -0
  25. python_lucide-0.5.16/tests/dev_utils_test.py +160 -0
  26. python_lucide-0.5.16/tests/readme_test.py +19 -0
  27. {python_lucide-0.5.15 → python_lucide-0.5.16}/tests/search_test.py +134 -10
  28. python_lucide-0.5.16/tests/web_export_test.py +167 -0
  29. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/lib/types.ts +1 -1
  30. python_lucide-0.5.15/src/lucide/build_clusters.py +0 -324
  31. python_lucide-0.5.15/src/lucide/build_search.py +0 -798
  32. python_lucide-0.5.15/tests/build_clusters_test.py +0 -152
  33. python_lucide-0.5.15/tests/build_search_test.py +0 -364
  34. {python_lucide-0.5.15 → python_lucide-0.5.16}/.gitignore +0 -0
  35. {python_lucide-0.5.15 → python_lucide-0.5.16}/LICENSE +0 -0
  36. {python_lucide-0.5.15 → python_lucide-0.5.16}/build_support.py +0 -0
  37. {python_lucide-0.5.15 → python_lucide-0.5.16}/hatch_build.py +0 -0
  38. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/__init__.py +0 -0
  39. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/data/__init__.py +0 -0
  40. {python_lucide-0.5.15 → python_lucide-0.5.16}/src/lucide/py.typed +0 -0
  41. {python_lucide-0.5.15 → python_lucide-0.5.16}/tests/__init__.py +0 -0
  42. {python_lucide-0.5.15 → python_lucide-0.5.16}/tests/conftest.py +0 -0
  43. {python_lucide-0.5.15 → python_lucide-0.5.16}/tests/db_source_test.py +0 -0
  44. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/App.svelte +0 -0
  45. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/app.css +0 -0
  46. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/components/DetailPanel.svelte +0 -0
  47. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/lib/clusters.ts +0 -0
  48. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/lib/embeddings.ts +0 -0
  49. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/lib/model-loader.ts +0 -0
  50. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/main.ts +0 -0
  51. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/pages/ExplorePage.svelte +0 -0
  52. {python_lucide-0.5.15 → python_lucide-0.5.16}/web/src/pages/SearchPage.svelte +0 -0
  53. {python_lucide-0.5.15 → 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."
@@ -63,24 +66,39 @@ lucide-db:
63
66
  restore-db:
64
67
  $(UV_CMD) run python build_support.py restore
65
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
+
66
74
  describe:
67
75
  @echo "Generating icon descriptions..."
68
- $(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
69
77
 
70
78
  CLUSTERS_JSON := src/lucide/data/lucide-icon-clusters.json
71
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.
72
84
  build-search:
73
85
  @echo "Building search DB from descriptions..."
74
- $(LUCIDE_CMD) build-search --descriptions-file $(DESCRIPTIONS_JSONL) --clusters-file $(CLUSTERS_JSON) --icons-db $(DB_OUTPUT_PATH) -o $(SEARCH_DB_OUTPUT_PATH) -v
75
-
76
- cluster:
77
- @echo "Discovering and naming semantic clusters..."
78
- $(LUCIDE_CMD) cluster --search-db $(SEARCH_DB_OUTPUT_PATH) -o $(CLUSTERS_JSON) -v
79
-
80
- # build-search runs twice: clustering needs the embeddings from the first
81
- # pass, then the DB is rebuilt so it carries the refreshed cluster data.
82
- search-data: describe build-search cluster
83
- @$(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
84
102
 
85
103
  lucide-db-full: lucide-db search-data
86
104
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-lucide
3
- Version: 0.5.15
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
@@ -44,7 +44,7 @@ icons](https://lucide.dev/) as SVG strings. Just import and use any Lucide icon
44
44
  in your Python projects, with no javascript in sight.
45
45
 
46
46
  ## Features
47
- - 🎨 **Access 1600+ Lucide icons** directly from Python
47
+ - 🎨 **Access 2,100+ Lucide icons** directly from Python
48
48
  - 🔍 **Semantic search** - find icons by meaning, in the terminal or [in the browser](https://mmacpherson.github.io/python-lucide/)
49
49
  - 🛠 **Customize icons** with classes, sizes, colors, and other SVG attributes
50
50
  - 🚀 **Framework-friendly** with examples for FastHTML, Flask, Django, and more
@@ -159,8 +159,9 @@ lucide search "celebrate a big achievement"
159
159
  In terminals supporting the Kitty graphics protocol (kitty, Ghostty,
160
160
  WezTerm), the icons render inline as above — inside tmux too, with
161
161
  `tmux set -g allow-passthrough on`. Elsewhere you get the plain text
162
- list. (Rendering uses the cairo system library; if it's missing, the
163
- 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.)
164
165
 
165
166
  Icons are matched against AI-generated descriptions using the same embedding
166
167
  model the [web app](https://mmacpherson.github.io/python-lucide/) uses,
@@ -171,9 +172,17 @@ keywords. Options:
171
172
  best for English)
172
173
  - `--limit N` — number of results; `--verbose` — include each icon's description
173
174
 
174
- The first search downloads the embedding model (~67 MB) and the pre-built
175
- search index (11 MB); both are cached, and every search after that runs
176
- 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.
177
186
 
178
187
  The same search is available as a Python API:
179
188
 
@@ -184,6 +193,17 @@ for r in search_icons("secure login", limit=5):
184
193
  print(r.name, r.score)
185
194
  ```
186
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
+
187
207
  Prefer not to install anything? The [browser version](https://mmacpherson.github.io/python-lucide/)
188
208
  runs the whole pipeline client-side.
189
209
 
@@ -302,7 +322,9 @@ lucide_icon(
302
322
  - `stroke_linecap`: How the ends of strokes are rendered ("round", "butt", "square")
303
323
  - `stroke_linejoin`: How corners are rendered ("round", "miter", "bevel")
304
324
 
305
- **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.
306
328
 
307
329
  **Example:**
308
330
  ```python
@@ -329,19 +351,34 @@ print(f"Available icons: {len(icons)}")
329
351
  print(icons[:5]) # ['activity', 'airplay', 'alarm-check', ...]
330
352
  ```
331
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
+
332
369
  ## Advanced Usage
333
370
 
334
371
  ### Building a Custom Icon Set
335
372
  If you want to include only specific icons or use a different version of Lucide:
336
373
  ```bash
337
374
  # Build with specific icons only
338
- 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
339
376
 
340
377
  # Use a specific Lucide version
341
378
  lucide-db -t 0.350.0 -o lucide-v0.350.0.db
342
379
 
343
380
  # Build from a file listing icon names
344
- echo -e "home\nsettings\nuser" > my-icons.txt
381
+ echo -e "house\nsettings\nuser" > my-icons.txt
345
382
  lucide-db -f my-icons.txt -o my-icons.db
346
383
  ```
347
384
 
@@ -378,6 +415,9 @@ make install-hooks
378
415
 
379
416
  # Run tests
380
417
  make test
418
+
419
+ # Type check with ty (also run by pre-commit)
420
+ uv run ty check
381
421
  ```
382
422
 
383
423
  ### Rebuilding the Icon Database
@@ -403,23 +443,41 @@ make check-lucide-version
403
443
  uv run check-lucide-version
404
444
  ```
405
445
 
406
- **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.
407
462
 
408
463
  ### Release Process
409
- 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.
410
468
 
411
469
  1. **Update version** in `pyproject.toml`:
412
470
  ```bash
413
471
  # Create release branch
414
- git checkout -b release/v0.2.0
472
+ git checkout -b release/vX.Y.Z
415
473
 
416
474
  # Edit pyproject.toml to bump version
417
- # version = "0.2.0"
475
+ # version = "X.Y.Z"
418
476
 
419
477
  # Commit and push
420
478
  git add pyproject.toml
421
- git commit -m "Bump version to 0.2.0"
422
- 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
423
481
  ```
424
482
 
425
483
  2. **Create and merge PR** for the version bump
@@ -427,14 +485,17 @@ This project follows a manual release process:
427
485
  3. **Tag the merged commit on main** with the same version:
428
486
  ```bash
429
487
  git checkout main && git pull
430
- git tag v0.2.0
431
- git push origin v0.2.0
488
+ git tag vX.Y.Z
489
+ git push origin vX.Y.Z
432
490
  ```
433
491
 
434
492
  4. **Automatic publishing**: The `release.yml` workflow checks that the tag
435
493
  matches `pyproject.toml` and is on main, runs CI on the tagged commit,
436
494
  publishes that build to PyPI using trusted publishing, creates the GitHub
437
- 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.
438
499
 
439
500
  ## How It Works
440
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
@@ -132,8 +132,9 @@ lucide search "celebrate a big achievement"
132
132
  In terminals supporting the Kitty graphics protocol (kitty, Ghostty,
133
133
  WezTerm), the icons render inline as above — inside tmux too, with
134
134
  `tmux set -g allow-passthrough on`. Elsewhere you get the plain text
135
- list. (Rendering uses the cairo system library; if it's missing, the
136
- 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.)
137
138
 
138
139
  Icons are matched against AI-generated descriptions using the same embedding
139
140
  model the [web app](https://mmacpherson.github.io/python-lucide/) uses,
@@ -144,9 +145,17 @@ keywords. Options:
144
145
  best for English)
145
146
  - `--limit N` — number of results; `--verbose` — include each icon's description
146
147
 
147
- The first search downloads the embedding model (~67 MB) and the pre-built
148
- search index (11 MB); both are cached, and every search after that runs
149
- 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.
150
159
 
151
160
  The same search is available as a Python API:
152
161
 
@@ -157,6 +166,17 @@ for r in search_icons("secure login", limit=5):
157
166
  print(r.name, r.score)
158
167
  ```
159
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
+
160
180
  Prefer not to install anything? The [browser version](https://mmacpherson.github.io/python-lucide/)
161
181
  runs the whole pipeline client-side.
162
182
 
@@ -275,7 +295,9 @@ lucide_icon(
275
295
  - `stroke_linecap`: How the ends of strokes are rendered ("round", "butt", "square")
276
296
  - `stroke_linejoin`: How corners are rendered ("round", "miter", "bevel")
277
297
 
278
- **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.
279
301
 
280
302
  **Example:**
281
303
  ```python
@@ -302,19 +324,34 @@ print(f"Available icons: {len(icons)}")
302
324
  print(icons[:5]) # ['activity', 'airplay', 'alarm-check', ...]
303
325
  ```
304
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
+
305
342
  ## Advanced Usage
306
343
 
307
344
  ### Building a Custom Icon Set
308
345
  If you want to include only specific icons or use a different version of Lucide:
309
346
  ```bash
310
347
  # Build with specific icons only
311
- 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
312
349
 
313
350
  # Use a specific Lucide version
314
351
  lucide-db -t 0.350.0 -o lucide-v0.350.0.db
315
352
 
316
353
  # Build from a file listing icon names
317
- echo -e "home\nsettings\nuser" > my-icons.txt
354
+ echo -e "house\nsettings\nuser" > my-icons.txt
318
355
  lucide-db -f my-icons.txt -o my-icons.db
319
356
  ```
320
357
 
@@ -351,6 +388,9 @@ make install-hooks
351
388
 
352
389
  # Run tests
353
390
  make test
391
+
392
+ # Type check with ty (also run by pre-commit)
393
+ uv run ty check
354
394
  ```
355
395
 
356
396
  ### Rebuilding the Icon Database
@@ -376,23 +416,41 @@ make check-lucide-version
376
416
  uv run check-lucide-version
377
417
  ```
378
418
 
379
- **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.
380
435
 
381
436
  ### Release Process
382
- 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.
383
441
 
384
442
  1. **Update version** in `pyproject.toml`:
385
443
  ```bash
386
444
  # Create release branch
387
- git checkout -b release/v0.2.0
445
+ git checkout -b release/vX.Y.Z
388
446
 
389
447
  # Edit pyproject.toml to bump version
390
- # version = "0.2.0"
448
+ # version = "X.Y.Z"
391
449
 
392
450
  # Commit and push
393
451
  git add pyproject.toml
394
- git commit -m "Bump version to 0.2.0"
395
- 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
396
454
  ```
397
455
 
398
456
  2. **Create and merge PR** for the version bump
@@ -400,14 +458,17 @@ This project follows a manual release process:
400
458
  3. **Tag the merged commit on main** with the same version:
401
459
  ```bash
402
460
  git checkout main && git pull
403
- git tag v0.2.0
404
- git push origin v0.2.0
461
+ git tag vX.Y.Z
462
+ git push origin vX.Y.Z
405
463
  ```
406
464
 
407
465
  4. **Automatic publishing**: The `release.yml` workflow checks that the tag
408
466
  matches `pyproject.toml` and is on main, runs CI on the tagged commit,
409
467
  publishes that build to PyPI using trusted publishing, creates the GitHub
410
- 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.
411
472
 
412
473
  ## How It Works
413
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:
@@ -7,13 +7,14 @@ dev = [
7
7
  { include-group = "test-core" },
8
8
  "cairosvg>=2.7.0",
9
9
  "candle-embed>=0.1.0",
10
- "mypy-extensions>=1.0.0",
11
- "mypy>=1.0.0",
10
+ # Only a build requirement, but ty needs it to check hatch_build.py.
11
+ "hatchling>=1.27,<2",
12
12
  "plotly>=5.0.0",
13
13
  "pre-commit>=3.0.0",
14
14
  "pydantic-ai-slim[google]>=1.0.0",
15
15
  "raso>=0.2.0",
16
16
  "ruff>=0.1.0",
17
+ "ty>=1.0.0",
17
18
  "types-setuptools>=80.9.0.20250529",
18
19
  "typing-extensions>=4.1.0"
19
20
  ]
@@ -40,7 +41,7 @@ license = { text = "MIT" }
40
41
  name = "python-lucide"
41
42
  readme = "README.md"
42
43
  requires-python = ">=3.11"
43
- version = "0.5.15"
44
+ version = "0.5.16"
44
45
 
45
46
  [project.optional-dependencies]
46
47
  search = ["cairosvg>=2.7.0", "candle-embed>=0.1.0"]
@@ -63,36 +64,11 @@ exclude = ["*.db"]
63
64
  include = ["src/", "tests/", "build_support.py", "hatch_build.py", "Makefile", "README.md", "LICENSE"]
64
65
 
65
66
  [tool.hatch.build.targets.wheel]
66
- exclude = ["*.db", "*.sql", "src/lucide/data/gemini-icon-descriptions.jsonl", "src/lucide/data/lucide-icon-clusters.json"]
67
+ exclude = ["*.db", "*.sql", "src/lucide/data/gemini-icon-descriptions.jsonl", "src/lucide/data/lucide-icon-clusters.json", "src/lucide/data/lucide-icon-clusters-fit.npy"]
67
68
  packages = ["src/lucide"]
68
69
 
69
- [tool.mypy]
70
- check_untyped_defs = true
71
- disallow_incomplete_defs = true
72
- disallow_untyped_calls = false
73
- disallow_untyped_decorators = true
74
- disallow_untyped_defs = true
75
- ignore_missing_imports = true
76
- no_implicit_optional = true
77
- python_version = "3.11"
78
- show_column_numbers = true
79
- show_error_context = true
80
- strict_optional = true
81
- warn_no_return = true
82
- warn_redundant_casts = true
83
- warn_return_any = true
84
- warn_unreachable = true
85
- warn_unused_configs = true
86
- warn_unused_ignores = true
87
-
88
- [[tool.mypy.overrides]]
89
- check_untyped_defs = true
90
- disallow_incomplete_defs = false
91
- disallow_untyped_defs = false
92
- module = "tests.*"
93
-
94
70
  [tool.pytest.ini_options]
95
- addopts = "--cov=lucide --cov-report=term-missing --cov-report=xml --cov-report=html"
71
+ addopts = "--cov=lucide --cov=lucide_data --cov-report=term-missing --cov-report=xml --cov-report=html"
96
72
  pythonpath = ["src", "."]
97
73
  testpaths = ["tests"]
98
74
  xfail_strict = true
@@ -109,10 +85,12 @@ quote-style = "double"
109
85
 
110
86
  [tool.ruff.lint]
111
87
  ignore = [
88
+ "ANN401", # Any is a deliberate choice where it appears
112
89
  "D203", # one-blank-line-before-class
113
90
  "D213" # multi-line-summary-second-line
114
91
  ]
115
92
  select = [
93
+ "ANN", # flake8-annotations: ty checks annotations, this requires them
116
94
  "E", # pycodestyle errors
117
95
  "F", # pyflakes
118
96
  "I", # isort
@@ -146,12 +124,15 @@ section-order = [
146
124
 
147
125
  [tool.ruff.lint.per-file-ignores]
148
126
  "**/__init__.py" = ["F401"]
149
- "scripts/**/*.py" = ["D", "SLF001", "PLR2004", "PLR0915", "PLC0415", "ERA001", "E741", "C408"]
150
- "tests/**/*.py" = ["D", "SLF001", "PLR2004", "ARG005"]
127
+ "scripts/**/*.py" = ["D", "SLF001", "PLR2004", "PLR0915", "PLC0415", "ERA001", "E741", "C408", "ANN"]
128
+ "tests/**/*.py" = ["D", "SLF001", "PLR2004", "ARG005", "ANN"]
151
129
 
152
130
  [tool.ruff.lint.pydocstyle]
153
131
  convention = "google"
154
132
 
133
+ [tool.ty.environment]
134
+ python-version = "3.11"
135
+
155
136
  [tool.uv]
156
137
  # SQL edits must invalidate uv's cached editable build too.
157
138
  cache-keys = [{ file = "pyproject.toml" }, { file = "hatch_build.py" }, { file = "build_support.py" }, { file = "src/lucide/data/lucide-icons.sql" }]