Registry / pyfiglet

pyfiglet

JSON →
library1.0.4pypypi✓ verified 26d ago

pyfiglet is a pure-Python port of FIGlet, a program that generates ASCII art from text. It enables dynamic rendering of text in various ASCII art fonts within Python applications or via the command line interface. The library is actively maintained, with recent releases focusing on bug fixes, type hinting, and Python version compatibility. [1, 3, 9]

pip install pyfiglet
INSTALL
IMPORT
SIG · PYFIGLET
P
pyfiglet
pythonv1.0.4
Install
1.7s avg
Import
65ms
Disk
24MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.068s · 25.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.062s · 26MB
24MB installed
● package 24MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

figlet_format
import pyfiglet result = pyfiglet.figlet_format("Hello")
from pyfiglet import Figlet
While a 'Figlet' class exists, the `pyfiglet.figlet_format` function is the most common and direct way to render text, as shown in most examples. The `Figlet` class might be for more advanced or older use cases. [1, 2, 6, 10]

This quickstart demonstrates how to use `pyfiglet.figlet_format` to convert a string into ASCII art using either the default font or a specified font. It also includes an optional snippet to list all available fonts. [2, 4, 6]

import pyfiglet # Render text using the default font text_default = pyfiglet.figlet_format("Hello, World!") print(text_default) # Render text using a specific font (e.g., 'slant') text_slant = pyfiglet.figlet_format("Pyfiglet", font="slant") print(text_slant) # List available fonts (optional) # Uncomment to see a long list # fig = pyfiglet.Figlet() # print(fig.getFonts())
pyfiglet --version
Debug
Known issues
breakingVersions 1.0.0 and above drop support for Python versions older than 3.9. If you need Python <= 3.7 support, you must use `pyfiglet<1`. Version 1.0.0 was initially yanked due to compatibility issues with older Python versions. [3]
fix
Ensure your Python environment is 3.9 or newer. For older Python versions, explicitly install `pyfiglet<1`.
affects: >=1.0.0
gotchaSome fonts that were previously available in older `pyfiglet` distributions (or the original C `FIGlet`) have been removed due to distribution rights. Users expecting specific fonts might find them missing. [1, 5]
fix
If a desired font is missing, search for 'figlet fonts' online. Some external fonts can be loaded via the command line interface: `pyfiglet -L <font_file>`. [1]
affects: All versions >=1.0.0
gotchaWhen bundling applications with PyInstaller, `pyfiglet` fonts might not be automatically included, leading to `ModuleNotFoundError: No module named 'pyfiglet.fonts'` errors at runtime. [15]
fix
Use the `--collect-all pyfiglet` option with PyInstaller (e.g., `pyinstaller -F --collect-all pyfiglet your_script.py`). [15]
affects: All versions
gotchaThe internal code for kerning, mushing, and rendering is described as "fragile and complex." While this primarily affects contributors modifying the core logic, it suggests potential for unexpected behavior with highly customized inputs or unusual fonts. [1, 5, 8]
fix
For complex or custom rendering scenarios, thorough testing of the output is recommended.
affects: All versions
gotchaAn open issue indicates potential incompatibility where `pyfiglet` might break with `setuptools >= 82`. This could lead to installation or runtime errors in environments with newer `setuptools` versions. [14]
fix
Monitor the GitHub issue tracker for a resolution. If encountered, try pinning an older `setuptools` version or isolating `pyfiglet` in a dedicated virtual environment.
affects: Potentially current and future versions with `setuptools >= 82`
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyfiglet'
The pyfiglet library is not installed in the Python environment being used, or the Python interpreter cannot find it.
fix
Run `pip install pyfiglet` in your terminal to install the library, ensuring you are in the correct Python environment if you use virtual environments.
ImportError: cannot import name 'Figlet' from partially initialized module 'pyfiglet' (most likely due to a circular import)
This error typically occurs when your Python script file is named `pyfiglet.py` or `figlet.py`, causing a name collision with the installed library.
fix
Rename your Python script file to something other than `pyfiglet.py` or `figlet.py` (e.g., `my_ascii_art.py`) to avoid conflicting with the library's module name.
TypeError: Figlet.setFont() takes 1 positional argument but 2 were given
The `setFont` method expects the font name to be passed as a keyword argument (`font='font_name'`), not as a positional argument.
fix
Pass the font name using the `font` keyword argument: `figlet.setFont(font='slant')` or `figlet.setFont(font=random.choice(figfonts))`.
ModuleNotFoundError: No module named 'pyfiglet.fonts' (when using PyInstaller)
When packaging an application with PyInstaller, the `pyfiglet` font resources are not automatically bundled, leading to a missing module error at runtime in the compiled executable.
fix
Include the `pyfiglet.fonts` module explicitly using PyInstaller's `--hidden-import` option: `pyinstaller --hidden-import pyfiglet.fonts your_script.py`.
pyfiglet.FontNotFound: <font_name>
The specified font name does not exist or is not available within the `pyfiglet` library's font collection. Some fonts were also removed in newer versions due to licensing issues.
fix
Verify the font name is correct and available by checking `pyfiglet.Figlet().getFonts()` or choose a standard font. If a specific removed font is desired, you may need to find and install it manually.
Upgrade
Version history
1.0.4latest on PyPI · released Aug 15, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
pyfiglet — pip install pyfiglet · libregistry