python-lucide 0.5.5__tar.gz → 0.5.7__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 (42) hide show
  1. python_lucide-0.5.7/.gitignore +191 -0
  2. python_lucide-0.5.7/LICENSE +21 -0
  3. python_lucide-0.5.7/Makefile +124 -0
  4. python_lucide-0.5.5/README.md → python_lucide-0.5.7/PKG-INFO +82 -0
  5. python_lucide-0.5.5/PKG-INFO → python_lucide-0.5.7/README.md +55 -26
  6. python_lucide-0.5.7/build_support.py +95 -0
  7. python_lucide-0.5.7/hatch_build.py +25 -0
  8. python_lucide-0.5.5/pyproject.toml.orig → python_lucide-0.5.7/pyproject.toml +20 -24
  9. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/cli.py +8 -6
  10. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/config.py +1 -1
  11. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/data/gemini-icon-descriptions.jsonl +14 -0
  12. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/data/lucide-icon-clusters.json +4720 -4635
  13. python_lucide-0.5.7/src/lucide/data/lucide-icons.sql +50856 -0
  14. {python_lucide-0.5.5 → python_lucide-0.5.7}/tests/cli_test.py +15 -0
  15. python_lucide-0.5.7/tests/db_source_test.py +167 -0
  16. python_lucide-0.5.7/web/src/App.svelte +231 -0
  17. python_lucide-0.5.7/web/src/app.css +97 -0
  18. python_lucide-0.5.7/web/src/components/DetailPanel.svelte +238 -0
  19. python_lucide-0.5.7/web/src/lib/clusters.ts +52 -0
  20. python_lucide-0.5.7/web/src/lib/embeddings.ts +51 -0
  21. python_lucide-0.5.7/web/src/lib/model-loader.ts +85 -0
  22. python_lucide-0.5.7/web/src/lib/types.ts +38 -0
  23. python_lucide-0.5.7/web/src/main.ts +6 -0
  24. python_lucide-0.5.7/web/src/pages/ExplorePage.svelte +594 -0
  25. python_lucide-0.5.7/web/src/pages/SearchPage.svelte +628 -0
  26. python_lucide-0.5.7/web/src/vite-env.d.ts +2 -0
  27. python_lucide-0.5.5/pyproject.toml +0 -183
  28. python_lucide-0.5.5/src/lucide/data/lucide-icons.db +0 -0
  29. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/__init__.py +0 -0
  30. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/build_clusters.py +0 -0
  31. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/build_search.py +0 -0
  32. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/core.py +0 -0
  33. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/data/__init__.py +0 -0
  34. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/db.py +0 -0
  35. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/dev_utils.py +0 -0
  36. {python_lucide-0.5.5 → python_lucide-0.5.7}/src/lucide/search.py +0 -0
  37. {python_lucide-0.5.5 → python_lucide-0.5.7}/tests/__init__.py +0 -0
  38. {python_lucide-0.5.5 → python_lucide-0.5.7}/tests/build_clusters_test.py +0 -0
  39. {python_lucide-0.5.5 → python_lucide-0.5.7}/tests/build_search_test.py +0 -0
  40. {python_lucide-0.5.5 → python_lucide-0.5.7}/tests/conftest.py +0 -0
  41. {python_lucide-0.5.5 → python_lucide-0.5.7}/tests/core_test.py +0 -0
  42. {python_lucide-0.5.5 → python_lucide-0.5.7}/tests/search_test.py +0 -0
