- Install Visual studio code
- Install Python plugin for visual studio
- Install pyenv that helps you manage multiple versions of python side by side
- Install pyenv-virtualenv helps you utilize python virtualenvs inside pyenv
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
- Libre Office only provides python3 system packages, not pip packages.
sudo apt-get install libreoffice python3 libreoffice-script-provider-python uno-libs3 python3-uno
These will install python3 & all other packages required by uno
- Since pyenv manages its own version of python, these system level packages needs to be shared with the pyenv's virtual environment
Create a virtual environment named uno
inside pyenv
If python 3.4 is currently set as the global version in pyenv, you can run the following command.
pyenv virtualenv -p /usr/bin/python3.4 --system-site-packages uno
else run
pyenv virtualenv 3.4.3 -p /usr/bin/python3.4 --system-site-packages uno
This will create a new virtual environment within pyenv called uno
You can test that this is present by running pyenv virtualenvs
- Set
uno
as the default version
pyenv global uno
Now the setup is complete
Creating the project is as simple as
virtualenv uno-playground
You should see your virtualenv project uno-playground
created in the current directory.
Now, lets activate current virtual environment under uno-playground
by running
source bin/activate
Since vscode(Visual studio code) python plugin uses pylint
for linting & autopep8
for formating, lets install them inour virtualenv.
Also, libre office makes interacting with uno
controller easier via unotools package
Lets install all three of them using
pylint autopep8 unotools
Now open the project in Visual studio code & start writing your extensions.
Add the following to your ~/.zshenv
(or) ~/.bash_profile
to activate the virtual environments automatically
export PATH=$PATH:/usr/local/bin
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
- Interface-oriented programming in OpenOffice / LibreOffice
- SCRIPTING LIBREOFFICE WITH PYTHON
- How to use (on Ubuntu 14.04) section here