python-lucide 0.5.5__tar.gz → 0.5.6__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 (43) hide show
  1. python_lucide-0.5.6/.beads/README.md +81 -0
  2. python_lucide-0.5.6/.gitignore +191 -0
  3. python_lucide-0.5.6/LICENSE +21 -0
  4. python_lucide-0.5.6/Makefile +124 -0
  5. python_lucide-0.5.5/README.md → python_lucide-0.5.6/PKG-INFO +57 -0
  6. python_lucide-0.5.5/PKG-INFO → python_lucide-0.5.6/README.md +30 -26
  7. python_lucide-0.5.6/build_support.py +95 -0
  8. python_lucide-0.5.6/hatch_build.py +25 -0
  9. python_lucide-0.5.5/pyproject.toml.orig → python_lucide-0.5.6/pyproject.toml +18 -22
  10. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/cli.py +8 -6
  11. python_lucide-0.5.6/src/lucide/data/lucide-icons.sql +50374 -0
  12. {python_lucide-0.5.5 → python_lucide-0.5.6}/tests/cli_test.py +15 -0
  13. python_lucide-0.5.6/tests/db_source_test.py +167 -0
  14. python_lucide-0.5.6/web/src/App.svelte +231 -0
  15. python_lucide-0.5.6/web/src/app.css +97 -0
  16. python_lucide-0.5.6/web/src/components/DetailPanel.svelte +238 -0
  17. python_lucide-0.5.6/web/src/lib/clusters.ts +52 -0
  18. python_lucide-0.5.6/web/src/lib/embeddings.ts +51 -0
  19. python_lucide-0.5.6/web/src/lib/model-loader.ts +85 -0
  20. python_lucide-0.5.6/web/src/lib/types.ts +38 -0
  21. python_lucide-0.5.6/web/src/main.ts +6 -0
  22. python_lucide-0.5.6/web/src/pages/ExplorePage.svelte +594 -0
  23. python_lucide-0.5.6/web/src/pages/SearchPage.svelte +628 -0
  24. python_lucide-0.5.6/web/src/vite-env.d.ts +2 -0
  25. python_lucide-0.5.5/pyproject.toml +0 -183
  26. python_lucide-0.5.5/src/lucide/data/lucide-icons.db +0 -0
  27. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/__init__.py +0 -0
  28. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/build_clusters.py +0 -0
  29. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/build_search.py +0 -0
  30. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/config.py +0 -0
  31. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/core.py +0 -0
  32. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/data/__init__.py +0 -0
  33. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/data/gemini-icon-descriptions.jsonl +0 -0
  34. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/data/lucide-icon-clusters.json +0 -0
  35. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/db.py +0 -0
  36. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/dev_utils.py +0 -0
  37. {python_lucide-0.5.5 → python_lucide-0.5.6}/src/lucide/search.py +0 -0
  38. {python_lucide-0.5.5 → python_lucide-0.5.6}/tests/__init__.py +0 -0
  39. {python_lucide-0.5.5 → python_lucide-0.5.6}/tests/build_clusters_test.py +0 -0
  40. {python_lucide-0.5.5 → python_lucide-0.5.6}/tests/build_search_test.py +0 -0
  41. {python_lucide-0.5.5 → python_lucide-0.5.6}/tests/conftest.py +0 -0
  42. {python_lucide-0.5.5 → python_lucide-0.5.6}/tests/core_test.py +0 -0
  43. {python_lucide-0.5.5 → python_lucide-0.5.6}/tests/search_test.py +0 -0
