Type annotations for LibreOffice API
Project description
This project allow typings for the full LibreOffice API
WHY
Working with LibreOffice API in a modern IDE such as Visual Studio Code there is not type support for LibreOffice API This project solves that Issue.
VERSION
This package is for Version 7.2 of LibreOffice API.
Installation
PIP
types-unopy PyPI
$ pip install types-unopy
USAGE
Not all object in LibreOffice API can be directly imported.
For instance if you need to import SheetCellRange so it can be used as type the following will fail at runtime.
>>> from com.sun.star.sheet import SheetCellRange
ImportError: No module named 'com' (or 'com.sun.star.sheet.SheetCellRange' is unknown)
The solution is to use TYPE_CHECKING.
>>> from typing import TYPE_CHECKING
>>> if TYPE_CHECKING:
... from com.sun.star.sheet import SheetCellRange
...
# anything inside of TYPE_CHECKING block is ignore at runtime.
Known Issues
Enums
There is no enum classes in API only enum members.
To acces the enum members they must be imported directly.
For example to import com.sun.star.beans.PropertyState.DIRECT_VALUE
If you need the behaviour of regular Enum Classes consider using ooouno
>>> from com.sun.star.beans import PropertyState
ImportError: No module named 'com' (or 'com.sun.star.beans.PropertyState' is unknown
>>>
>>> from com.sun.star.beans.PropertyState import DIRECT_VALUE
>>> DIRECT_VALUE.value
'DIRECT_VALUE'
>>>
>>> type(DIRECT_VALUE)
<class 'uno.Enum'>
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 types_unopy-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 185d03105c29da0644116861e81a63aa66ae4168f6a1b4b30060d54315887290 |
|
MD5 | e5df8dc0e9dcf44cdb9c5735730976e6 |
|
BLAKE2b-256 | 9bcd166a4322a78b23af61aab07ce8b5e206b39e4ea314eb08fb53513811709b |