Getting Started - Amourspirit/live-libreoffice-python GitHub Wiki
- Table of Contents
- Installation
- Running
- Opening LibreOffice in Vs Code
- Starting LibreOffice in the container
- Other Resources
If you only want to run this project as a GitHub Codespace then you can skip this section and go to GitHub Codespaces.
Before you can run this project you will need to install the following prerequisites:
These are cross platform tools and will work on Windows, Mac and Linux; however, how you install them will vary depending on your operating system.
It is recommended to install the Microsoft Remote Development extension pack for Vs Code. This will allow you to run this project as a GitHub Codespace using Visual Studio Code.
Docker must also be configured to use at least 4 cores and 4GB of memory.
Install instructions are out of the scope of this document. See the links above for more information.
Containers are basically docker images that are running. The first time a docker container is started it can take several minutes to build. After the first build the container will start much faster. This project is no exception to this.
After the container is built for the first time you will still need to wait for the containers Vs Code extension to be installed. This can take several minutes. You can see the progress of the installation in the Output
tab of Vs Code.
When you create a new terminal window in Vs Code you can expect to see something like this:
(libreoffice python template-py3.11) root ➜ /workspace/libreoffice_python_app (main)
$
If you don't see a prefixed (libreoffice python template-py3.11)
then Vs Code extensions are most likely still installing. After all of the Vs Code extensions are installed you will see the prefix when creating a new terminal window. The virtual environment is setup and activated by default.
To run this project as a GitHub Codespace you will need to have a GitHub account.
This project is set up as a template. This means github can create a new repository for you based on this template and/or run it as a GitHub Codespace.
To run this project as a GitHub Codespace click the green Use this template
button at the top of the page and then click Open in a Codespace
.
Note that Codespaces are free to use up to a certain point.
At the time of this writing you can use up to 120
core hours per month and 15 gig
of storage for free.
This project is set to use 4
cores. This means you can use this project (combined with any other Codespace projects you run) for 30
hours per month for free.
If you are only running locally then there will be no cost to you. If you are running as a GitHub Codespace then you will be billed for the resources you use over the free limits.
See About billing for GitHub Codespaces, GitHub Codespaces and GitHub Docs for more information.
After prerequisites are installed you can run this project locally by either cloning or downloading this repository. From a template version that you have created or cloned directly from source.
Once the project is on your local machine you can open it in Vs Code. You will be prompted to open the project in a container. Click the Reopen in Container
button. As mentioned above the first time you run this project it will take several minutes to build the container and install the Vs Code extensions.
After the container is built and the Vs Code extensions are installed you can open LibreOffice in Vs Code by clicking the Vs Browser
button in the bottom right side of Vs Code.
The container is running a KasmVNC server that is used to display LibreOffice in Vs Code. The server is running on port 3002
. Locally You can connect to the server using http://localhost:3002
. If you are running as a GitHub Codespace you will need to use the Ports
tab in the GitHub Codespaces window to connect to the server. Copy the port 3002
url and paste it into Vs Browser.
It is not required to use the Vs Browser to run this project. You can also use your normal web browser to connect. In some cases you will acutally want to use your local web browser instead of the Vs Browser. For example, copy and past you may need to use your local web browser.
open_writer_in_vs_browser.webm
Once the container is running and you have navigated to http://localhost:3002
( will be different url on Codespaces ), you should see a black windows with a menu bar at the bottom.
Clicking on a LibreOffice application in the menu bar will start the application. For example, clicking on first icon will start LibreOffice Writer.
Note if for any reason the menu bar is not visible you can run reload
in your local terminal window to reload the menu.
Note that the server also has a terminal window that can be launched from the menu bar. It is not recommended to use this terminal window. Instead use the terminal window in Vs Code, they both connect to the same container.
Of course LibreOffice apps can also be started from python scripts. This can be seen in the examples directory and the hello example in the app
directory.