Quick Start

Install oooscript into your project.

pip install oooscript

Create an .env file in your root directory. File can be empty. See Environment.

Create config.json in your projects source directory. Add the necessary configuration to config.json. See Configuration.

Build your script.

Example command:

oooscript compile --pyz-out --embed --config "src/config.json" --embed-doc "src/some-doc.odt"

Example make file:

# Makefile for building the oooscript project

help:
    @echo "Run make build to compile into 'build/python_sample' folder."

.PHONY: build help

build:
    oooscript compile --pyz-out --embed --config "$(PWD)/src/config.json" --embed-doc "$(PWD)/src/some-doc.odt" --build-dir "$(PWD)/data"
    rm -f "$(PWD)/data/*.py"
    rm -f "$(PWD)/data/*.pyz"

For an example see MESSAGE BOX of LibreOffice Python UNO Examples.

Note

When building it is recommended to use the --pyz-out option. This will create a binary .pyz file that is packages with the main .py or your script. The .pyz file is the main script and the .py file is the loader.

The .pyz file is faster and more efficient than the embedding libraries directly in the .py file. Excluding --pyz-out will embed the libraries directly into the .py file just like version previous to 2.0.0.