Unique avatars from dozens of styles — deterministic, customizable, vector-based.
Project description
DiceBear Core (Python)
Deterministic, customizable, vector-based avatars — the Python port of the
DiceBear core engine. It produces byte-identical SVG output to the
JavaScript (@dicebear/core) and PHP (dicebear/core) implementations for the
same style definition and options.
This package contains only the rendering engine. Avatar style definitions
ship separately as language-agnostic JSON via
dicebear-styles (or any other
source of a DiceBear style definition).
Installation
pip install dicebear-core
Requires Python 3.10 or newer.
Usage
import json
from importlib.resources import files
from dicebear import Avatar
# Load a style definition (here from the dicebear-styles package).
style = json.loads(
files("dicebear_styles").joinpath("adventurer.json").read_text("utf-8")
)
avatar = Avatar(style, {"seed": "John"})
avatar.to_string() # the SVG markup
avatar.to_data_uri() # data:image/svg+xml;charset=utf-8,...
avatar.to_json() # {"svg": ..., "options": {...resolved options...}}
Avatar accepts either a raw style-definition dict or a Style instance, plus
an optional options dict:
from dicebear import Avatar, Style
style = Style(style_data)
Avatar(style, {"seed": "John", "size": 128, "backgroundColor": ["b6e3f4"]})
Development
This package lives in the
DiceBear monorepo under
src/python/core. See CONTRIBUTING.md in the repository root for the full
workflow.
cd src/python/core
pip install -e ".[dev]"
ruff check .
mypy src
pytest
The decisive check is tests/test_parity.py, which asserts byte-identical
output against the shared fixtures in tests/fixtures/parity/ (generated from
the JavaScript reference).
License
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dicebear_core-10.1.0rc1.tar.gz.
File metadata
- Download URL: dicebear_core-10.1.0rc1.tar.gz
- Upload date:
- Size: 39.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e80d12dd6c7904f684631948b856f730a65ec5541f4d388ae58bc8696b824cb5
|
|
| MD5 |
dc8afe827579a9cc304f000225896918
|
|
| BLAKE2b-256 |
3aef0269576f339b5f5f42d3d20f0e05f2ea47368b32e47df3e0c9ede75c6c71
|
Provenance
The following attestation bundles were made for dicebear_core-10.1.0rc1.tar.gz:
Publisher:
publish.yml on dicebear/dicebear
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dicebear_core-10.1.0rc1.tar.gz -
Subject digest:
e80d12dd6c7904f684631948b856f730a65ec5541f4d388ae58bc8696b824cb5 - Sigstore transparency entry: 1705888275
- Sigstore integration time:
-
Permalink:
dicebear/dicebear@04ab50dba55888f1933452117f4cb532195940ac -
Branch / Tag:
refs/tags/v10.1.0-rc.1 - Owner: https://github.com/dicebear
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@04ab50dba55888f1933452117f4cb532195940ac -
Trigger Event:
push
-
Statement type:
File details
Details for the file dicebear_core-10.1.0rc1-py3-none-any.whl.
File metadata
- Download URL: dicebear_core-10.1.0rc1-py3-none-any.whl
- Upload date:
- Size: 34.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1609359fbd23b14285ccd17f639b255343c4fce1081c3d7ecde5a8776c98580a
|
|
| MD5 |
bdda4a76cbaef3438db6ece1ab9677fc
|
|
| BLAKE2b-256 |
f524affe30b5045a903c031c810c87071cd25f0b5a9b1e4d966059dcb40920bd
|
Provenance
The following attestation bundles were made for dicebear_core-10.1.0rc1-py3-none-any.whl:
Publisher:
publish.yml on dicebear/dicebear
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dicebear_core-10.1.0rc1-py3-none-any.whl -
Subject digest:
1609359fbd23b14285ccd17f639b255343c4fce1081c3d7ecde5a8776c98580a - Sigstore transparency entry: 1705888490
- Sigstore integration time:
-
Permalink:
dicebear/dicebear@04ab50dba55888f1933452117f4cb532195940ac -
Branch / Tag:
refs/tags/v10.1.0-rc.1 - Owner: https://github.com/dicebear
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@04ab50dba55888f1933452117f4cb532195940ac -
Trigger Event:
push
-
Statement type: