CLI to generate powerpoint slides from simple yaml file[s]
Project description
pptx-builder-from-yaml
CLI to generate powerpoint slides from simple yaml file[s]
- Table of contents
Dependencies to run the CLI
>= python3.4
- python modules
click==7.0.0
- python-pptx==0.6.16
PyYAML==3.13
How to install?
pip install pptx-builder-from-yaml
How does a yaml file look like for generating pptx?
Here is a sample yaml file - Dummy.yml
How to run the CLI?
$ pptx-builder --help
Usage: pptx-builder [OPTIONS] YAML_PATHS...
A powerpoint builder
https://github.com/sukujgrg/pptx-builder-from-yaml
Options:
-pt, --pptx-template-path PATH [required]
-ms, --master-slide-idx INTEGER
[default: 0]
-sl, --slide-layout-idx INTEGER
[default: 6]
-fs, --font-size INTEGER [default: 32]
-fn, --font-name TEXT [default: Calibri]
-ns, --new-slide-path DIRECTORY
[default: /var/folders/jw/vrnt6ysj2v7cm85hqy
n_sk0h0000gq/T]
--validate
--help Show this message and exit.
pptx-builder slide_yamls/ -pt pptx-templates/default.pptx
Notes:
slide_yamls/
is the directory that holdsyaml
files for slides. Theyaml
[s] must follow the schema defined in the code. Here is an exampleyaml
file.slide_yamls
are positional arguments and can accept files and directories. If a positional argument is a directory, it will try to build individualpptx
with eachyaml
files in the same directory.--pptx-template-path | -pt
is expecting either a directory or a pptx file. If it is a directory,pptx-builder
will chose one among all the pptx files found in the same directory. The pptx template file should be without any change to master slide index or in slide layout index. If there are any changes to master slide index or slide layout, you need to pass correspondingint
type to-ms
and-sl
options. A sample pptx template file can seen here pptx-templates.- The default
--new-slide-path
istmp
directory and hence it depends on the operating system you run thepptx-builder
on.
How to validate a yaml and then generate the PPTX?
pptx-builder slide_yamls/dummy.yml -dm master_slides/default.pptx --validate
FAQs
How can I add same footer to all pptx[s] built using the CLI?
Add footer to pptx template file to pass with --pptx-template-path
option
How to get different backgrounds for the generated pptx files using the CLI?
Create different pptx template files with different backgrounds and pass it on to
--pptx-template-path
option. See this video on
creating pptx template file.
How to setup development environment?
git clone https://github.com/sukujgrg/pptx-builder-from-yaml.git
cd pptx-builder-from-yaml
python3 -m venv ~/.pyenv/pptx-builder
source ~/.pyenv/pptx-builder/bin/activate
pip install -r requirements.txt
How to run tests?
cd pptx-builder-from-yaml/
pytest
or
$ tox .
py36 create: /Users/suku/GitHubPublic/pptx-builder-from-yaml/.tox/py36
py36 installdeps: ., pytest
py36 installed: atomicwrites==1.2.1,attrs==18.2.0,Click==7.0,jsonschema==2.6.0,lxml==4.2.5,more-itertools==4.3.0,Pillow==5.3.0,pluggy==0.8.0,pptx-builder-from-yaml==0.0.1,py==1.7.0,pytest==4.0.1,python-pptx==0.6.16,PyYAML==3.13,six==1.12.0,XlsxWriter==1.1.2
py36 runtests: PYTHONHASHSEED='69299544'
py36 runtests: commands[0] | pytest
===================================================== test session starts ======================================================
platform darwin -- Python 3.6.4, pytest-4.0.1, py-1.7.0, pluggy-0.8.0
rootdir: /Users/suku/GitHubPublic/pptx-builder-from-yaml, inifile:
collected 2 items
unit_tests/scripts/test_gen.py .. [100%]
=================================================== 2 passed in 0.29 seconds ===================================================
___________________________________________________________ summary ____________________________________________________________
py36: commands succeeded
congratulations :)
Project details
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
File details
Details for the file pptx-builder-from-yaml-0.0.1.tar.gz
.
File metadata
- Download URL: pptx-builder-from-yaml-0.0.1.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3010c2a20775facc100c4bb468aea325d0cf53a2ed65e5f1b5a25189e04e2e3 |
|
MD5 | 38954b5dcfed603c7f70663bb1891743 |
|
BLAKE2b-256 | 3c7272eca138a585e4577360f4ce0499b60606a297a92adc803f14799ed49ce9 |
File details
Details for the file pptx_builder_from_yaml-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pptx_builder_from_yaml-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6e12d1ba2b9a9b595cfded390bbd4181943e87d3e74287ca3b962d54d1413e8 |
|
MD5 | a982d4220fe5968b9e36fef8699bee97 |
|
BLAKE2b-256 | e9fc07ce1f63169dd5589aedb71cb559522052bda27e33fa7f358b82db72a459 |