Skip to content

Examples

Pre-requisites

In all of the following examples, we assume that:

  1. The python environment used for the specific project is set up.
  2. Cargo is installed and available (see pre-requisites).
  3. box is installed and available.

qtcowsay

The following is an example on how to use box with a GUI project. We will use qtcowsay, a simple PyQt6 wrapper around cowsay, as an example.

GIF showing box in action using qtcowsay

Step-by-step instructions

  1. Clone the repository and navigate to the project directory. In the example case, the project is setup using rye.
  2. Initialize this project as a box project by typing box init.
    1. Choose a builder: Here we choose rye (default).
    2. Provide optional dependnecies - not necessary for this project (default).
    3. Answer if this is a GUI project: Yes.
    4. Provide the app entry point: The automatically selected point is correct, so we choose from the list - option 0.
    5. Choose the App entry type according to PyApp's options: Here we use spec.
    6. Provide the Python version to package with: Here we use the default 3.12.
    7. Provide additonal PyApp variables: Not required here (default).
  3. After successfull initialization, we package the project with box package. This first builds the package and then packages it with PyApp. Hold on...
  4. The executable is now in target/release.
  5. Run the executable!

Note

Packaging the project the first time will take a while. Use box package -v to get verbose output to follow the progress.