pyrustic

Lightweight framework and software suite to help develop, package, and publish Python desktop applications.

Python is one of the world's most popular programming languages. There are some great frameworks for building web application with Python. Pyrustic targets Python desktop application development.

A framework alone is not enough to build a great app. Pyrustic comes with batteries included, just like the Python language itself which comes with an amazing standard library. Pyrustic is a lightweight framework and software suite to help develop, package, and publish Python desktop applications.

Pyrustic is flexible enough that you can use both the framework and the software suite or just one of the components. For example, you can decide to only use the Table widget from the pyrustic.widget package in your existing Tkinter codebase. Another example is to only use Pyrustic to build a Wheel and then publish it.

The framework and the software suite are useful for a new project as well as for an existing project.

The Framework

The Framework covers various topics, from GUI to database connection, and more.

Standard Project Structure

The Framework is easy to use and flexible with only three constraints:

  • you have to follow the conventional Python project structure as described in the Python Packaging User Guide;
  • you need to have a __main__.py file in the source package;
  • the project name should be the same as the source package.

In fact, these aren't constraints but simply elegance and proactivity. It will save you a lot of trouble in the future (believe me). By the way, the command-line tool Manager will take care of these details for you, you will just need to link a project directory, then issue the command init.

GUI

Pyrustic proudly uses Tkinter as GUI Toolkit. Remember that the entire software suite was built with Pyrustic.

Some features related to the GUI:

  • The Framework comes with many awesome widgets (mega-widgets to be precise): Table, Scrollbox, Toast, Tree and more.
  • pyrustic.default_style and pyrustic.theme: a style/theme system to make it easy for you to build beautiful GUIs.
  • pyrustic.theme.cyberpunk: a dark theme ready to use, the one used as base theme by the entire software suite.
  • pyrustic.view.View: Pyrustic comes with the concept of views. Views are optional to use and are compatible with Tkinter. In fact, Views provides an intuitive lifecycle mechanism that will make it easier to build and maintain your GUI.
  • and more...

Example of typical __main__.py content

from pyrustic.app import App
from pyrustic.theme.cyberpunk import Cyberpunk
from demo.view.main_view import MainView


def main():
    # The App
    app = App(__package__)
    # Set theme
    app.theme = Cyberpunk()
    # Set view
    app.view = MainView(app)  # it could be a Tkinter object
    # Center the window
    app.center()
    # Lift off !
    app.start()


if __name__ == "__main__":
    main()

Multithreading

It is well known how difficult it is to implement multithreading in a Tkinter application. Pyrustic comes with pyrustic.threadom: a library to make it easy to develop multithreading applications. You can retrieve from the main thread the values returned by the functions executed in other threads and also the exceptions raised by these functions.

Jupitest the Pyrustic Test Runner makes extensive use of the pyrustic.threadom library to perform smooth real-time test reporting.

Fetching Resources

Pyrustic comes with pyrustic.gurl: a library to fetch resources with an implementation of conditional request and a smart responses caching system.

Hubway, the Pyrustic app to publish application, uses this library to fetch resources as a good API citizen.

Communicating Between Components And Event Notification

As a software grows, so is its complexity. Pyrustic comes with pyrustic.com a library to allow loosely coupled components to exchange data, subscribe to and publish events.

Please read the tutorial to geet a deep understanding of this section.

Database Access Object

Pyrustic comes with pyrustic.dao: a library to simplify the connection to your SQLite database.
This library has some cool features like the ability to specify what I call a creational script that will be used to create a new database when it is missing.

And More

  • pyrustic.jasonix: a library included in the Framework which makes it so cool to work with JSON files. Pyrustic uses extensively this library to store user preferences, configuration data and more. With this library, you can initialize preferences/configuration/whatever files easily, thanks to the internal mechanism of Jasonix that creates a fresh copy of the given default JSON file at the target path. Jasonix also comes with a lock to open JSON files in readonly mode.
  • for obvious reasons (clue: beta), Pyrustic does not take the risk of deleting the files it needs to get rid of, instead it moves them to a trash folder.
  • and more...

The Manager

Manager

Manager

The Manager is the entry point to the software suite. It's an optional command-line application with an API that you can use programmatically to automate your workflow.

Via the Manager you can:

  • create a project with battery included (project structure, pyproject.toml, etc);
  • easily add packages, modules or files to your project;
  • run a specific module of your project;
  • view recent projects list and quickly switch between projects;
  • launch the SQL Editor, Test Runner and Hubway (respectively with commands sql, test and hub);
  • build a distribution package according to setup.cfg and MANIFEST.in;
  • find out if the project is installed ('pip install -e') in the current virtual env;
  • and more...

The build command builds a package that could be published with the application Hubway.

The Software Suite

The lightweight software suite is made of:

  • Rustiql: a graphical SQL Editor;
  • Jupitest: a graphical Test Runner;
  • and Hubway: an application to publish your project.

Rustiql - The Graphical SQL Editor

SQL Editor

SQL Editor

The graphical SQL Editor allows you to:

  • visualize your databases content;
  • edit your database (CRUD);
  • import SQL scripts;
  • open in-memory database;
  • and more...

The SQL Editor makes extensive use of the pyrustic.dao library.

Jupitest - The Graphical Test Runner

Test Runner

Test Runner

The Test Runner reproduces the tree structure of the tests folder in your project. The Test Runner allows you to:

  • run test packages;
  • run test modules;
  • run test classes;
  • and even run test methods;
  • and more...

The Test Runner makes extensive use of the pyrustic.threadom library to perform smooth real-time test reporting.

Hubway - Release Your App To The World

Hubway

Hubway

Hubway is an application that allows you to publish a new release of your application on Github. Once published, you can track your project, see metrics like the number of stargazers, subscribers or releases downloads.

Hubway makes extensive use of pyrustic.gurl to fetch resources.

You need a personal access token to publish a release via Hubway or to increase the API rate limit.
It is easy to generate a personal access token. Read this article.

Hubstore - To Connect Apps With Users

Pyrustic Hubstore

Pyrustic - Hubstore

Once you are ready to release a new version of your app, Pyrustic allows you to build a distribution package with the build command and then publish it to Github with Hubway.

Then the question that arises is "How to make the find-download-install-run process easier for users?". This is where the Hubstore comes in.

With Hubstore, it's easy to showcase, distribute, install, and manage your Python desktop apps.

Hubstore is available on PyPI and yes it's also built with Pyrustic !

Do you want to learn more about Hubstore ? Discover Hubstore !

Demo Video

This is the now obsolete demo video but still worth watching.

Watch the video !

I will upload an up-to-date video later.

To open the page in a new tab, you can just do a CTRL+click (on Windows and Linux) or CMD+click (on MacOS) on the link.

Requirements

Pyrustic is a cross platform software suite. It should work on your computer (or nope, haha, versions under 1.0.0 will be considered Beta at best). It is built on Ubuntu with Python 3.5. Pyrustic comes with absolutely no warranty. So... à la guerre comme à la guerre.

As Pyrustic is built with Python for Python developers and also makes extensive use of Tkinter, you may need to learn Python and Tkinter.

Installation

Pyrustic is available on PyPI (the Python Package Index) to simplify the life of Python developers.

If you have never installed a package from PyPI, you must install the pip tool enabling you to download and install a PyPI package. There are several methods which are described on this page.

$ pip install pyrustic

$ pyrustic
Welcome to Pyrustic Manager !
Version: 0.0.9
Type "help" or "?" to list commands. Type "exit" to leave.

(pyrustic) 

To upgrade Pyrustic:

$ pip install pyrustic --upgrade --upgrade-strategy eager

GitHub