Powerful rendering of your source code.
Project description
About
Dali (Dalí) - Powerful rendering of your source code.
It can render any* source code into an image.
Image: httpie source code (Dali v.0.0.1)
arguments:
window_controls=True
,background='#576574'
Why Dali?
Dali is writen in Python language and has a high speed enough. Requires no network connection or specific operation system (Microsoft Windows has not been tested :upside_down_face:).
Dali uses Pygments for syntax highlighter and Pillow-SIMD for rendering. Pygments is used in GitHub on Jupyter Notebook pages & GitHub API pages.
You can use it in your project and create a great image of your code.
At the moment Dali is actively developed.
Examples
from file
from main import Dali
instance = Dali("<path to save image>/image.png", window_controls=True, background='#576574')
instance.from_file("<path to source code file>")
from string
from main import Dali
instance = Dali("<path to save image>/image.png", window_controls=True, background='#576574')
with open("<path to source code file>", 'r') as file:
code = file.read()
instance.from_string(code)
Install
pip install dali_renderer
pip uninstall pillow
CC="cc -mavx2" pip install -U --force-reinstall pillow-simd
Features
- Change styles:
- Change fonts:
- Adding window decorations (as in the screenshot)
- Adding additional background (as in the screenshot)
- And also use it in your source code as a python module :wink:
- ...
Contributing
pip install hatch
git clone git@github.com:foozzi/Dali.git && cd ./Dali
Test
hatch run test
Lint
hatch run lint:typing # mypy
Formatting
hatch run lint:fmt # black, ruff
Build
hatch clean && hatch build
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
Hashes for dali_renderer-1.0.0b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5145fc4e250edc3bd6e04a0a7f62b26d608486c743670d5b8b782dd914b6823e |
|
MD5 | 7a97bca2d4b528d7c303745f130dff98 |
|
BLAKE2b-256 | 6363b0ae4a03f6ec022c7a4e1c96d8621cbca59515e37d9718785fed210f9701 |