{"id":9210,"library":"pyconify","title":"pyconify","description":"pyconify is a Python wrapper for the universal Iconify API, providing access to over 100 icon sets and more than 100,000 icons from popular collections like FontAwesome and Material Design Icons. It allows fetching icon data, SVGs, and CSS, and includes caching for faster retrieval. The library is actively maintained, with its current version being 0.2.1, and receives irregular but ongoing updates.","status":"active","version":"0.2.1","language":"en","source_language":"en","source_url":"https://github.com/pyapp-kit/pyconify","tags":["icon","svg","ui","graphics","iconify","api-wrapper"],"install":[{"cmd":"pip install pyconify","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Used for making HTTP requests to the Iconify API to fetch icon data.","package":"requests","optional":false}],"imports":[{"note":"While specific functions can be imported, the common pattern in examples is to import the `pyconify` module and call its methods (e.g., `pyconify.icon_data`).","wrong":"from pyconify import icon_data # or similar direct function import","symbol":"pyconify","correct":"import pyconify"}],"quickstart":{"code":"import pyconify\nimport os\n\n# Note: pyconify makes network requests to fetch icon data.\n# Initial fetches require internet access. Data is then cached.\n\n# Get info on available collections (requires network access initially)\n# collections = pyconify.collections()\n# print(f\"Available collections: {list(collections.keys())[:5]}...\")\n\n# Search for icons (e.g., 'python')\nhits = pyconify.search(\"python\")\nif hits:\n    print(f\"Found {len(hits)} icons for 'python'. First one: {hits[0]['icon']}\")\n    # Get SVG for a specific icon (e.g., 'fa-brands:python')\n    icon_name = 'fa-brands:python'\n    svg_data = pyconify.svg(icon_name)\n    print(f\"SVG for {icon_name} (first 100 chars):\\n{svg_data[:100]}...\")\n\n    # Get path to cached SVG on disk\n    # This will either return a path to an existing cached file or write to a temp file.\n    svg_file_path = pyconify.svg_path(icon_name)\n    print(f\"SVG file path for {icon_name}: {svg_file_path}\")\n\n    # You can configure the cache directory using an environment variable\n    # os.environ['PYCONIFY_CACHE'] = '/path/to/custom/cache'\n    # To disable caching:\n    # os.environ['PYCONIFY_CACHE'] = '0'\n\n# Example of clearing the cache\n# pyconify.clear_cache()\n# print(\"Cache cleared.\")","lang":"python","description":"This quickstart demonstrates how to import `pyconify`, search for icons, retrieve SVG data for a specific icon, and get the local file path for a cached SVG. It also highlights the caching mechanism and how to configure or clear it."},"warnings":[{"fix":"Be aware that initial icon fetches require network access. To pre-cache icons for offline deployment, explicitly call `pyconify.svg()` for all desired icons during application build or setup. To manage caching, set the `PYCONIFY_CACHE` environment variable to a custom path or to `0` or `false` to disable caching entirely.","message":"pyconify caches fetched SVGs for offline use and faster retrieval. While convenient, this means the first fetch of any new icon will require an internet connection.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For applications bundled with PyInstaller or similar tools, it is recommended to pre-fetch all required icons using `pyconify.svg()` and ensure they are included as data files in the application bundle. This is an active area of development, as noted in GitHub issues.","message":"Bundling `pyconify` with tools like PyInstaller for standalone applications can be tricky, as the library relies on 'last-minute icon lookups and caching'.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Add `import pyconify` at the beginning of your script or function where `pyconify` is used.","cause":"The `pyconify` module was used without being imported first.","error":"NameError: name 'pyconify' is not defined"},{"fix":"Verify the icon name and collection prefix (e.g., `fa-brands:python`). Use `pyconify.search()` to find available icons or consult the Iconify website (`https://icon-sets.iconify.design`) to confirm valid icon IDs.","cause":"Attempted to retrieve data for an icon that does not exist or whose name is misspelled in the specified collection. While not an explicit error string found, this is common for libraries retrieving data by key from a remote source.","error":"KeyError: 'icon_name' (e.g., 'KeyError: 'fa-brands:nonexistent-icon'')"},{"fix":"Check your internet connection and proxy settings. Ensure no firewall is blocking access to `https://api.iconify.design`. If the problem persists, the Iconify API might be experiencing downtime, or your environment might have stricter network policies. Consider pre-caching icons if network reliability is a concern.","cause":"The application failed to connect to the Iconify API due to network issues, firewall restrictions, or the API being temporarily unavailable. `pyconify` relies on the `requests` library for network communication.","error":"requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))"}]}