@@ -0,0 +1,81 @@
1
+ # Beads - AI-Native Issue Tracking
2
+
3
+ Welcome to Beads! This repository uses **Beads** for issue tracking - a modern, AI-native tool designed to live directly in your codebase alongside your code.
4
+
5
+ ## What is Beads?
6
+
7
+ Beads is issue tracking that lives in your repo, making it perfect for AI coding agents and developers who want their issues close to their code. No web UI required - everything works through the CLI and integrates seamlessly with git.
8
+
9
+ **Learn more:** [github.com/steveyegge/beads](https://github.com/steveyegge/beads)
10
+
11
+ ## Quick Start
12
+
13
+ ### Essential Commands
14
+
15
+ ```bash
16
+ # Create new issues
17
+ bd create "Add user authentication"
18
+
19
+ # View all issues
20
+ bd list
21
+
22
+ # View issue details
23
+ bd show <issue-id>
24
+
25
+ # Update issue status
26
+ bd update <issue-id> --claim
27
+ bd update <issue-id> --status done
28
+
29
+ # Sync with Dolt remote
30
+ bd dolt push
31
+ ```
32
+
33
+ ### Working with Issues
34
+
35
+ Issues in Beads are:
36
+ - **Git-native**: Stored in Dolt database with version control and branching
37
+ - **AI-friendly**: CLI-first design works perfectly with AI coding agents
38
+ - **Branch-aware**: Issues can follow your branch workflow
39
+ - **Always in sync**: Auto-syncs with your commits
40
+
41
+ ## Why Beads?
42
+
43
+ ✨ **AI-Native Design**
44
+ - Built specifically for AI-assisted development workflows
45
+ - CLI-first interface works seamlessly with AI coding agents
46
+ - No context switching to web UIs
47
+
48
+ 🚀 **Developer Focused**
49
+ - Issues live in your repo, right next to your code
50
+ - Works offline, syncs when you push
51
+ - Fast, lightweight, and stays out of your way
52
+
53
+ 🔧 **Git Integration**
54
+ - Automatic sync with git commits
55
+ - Branch-aware issue tracking
56
+ - Dolt-native three-way merge resolution
57
+
58
+ ## Get Started with Beads
59
+
60
+ Try Beads in your own projects:
61
+
62
+ ```bash
63
+ # Install Beads
64
+ curl -sSL https://raw.githubusercontent.com/steveyegge/beads/main/scripts/install.sh | bash
65
+
66
+ # Initialize in your repo
67
+ bd init
68
+
69
+ # Create your first issue
70
+ bd create "Try out Beads"
71
+ ```
72
+
73
+ ## Learn More
74
+
75
+ - **Documentation**: [github.com/steveyegge/beads/docs](https://github.com/steveyegge/beads/tree/main/docs)
76
+ - **Quick Start Guide**: Run `bd quickstart`
77
+ - **Examples**: [github.com/steveyegge/beads/examples](https://github.com/steveyegge/beads/tree/main/examples)
78
+
79
+ ---
80
+
81
+ *Beads: Issue tracking that moves at the speed of thought* ⚡
@@ -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.6
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)
@@ -66,6 +93,13 @@ from the selected upstream release. For example, `lucide_icon("album")` resolves
66
93
  to `square-bookmark`, while keeping the requested name in its CSS classes.
67
94
  Canonical names take precedence over aliases.
68
95
 
96
+ Prefer the current canonical name in new code:
97
+
98
+ ```python
99
+ lucide_icon("square-bookmark") # Preferred name
100
+ lucide_icon("album") # Still works; deprecated upstream alias
101
+ ```
102
+
69
103
  Aliases marked deprecated by Lucide emit a standard Python `DeprecationWarning`
70
104
  with the recommended replacement. Ordinary aliases do not warn. Warnings occur
71
105
  on uncached renders and follow Python's warning filters; they are normally hidden
@@ -73,6 +107,29 @@ outside `__main__`. To see them during development, run your application with
73
107
  `python -W default::DeprecationWarning app.py`. Existing databases without
74
108
  deprecation metadata still resolve aliases without warnings.
75
109
 
110
+ ### Database source and builds
111
+
112
+ The repository tracks `src/lucide/data/lucide-icons.sql`: a deterministic SQL
113
+ export with sorted tables and rows. The generated `.db` is ignored by Git.
114
+ The volatile `created_at` build timestamp is omitted from SQL; the upstream
115
+ version and all icon content, tags, categories, and alias metadata are retained.
116
+
117
+ `uv sync` reconstructs the local database as part of the editable build.
118
+ After changing branches or SQL, run `uv sync` again; SQL changes invalidate uv's
119
+ editable-build cache. `make restore-db` also restores a missing local database
120
+ without downloading icons. Source-only development via `PYTHONPATH=src` can
121
+ bootstrap it with `python build_support.py restore` before importing the package.
122
+
123
+ `make lucide-db TAG=1.45.0` downloads the selected upstream release, rebuilds
124
+ SQLite, and exports the updated SQL for review. Commit the SQL file alongside
125
+ the version and generated search-data changes. Use this target rather than
126
+ editing SQL or committing a generated database.
127
+
128
+ Packaging uses a Hatchling build hook: source distributions contain SQL and the
129
+ build helpers; wheels contain the reconstructed, validated SQLite database.
130
+ Wheel installation and runtime need no reconstruction, writes, downloads, or
131
+ additional dependencies. The separate search database remains a release asset.
132
+
76
133
  ## Semantic Search
77
134
 
78
135
  Find icons by describing what you mean, not what they're called — in English
@@ -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)
@@ -92,6 +66,13 @@ from the selected upstream release. For example, `lucide_icon("album")` resolves
92
66
  to `square-bookmark`, while keeping the requested name in its CSS classes.
93
67
  Canonical names take precedence over aliases.
94
68
 
69
+ Prefer the current canonical name in new code:
70
+
71
+ ```python
72
+ lucide_icon("square-bookmark") # Preferred name
73
+ lucide_icon("album") # Still works; deprecated upstream alias
74
+ ```
75
+
95
76
  Aliases marked deprecated by Lucide emit a standard Python `DeprecationWarning`
96
77
  with the recommended replacement. Ordinary aliases do not warn. Warnings occur
97
78
  on uncached renders and follow Python's warning filters; they are normally hidden
@@ -99,6 +80,29 @@ outside `__main__`. To see them during development, run your application with
99
80
  `python -W default::DeprecationWarning app.py`. Existing databases without
100
81
  deprecation metadata still resolve aliases without warnings.
101
82
 
83
+ ### Database source and builds
84
+
85
+ The repository tracks `src/lucide/data/lucide-icons.sql`: a deterministic SQL
86
+ export with sorted tables and rows. The generated `.db` is ignored by Git.
87
+ The volatile `created_at` build timestamp is omitted from SQL; the upstream
88
+ version and all icon content, tags, categories, and alias metadata are retained.
89
+
90
+ `uv sync` reconstructs the local database as part of the editable build.
91
+ After changing branches or SQL, run `uv sync` again; SQL changes invalidate uv's
92
+ editable-build cache. `make restore-db` also restores a missing local database
93
+ without downloading icons. Source-only development via `PYTHONPATH=src` can
94
+ bootstrap it with `python build_support.py restore` before importing the package.
95
+
96
+ `make lucide-db TAG=1.45.0` downloads the selected upstream release, rebuilds
97
+ SQLite, and exports the updated SQL for review. Commit the SQL file alongside
98
+ the version and generated search-data changes. Use this target rather than
99
+ editing SQL or committing a generated database.
100
+
101
+ Packaging uses a Hatchling build hook: source distributions contain SQL and the
102
+ build helpers; wheels contain the reconstructed, validated SQLite database.
103
+ Wheel installation and runtime need no reconstruction, writes, downloads, or
104
+ additional dependencies. The separate search database remains a release asset.
105
+
102
106
  ## Semantic Search
103
107
 
104
108
  Find icons by describing what you mean, not what they're called — in English
@@ -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"