iconify for python. Universal icon framework
Project description
pyconify
Python wrapper for the Iconify API.
Iconify is a versatile icon framework that includes 100+ icon sets with more than 100,000 icons from FontAwesome, Material Design Icons, DashIcons, Feather Icons, EmojiOne, Noto Emoji and many other open source icon sets.
Search for icons at: https://icon-sets.iconify.design
Installation
pip install pyconify
Usage
import pyconify
# Info on available collections
collections = pyconify.collections()
# Info on specific collection(s)
details = pyconify.collection("fa", "fa-brands")
# Search for icons
hits = pyconify.search("python")
# Get icon data
data = pyconify.icon_data("fa-brands", "python")
# Get SVG
svg = pyconify.svg("fa-brands", "python")
# Get path to SVG on disk
# will either return cached version, or write to temp file
file_name = pyconify.svg_path("fa-brands", "python")
# Get CSS
css = pyconify.css("fa-brands", "python")
# Keywords
pyconify.keywords('home')
# API version
pyconify.iconify_version()
See details for each of these results in the Iconify API documentation.
cache
While the first fetch of any given SVG will require internet access, pyconfiy caches svgs for faster retrieval and offline use. To see or clear cache directory:
import pyconify
# reveal location of cache
# will be ~/.cache/pyconify on linux and macos
# will be %LOCALAPPDATA%\pyconify on windows
# falls back to ~/.pyconify if none of the above are available
pyconify.get_cache_directory()
# remove the cache directory (and all its contents)
pyconify.clear_cache()
If you'd like to precache a number of svgs, the current recommendation
is to use the svg()
function:
import pyconify
import pyconify
ICONS_TO_STORE = {"mdi:bell", "mdi:bell-off", "mdi:bell-outline"}
for key in ICONS_TO_STORE:
pyconify.svg(key)
Later calls to svg()
will use the cached values.
To specify a custom cache directory, set the PYCONIFY_CACHE
environment
variable to your desired directory.
To disable caching altogether, set the PYCONIFY_CACHE
environment variable to
false
or 0
.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyconify-0.1.3.tar.gz
.
File metadata
- Download URL: pyconify-0.1.3.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cc7f4662d7e12f1b3182d09187f02dfffa36d1a0f2477a8e17ca999abd5bf4b |
|
MD5 | 53bf1f9d4cfd7398da7fd412e76c2df6 |
|
BLAKE2b-256 | 4a3b815fb946fa22c5da10ebc972f201bd22a6de0b4065db1e85235aa191592a |
File details
Details for the file pyconify-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: pyconify-0.1.3-py3-none-any.whl
- Upload date:
- Size: 12.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de1a77713396ef08bc746260fd1f50f8c4902d7eff61636f57044e9de43db737 |
|
MD5 | 1751430cc5dbf2153e1f3d15ff217ffb |
|
BLAKE2b-256 | 8226b7c5cbf72cd547547559005c86d8674df6659273602cc031fae5c1dbd2b0 |