Configuration

Contents

Configuration#

PyBloqs has a few elements that can be configured locally:

  • Email sending

  • Public html directory (where Block.publish() will save output)

  • Temporary html directory (where Block.show() will save output)

  • PDF conversion backend

  • Image conversion backend

The defaults are set in pybloqs/config.py . Any entry in the dict user_config in config.py can be overwritten with a local file in the user’s home directory at ~/.pybloqs.cfg . The format of .pybloqs.cfg is YAML, so changing the PDF conversion backend to Chrome-headless would be done with the following line:

pdf_converter: chrome_headless

Email#

The config file allows you to setup a call setup and login sequence against an smtplib.SMTP object. The following works for Google gmail - more details here.

smtp_kwargs:
  host: smtp.gmail.com
  port: 587
smtp_pre_login_calls:
- !!python/tuple
  - ehlo
  - {}
- !!python/tuple
  - starttls
  - {}
- !!python/tuple
  - ehlo
  - {}
smtp_login:
  user: me@gmail.com
  password: a_secret
public_dir: /tmp
tmp_html_dir: /tmp
user_email_address: me@gmail.com