Skip to main content

Interfaces and classes for LibreOffice (uno)

Project description

License Apache PyPI - Python Version PyPI - Wheel Github

ooouno

ooouno is a library of all (more than 4300) classes, typings and types for the LibreOffice API.

ooouno is for version 7.4 of LibreOffice API.

More about LibreOffice.

Docs

Read the docs here

Installation

CONDA

ooouno on Anaconda

$ conda install -c conda-forge ooouno
For LibreOffice <= 7.3

$ conda install -c conda-forge "ooouno>=0.2.5, <1.0"

For LibreOffice <= 7.2

$ conda install -c conda-forge "ooouno<0.2"

PIP

ooouno PyPI

$ pip install ooouno
For LibreOffice <= 7.3

pip install "ooouno>= 0.2.5, < 1.0"

For LibreOffice <= 7.2

pip install "ooouno<0.2"

Usage

All class found in LO API are recreated in this library.

For instance:
from ooo.dyn.style.line_spacing import LineSpacing is equivalent to
from com.sun.star.style import LineSpacing

Namespace

There are four namespaces representing LO API in this library.

ooo.lo

Namespace ooo.lo contains all static python classes. The format is
ooo.lo.<ns>.<snake_case_name>.<PascalCaseName>
from ooo.lo.uno.x_interface import XInterface

def foo(input:str) -> XInterface: ...

ooo.dyn

Namespace ooo.dyn contains static and dynamic classes depending on class type. The format is ooo.dyn.<ns>.<snake_case_name>.<PascalCaseName>

This namespace has dynamic classes that are changed at runtime. For classes that are dynamic are fully or partially replaced by UNO version at runtime.

This allows for typings while in design time (working in IDE) and at runtime UNO classes are created instead.

>>> from ooo.dyn.style.line_spacing import LineSpacing as DynLineSpacing
>>> from ooo.lo.style.line_spacing import LineSpacing as LoLineSpacing
>>> dyn_lns = DynLineSpacing(Height=10, Mode=3)
>>> lo_lns = LoLineSpacing(Height=10, Mode=3)
>>> assert dyn_lns.Height == 10
>>> assert dyn_lns.Mode == 3
>>> type(dyn_lns).__name__
'com.sun.star.style.LineSpacing'
>>> type(lo_lns).__name__
'LineSpacing'

ooo.csslo

As of version 2.0.0 the ooo.csslo namespace is deprecated. Use the ooo.lo namespace instead.

Namespace ooo.csslo contains static classes as LO API style imports.
The format is ooo.csslo.<ns>.<PascalCaseName>

When importing from ooo.csslo all classes in that namespace are also loaded. Under some circumstances this may not be desired. Such as packaging with stickytape.

>>> from ooo.lo.style.line_spacing import LineSpacing as LoLineSpacing
>>> from ooo.csslo.style import LineSpacing as CssLineSpacing
>>> LoLineSpacing is CssLineSpacing
True
>>> ls = CssLineSpacing()
>>> type(ls).__name__
'LineSpacing'

ooo.cssdyn

As of version 2.0.0 the ooo.cssdyn namespace is deprecated. Use the ooo.dyn namespace instead.

Namespace ooo.cssdyn contains static and dynamic classes depending on class type as LO API style imports.

When importing from ooo.cssdyn all classes in that namespace are also loaded. Under some circumstances this may not be desired. Such as packaging with stickytape.

>>> from ooo.dyn.style.line_spacing import LineSpacing as DynLineSpacing
>>> from ooo.cssdyn.style import LineSpacing as CssLineSpacing
>>> DynLineSpacing is CssLineSpacing
True
>>> ls = CssLineSpacing()
>>> type(ls).__name__
'com.sun.star.style.LineSpacing'

Generally speaking

When using ooo as typings then import from ooo.lo or ooo.csslo.

When using ooo interactively such as creating struts, enums, singletons, const classes then import from ooo.dyn or ooo.cssdyn.

Development

Development environment is configured using poetry.

It is recommended to install virtual environment locally.

To Configure poetry to install virtual environment in local folder:

poetry config virtualenvs.in-project true

After virtual environment has been set up.

Linux/Mac

Link UNO files into virtual environment.

oooenv cmd-link -a

Windows

Run toggle command to set virtual environment.

oooenv env -t

See Also

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

ooouno-2.1.1.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ooouno-2.1.1-py3-none-any.whl (9.9 MB view details)

Uploaded Python 3

File details

Details for the file ooouno-2.1.1.tar.gz.

File metadata

  • Download URL: ooouno-2.1.1.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.5 Linux/5.19.0-42-generic

File hashes

Hashes for ooouno-2.1.1.tar.gz
Algorithm Hash digest
SHA256 bb3eca957bb87b81eb7ee13b55d9b96510bb38eceb9ecdb9a45ed43cf58a432e
MD5 47f4c4e5d5de9a662d710037f5669517
BLAKE2b-256 7e825ad223ded6521370a3233d1e8e4844e971e427c8af0aefb6af7e527edb69

See more details on using hashes here.

File details

Details for the file ooouno-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: ooouno-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.5 Linux/5.19.0-42-generic

File hashes

Hashes for ooouno-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14874e49d41f320788de5ff84418ff9d0b277f66bd72e55482f2204545c8c3a2
MD5 e903cba0b537b77dc03f198e28ba611c
BLAKE2b-256 d221454c71fd5aa66527e729700e0cc6171ca76f05460991ca5d9dc3071b38a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page