-
-
Notifications
You must be signed in to change notification settings - Fork 9
Development
I personally use Visual Studio Code, but you can use whatever your favorite is. To run and build using Flatpak on VS Code, consider installing Flatpak extension.
Execute the following commands in the terminal to install the dependencies (on Fedora):
sudo dnf install flatpak flatpak-builder --assumeyesSelect the com.wittara.studio.Devel.json manifest file by typing in the command palette (F1 or Ctrl+Shift+P) and running Flatpak: Select or Change Active Manifest.
Create the run.sh file in the build-aux/ directory:
cp build-aux/run.sh.example build-aux/run.shTo build the plugins, we need the rustup and maturin installed:
sudo dnf install rustup --assumeyes
rustup-init
. "$HOME/.cargo/env"
pip install maturinBuilding all plugins is simply a matter of running the following command:
chmod +x build-aux/build.sh
./build-aux/build.shFinally, type in the command palette and run Flatpak: Build and Run or simply hit Ctrl+Alt+B.
To override some environment variables or to add command-line arguments to the application, you can update the build-aux/run.sh file, for example:
#!/bin/bash
GTK_DEBUG=interactive RUST_BACKTRACE=full POLARS_VERBOSE=1 WDS_DEBUG=1 witt-data-studio "$@"With debugpy in Visual Studio Code, you'll need to setup .vscode/launch.json for example:
{
"configurations": [
{
"name": "Python Debugger: Remote Attach",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}/src",
"remoteRoot": "/app/share/witt-data-studio/witt_data_studio"
}
]
}
]
}Set the environment variable to WDS_DEBUG=2 to wait for the debugger after running the application. Press F5 to launch it and you're ready to debug.
GTK has a variety of environment variables we can set to help with debugging GTK application.
If you're using a Python language server, you may want to install the requirements. For better dependency management, it's recommended to create a virtual environment rather than installing packages globally:
python -m venv .pyenv
source .pyenv/bin/activate
pip install -r build-aux/requirements-devel.txtTo add new dependencies using pip to the flatpak-builder manifest json file, you can use the flatpak-pip-generator. Either adding the reference to the com.wittara.studio*.json files or copy-pasting the content directly into the manifest files and delete the generated file. Do not forget to update the requirements*.txt files as well.
When it comes to the plugin development, usually I do the following steps:
- Activate the virtual environment:
source .pyenv/bin/activate - Go to the plugin directory, for example:
cd plugins/polars/witt-strutil - Check if there's any dependency issues:
cargo check - Install the plugin in the current environment:
maturin develop - Run the tests, make sure they all pass:
pytest -vv -s
On the release cycle:
- Bump the version up by updating the
Cargo.tomlfile. - Build the distribution files:
maturin build --release --sdist - Publish to the PyPI:
python -m twine upload <target-file>. - Update the
requirements*.txtandpython3-witt*.jsonfiles.
Do not forget to run Run Flatpak: Update Dependencies in the command palette before creating a single-file flatpak bundle. Note that at the moment, I have no clue as to how to create a bundle within VSCode. So, instead I need to open the project with GNOME Builder and click on the "Export" button. Or just run a command line, whatever you prefer :)
We can use journalctl to debug the release version of the application, for example:
journalctl --user -f | grep -E "flatpak|portal|gnome|com.wittara.studio"Open and interact with the application to trigger the error and watch the console for the messages.
We also can benefit from busctl when debugging the D-Bus connections, for instance:
busctl --user monitor com.wittara.studio