@@ -0,0 +1,191 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ # Claude Code local settings
177
+ .claude/
178
+
179
+ # Beads / Dolt files (added by bd init)
180
+ .dolt/
181
+ *.db
182
+ .beads-credential-key
183
+
184
+ # Web SPA (Svelte/Vite) — source lives on feat/semantic-search-web
185
+ web/node_modules/
186
+ web/public/data/
187
+ web/dist/
188
+ !web/src/lib/
189
+
190
+ # Generated embedding/cluster visualizations
191
+ lucide-*-map.html
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mike Macpherson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,124 @@
1
+ # Makefile for python-lucide development
2
+
3
+ # Variables
4
+ UV_CMD := uv
5
+ PRE_COMMIT_CMD := $(UV_CMD) run pre-commit
6
+ PYTEST_CMD := $(UV_CMD) run pytest
7
+ LUCIDE_CMD := $(UV_CMD) run lucide
8
+
9
+ # Get default Lucide tag from the package's config.py
10
+ PYTHON_CMD_FOR_TAG := $(UV_CMD) run python -c "from lucide.config import DEFAULT_LUCIDE_TAG; print(DEFAULT_LUCIDE_TAG)"
11
+ DEFAULT_LUCIDE_TAG := $(shell $(PYTHON_CMD_FOR_TAG))
12
+ # Allow overriding the tag via make argument, e.g., make db TAG=0.500.0
13
+ TAG ?= $(DEFAULT_LUCIDE_TAG)
14
+ DB_OUTPUT_PATH := src/lucide/data/lucide-icons.db
15
+ SEARCH_DB_OUTPUT_PATH := src/lucide/data/lucide-search.db
16
+ DESCRIPTIONS_JSONL := src/lucide/data/gemini-icon-descriptions.jsonl
17
+ VENV_DIR := .venv
18
+
19
+ # 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
21
+
22
+ # Default target
23
+ default: help
24
+
25
+ help:
26
+ @echo "Makefile for python-lucide development"
27
+ @echo ""
28
+ @echo "Usage: make [target]"
29
+ @echo ""
30
+ @echo "Available targets:"
31
+ @echo " help Show this help message."
32
+ @echo " env Set up the development environment (creates $(VENV_DIR) and installs dependencies)."
33
+ @echo " lucide-db (Re)builds the Lucide icon database into $(DB_OUTPUT_PATH)."
34
+ @echo " Uses TAG=$(TAG). Default TAG is read from src/lucide/config.py (currently $(DEFAULT_LUCIDE_TAG))."
35
+ @echo " Example: make lucide-db TAG=0.520.0"
36
+ @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."
41
+ @echo " lucide-db-full Build icons database + search data."
42
+ @echo " test Run tests using pytest."
43
+ @echo " install-hooks Install pre-commit hooks."
44
+ @echo " update-hooks Update pre-commit hooks to latest version."
45
+ @echo " run-hooks-all-files Run all pre-commit hooks on all files."
46
+ @echo " check-lucide-version Check if Lucide version/artifacts need updating."
47
+ @echo " clean Remove build artifacts, __pycache__, .pytest_cache, .ruff_cache, coverage data, etc."
48
+ @echo " nuke A more thorough clean: runs 'clean', 'uv cache clean', and removes $(VENV_DIR)."
49
+ @echo ""
50
+
51
+ env: $(VENV_DIR)/pyvenv.cfg
52
+ @echo "Installing/updating development dependencies into $(VENV_DIR)..."
53
+ $(UV_CMD) pip install -e ".[dev]"
54
+ @echo "Development environment ready in $(VENV_DIR)/."
55
+
56
+ $(VENV_DIR)/pyvenv.cfg:
57
+ @echo "Creating virtual environment in $(VENV_DIR)/ using $(UV_CMD)..."
58
+ $(UV_CMD) venv $(VENV_DIR)
59
+
60
+ lucide-db:
61
+ @echo "Building Lucide icon database with tag $(TAG) into $(DB_OUTPUT_PATH)..."
62
+ @mkdir -p src/lucide/data # Ensure data directory exists
63
+ $(LUCIDE_CMD) db -o $(DB_OUTPUT_PATH) -t $(TAG) -v
64
+ $(UV_CMD) run --no-sync python build_support.py export
65
+ @echo "Database build complete: $(DB_OUTPUT_PATH)"
66
+
67
+ restore-db:
68
+ $(UV_CMD) run python build_support.py restore
69
+
70
+ describe:
71
+ @echo "Generating icon descriptions..."
72
+ $(LUCIDE_CMD) describe --icons-db $(DB_OUTPUT_PATH) -o $(DESCRIPTIONS_JSONL) -v
73
+
74
+ CLUSTERS_JSON := src/lucide/data/lucide-icon-clusters.json
75
+
76
+ build-search:
77
+ @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
88
+
89
+ lucide-db-full: lucide-db search-data
90
+
91
+ test:
92
+ @echo "Running tests..."
93
+ $(PYTEST_CMD)
94
+
95
+ install-hooks:
96
+ @echo "Installing pre-commit hooks..."
97
+ $(PRE_COMMIT_CMD) install
98
+
99
+ update-hooks:
100
+ @echo "Updating pre-commit hooks..."
101
+ $(PRE_COMMIT_CMD) autoupdate
102
+
103
+ run-hooks-all-files:
104
+ @echo "Running all pre-commit hooks on all files..."
105
+ $(PRE_COMMIT_CMD) run --all-files
106
+
107
+ check-lucide-version:
108
+ @echo "Checking Lucide version and artifact status..."
109
+ $(UV_CMD) run check-lucide-version
110
+
111
+ clean:
112
+ @echo "Cleaning up project..."
113
+ find . -type f -name '*.py[co]' -delete
114
+ find . -type d -name '__pycache__' -exec rm -rf {} +
115
+ rm -rf build/ dist/ .eggs/ *.egg-info/ site/
116
+ rm -rf .pytest_cache/ .ruff_cache/ htmlcov/ .coverage .coverage.* coverage.xml
117
+ rm -f lucide-icons.db # Remove db if built in root by mistake
118
+ @echo "Clean complete."
119
+
120
+ nuke: clean
121
+ @echo "Nuking project (includes 'clean', 'uv cache clean', and removing $(VENV_DIR))..."
122
+ $(UV_CMD) cache clean
123
+ rm -rf $(VENV_DIR)/
124
+ @echo "Nuke complete."
@@ -1,3 +1,30 @@
1
+ Metadata-Version: 2.5
2
+ Name: python-lucide
3
+ Version: 0.5.7
4
+ Summary: A Python package for working with Lucide icons
5
+ Project-URL: Bug Tracker, https://github.com/mmacpherson/python-lucide/issues
6
+ Project-URL: Homepage, https://github.com/mmacpherson/python-lucide
7
+ Project-URL: Source Code, https://github.com/mmacpherson/python-lucide
8
+ Author: Mike Macpherson
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: icons,lucide,sqlite,svg
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Provides-Extra: search
24
+ Requires-Dist: cairosvg>=2.7.0; extra == 'search'
25
+ Requires-Dist: fastembed>=0.4.0; extra == 'search'
26
+ Description-Content-Type: text/markdown
27
+
1
28
  # python-lucide
2
29
 
3
30
  [![CI](https://github.com/mmacpherson/python-lucide/actions/workflows/ci.yml/badge.svg)](https://github.com/mmacpherson/python-lucide/actions/workflows/ci.yml)
@@ -30,6 +57,21 @@ pip install python-lucide
30
57
  ```
31
58
  This installs the package with a pre-built database of all Lucide icons, ready to use immediately.
32
59
 
60
+ Python 3.10–3.14 are supported. **Python 3.15 support is experimental:** core
61
+ rendering, aliases, and SQL-backed package builds pass tests on 3.15 RC2 and have
62
+ a dedicated CI job, but semantic search is currently unsupported because ONNX
63
+ Runtime does not yet provide compatible wheels. Core installation remains
64
+ available on 3.15; full support will be advertised once search is validated too.
65
+ Use Python 3.10–3.14 for search and full development tooling. HDBSCAN and UMAP's
66
+ dependencies affect cluster generation during development, not ordinary searches.
67
+
68
+ To run the core tests on Python 3.15 from a source checkout:
69
+
70
+ ```bash
71
+ uv sync --python 3.15 --no-dev --group test-core
72
+ uv run --no-sync python -m pytest tests/core_test.py tests/db_source_test.py
73
+ ```
74
+
33
75
  ## Quick Start
34
76
  ```python
35
77
  from lucide import lucide_icon
@@ -66,6 +108,13 @@ from the selected upstream release. For example, `lucide_icon("album")` resolves
66
108
  to `square-bookmark`, while keeping the requested name in its CSS classes.
67
109
  Canonical names take precedence over aliases.
68
110
 
111
+ Prefer the current canonical name in new code:
112
+
113
+ ```python
114
+ lucide_icon("square-bookmark") # Preferred name
115
+ lucide_icon("album") # Still works; deprecated upstream alias
116
+ ```
117
+
69
118
  Aliases marked deprecated by Lucide emit a standard Python `DeprecationWarning`
70
119
  with the recommended replacement. Ordinary aliases do not warn. Warnings occur
71
120
  on uncached renders and follow Python's warning filters; they are normally hidden
@@ -73,6 +122,29 @@ outside `__main__`. To see them during development, run your application with
73
122
  `python -W default::DeprecationWarning app.py`. Existing databases without
74
123
  deprecation metadata still resolve aliases without warnings.
75
124
 
125
+ ### Database source and builds
126
+
127
+ The repository tracks `src/lucide/data/lucide-icons.sql`: a deterministic SQL
128
+ export with sorted tables and rows. The generated `.db` is ignored by Git.
129
+ The volatile `created_at` build timestamp is omitted from SQL; the upstream
130
+ version and all icon content, tags, categories, and alias metadata are retained.
131
+
132
+ `uv sync` reconstructs the local database as part of the editable build.
133
+ After changing branches or SQL, run `uv sync` again; SQL changes invalidate uv's
134
+ editable-build cache. `make restore-db` also restores a missing local database
135
+ without downloading icons. Source-only development via `PYTHONPATH=src` can
136
+ bootstrap it with `python build_support.py restore` before importing the package.
137
+
138
+ `make lucide-db TAG=1.45.0` downloads the selected upstream release, rebuilds
139
+ SQLite, and exports the updated SQL for review. Commit the SQL file alongside
140
+ the version and generated search-data changes. Use this target rather than
141
+ editing SQL or committing a generated database.
142
+
143
+ Packaging uses a Hatchling build hook: source distributions contain SQL and the
144
+ build helpers; wheels contain the reconstructed, validated SQLite database.
145
+ Wheel installation and runtime need no reconstruction, writes, downloads, or
146
+ additional dependencies. The separate search database remains a release asset.
147
+
76
148
  ## Semantic Search
77
149
 
78
150
  Find icons by describing what you mean, not what they're called — in English
@@ -94,6 +166,16 @@ pip install "python-lucide[search]"
94
166
  lucide search "celebrate a big achievement"
95
167
  ```
96
168
 
169
+ If your application uses Python 3.15, run the search CLI separately under Python
170
+ 3.14, or use the [browser search](https://mmacpherson.github.io/python-lucide/):
171
+
172
+ ```bash
173
+ uvx --python 3.14 --from "python-lucide[search]" lucide search "payment"
174
+ ```
175
+
176
+ This runs the CLI in a separate environment; calling `search_icons()` from your
177
+ application still requires a supported Python version with the search extra.
178
+
97
179
  <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">
98
180
 
99
181
  In terminals supporting the Kitty graphics protocol (kitty, Ghostty,
@@ -1,29 +1,3 @@
1
- Metadata-Version: 2.3
2
- Name: python-lucide
3
- Version: 0.5.5
4
- Summary: A Python package for working with Lucide icons
5
- Keywords: lucide,icons,svg,sqlite
6
- Author: Mike Macpherson
7
- License: MIT
8
- Classifier: Development Status :: 4 - Beta
9
- Classifier: Intended Audience :: Developers
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Classifier: Programming Language :: Python :: 3.14
17
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
- Requires-Dist: cairosvg>=2.7.0 ; extra == 'search'
19
- Requires-Dist: fastembed>=0.4.0 ; extra == 'search'
20
- Requires-Python: >=3.10
21
- Project-URL: Bug Tracker, https://github.com/mmacpherson/python-lucide/issues
22
- Project-URL: Homepage, https://github.com/mmacpherson/python-lucide
23
- Project-URL: Source Code, https://github.com/mmacpherson/python-lucide
24
- Provides-Extra: search
25
- Description-Content-Type: text/markdown
26
-
27
1
  # python-lucide
28
2
 
29
3
  [![CI](https://github.com/mmacpherson/python-lucide/actions/workflows/ci.yml/badge.svg)](https://github.com/mmacpherson/python-lucide/actions/workflows/ci.yml)
@@ -56,6 +30,21 @@ pip install python-lucide
56
30
  ```
57
31
  This installs the package with a pre-built database of all Lucide icons, ready to use immediately.
58
32
 
33
+ Python 3.10–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.10–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
+ ```
47
+
59
48
  ## Quick Start
60
49
  ```python
61
50
  from lucide import lucide_icon
@@ -92,6 +81,13 @@ from the selected upstream release. For example, `lucide_icon("album")` resolves
92
81
  to `square-bookmark`, while keeping the requested name in its CSS classes.
93
82
  Canonical names take precedence over aliases.
94
83
 
84
+ Prefer the current canonical name in new code:
85
+
86
+ ```python
87
+ lucide_icon("square-bookmark") # Preferred name
88
+ lucide_icon("album") # Still works; deprecated upstream alias
89
+ ```
90
+
95
91
  Aliases marked deprecated by Lucide emit a standard Python `DeprecationWarning`
96
92
  with the recommended replacement. Ordinary aliases do not warn. Warnings occur
97
93
  on uncached renders and follow Python's warning filters; they are normally hidden
@@ -99,6 +95,29 @@ outside `__main__`. To see them during development, run your application with
99
95
  `python -W default::DeprecationWarning app.py`. Existing databases without
100
96
  deprecation metadata still resolve aliases without warnings.
101
97
 
98
+ ### Database source and builds
99
+
100
+ The repository tracks `src/lucide/data/lucide-icons.sql`: a deterministic SQL
101
+ export with sorted tables and rows. The generated `.db` is ignored by Git.
102
+ The volatile `created_at` build timestamp is omitted from SQL; the upstream
103
+ version and all icon content, tags, categories, and alias metadata are retained.
104
+
105
+ `uv sync` reconstructs the local database as part of the editable build.
106
+ After changing branches or SQL, run `uv sync` again; SQL changes invalidate uv's
107
+ editable-build cache. `make restore-db` also restores a missing local database
108
+ without downloading icons. Source-only development via `PYTHONPATH=src` can
109
+ bootstrap it with `python build_support.py restore` before importing the package.
110
+
111
+ `make lucide-db TAG=1.45.0` downloads the selected upstream release, rebuilds
112
+ SQLite, and exports the updated SQL for review. Commit the SQL file alongside
113
+ the version and generated search-data changes. Use this target rather than
114
+ editing SQL or committing a generated database.
115
+
116
+ Packaging uses a Hatchling build hook: source distributions contain SQL and the
117
+ build helpers; wheels contain the reconstructed, validated SQLite database.
118
+ Wheel installation and runtime need no reconstruction, writes, downloads, or
119
+ additional dependencies. The separate search database remains a release asset.
120
+
102
121
  ## Semantic Search
103
122
 
104
123
  Find icons by describing what you mean, not what they're called — in English
@@ -120,6 +139,16 @@ pip install "python-lucide[search]"
120
139
  lucide search "celebrate a big achievement"
121
140
  ```
122
141
 
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
+
123
152
  <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">
124
153
 
125
154
  In terminals supporting the Kitty graphics protocol (kitty, Ghostty,
@@ -0,0 +1,95 @@
1
+ """Convert between reviewable SQL source and the packaged icon database."""
2
+
3
+ import argparse
4
+ import contextlib
5
+ import sqlite3
6
+ import tempfile
7
+ from pathlib import Path
8
+
9
+ DATA_DIR = Path(__file__).parent / "src" / "lucide" / "data"
10
+ SQL_SOURCE = DATA_DIR / "lucide-icons.sql"
11
+ DATABASE = DATA_DIR / "lucide-icons.db"
12
+
13
+
14
+ def _identifier(name: str) -> str:
15
+ return '"' + name.replace('"', '""') + '"'
16
+
17
+
18
+ def export_database(database: Path, source: Path) -> None:
19
+ """Export sorted schema and rows, excluding the volatile build timestamp."""
20
+ lines = [
21
+ "-- Generated by build_support.py export; do not edit by hand.",
22
+ "BEGIN TRANSACTION;",
23
+ ]
24
+ with contextlib.closing(
25
+ sqlite3.connect(f"{database.resolve().as_uri()}?mode=ro", uri=True)
26
+ ) as conn:
27
+ tables = conn.execute(
28
+ "SELECT name, sql FROM sqlite_master WHERE type = 'table' "
29
+ "AND name NOT LIKE 'sqlite_%' ORDER BY name"
30
+ ).fetchall()
31
+ for name, schema in tables:
32
+ lines.append(schema + ";")
33
+ table = _identifier(name)
34
+ columns = [row[1] for row in conn.execute(f"PRAGMA table_info({table})")]
35
+ quoted = ", ".join(_identifier(column) for column in columns)
36
+ values = ", ".join(f"quote({_identifier(column)})" for column in columns)
37
+ # Creation time describes a generated artifact, not the icon content.
38
+ where = " WHERE key != 'created_at'" if name == "metadata" else ""
39
+ for row in conn.execute(
40
+ f"SELECT {values} FROM {table}{where} ORDER BY {quoted}"
41
+ ):
42
+ lines.append(f"INSERT INTO {table} VALUES({','.join(row)});")
43
+ for (schema,) in conn.execute(
44
+ "SELECT sql FROM sqlite_master WHERE type = 'index' AND sql IS NOT NULL "
45
+ "ORDER BY name"
46
+ ):
47
+ lines.append(schema + ";")
48
+ lines.append("COMMIT;")
49
+ source.write_text("\n".join(lines) + "\n", encoding="utf-8", newline="\n")
50
+
51
+
52
+ def restore_database(source: Path, database: Path) -> None:
53
+ """Reconstruct and validate SQLite, replacing the destination only on success."""
54
+ database.parent.mkdir(parents=True, exist_ok=True)
55
+ with tempfile.NamedTemporaryFile(
56
+ dir=database.parent, suffix=".db", delete=False
57
+ ) as tmp:
58
+ temporary = Path(tmp.name)
59
+ try:
60
+ with contextlib.closing(sqlite3.connect(temporary)) as conn:
61
+ conn.executescript(source.read_text(encoding="utf-8"))
62
+ if conn.execute("PRAGMA integrity_check").fetchone() != ("ok",):
63
+ raise ValueError("Reconstructed icon database failed integrity_check")
64
+ if not conn.execute("SELECT 1 FROM icons LIMIT 1").fetchone():
65
+ raise ValueError("Reconstructed icon database contains no icons")
66
+ if not conn.execute(
67
+ "SELECT value FROM metadata WHERE key = 'version'"
68
+ ).fetchone():
69
+ raise ValueError("Reconstructed icon database has no version")
70
+ if conn.execute(
71
+ "SELECT 1 FROM icon_aliases LEFT JOIN icons "
72
+ "ON icons.name = icon_aliases.name WHERE icons.name IS NULL LIMIT 1"
73
+ ).fetchone():
74
+ raise ValueError(
75
+ "Reconstructed icon database contains dangling aliases"
76
+ )
77
+ temporary.chmod(0o644)
78
+ temporary.replace(database)
79
+ finally:
80
+ temporary.unlink(missing_ok=True)
81
+
82
+
83
+ def main() -> None:
84
+ """Export the updated database or restore the local development database."""
85
+ parser = argparse.ArgumentParser(description=__doc__)
86
+ parser.add_argument("action", choices=("export", "restore"))
87
+ args = parser.parse_args()
88
+ if args.action == "export":
89
+ export_database(DATABASE, SQL_SOURCE)
90
+ else:
91
+ restore_database(SQL_SOURCE, DATABASE)
92
+
93
+
94
+ if __name__ == "__main__":
95
+ main()
@@ -0,0 +1,25 @@
1
+ """Materialize the icon database during wheel and editable builds."""
2
+
3
+ import subprocess
4
+ import sys
5
+ from pathlib import Path
6
+ from typing import Any
7
+
8
+ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
9
+
10
+
11
+ class IconDatabaseBuildHook(BuildHookInterface):
12
+ """Ship SQLite in wheels while keeping only SQL in source distributions."""
13
+
14
+ def initialize(self, version: str, build_data: dict[str, Any]) -> None:
15
+ """Validate and include a freshly reconstructed database."""
16
+ if self.target_name != "wheel":
17
+ return
18
+ root = Path(self.root)
19
+ subprocess.run(
20
+ [sys.executable, str(root / "build_support.py"), "restore"], check=True
21
+ )
22
+ if version != "editable":
23
+ build_data["force_include"][
24
+ str(root / "src/lucide/data/lucide-icons.db")
25
+ ] = "lucide/data/lucide-icons.db"