Skip to main content

Lightweight framework to develop, package, and publish Python desktop applications

Project description

Cover

Desktop apps built with Pyrustic

Pyrustic

Pyrustic is a lightweight framework to develop, package, and publish Python desktop applications.

This is a user-centric project. You are encouraged to send a feedback.

Tutorial | Installation | Reference | Hubstore

Table Of Contents

Overview

Pyrustic Hubstore

The Pyrustic Ecosystem

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.

Since a framework alone isn't enough, Pyrustic comes with batteries included, just like the Python language itself which comes with an amazing standard library. Pyrustic is shipped with a powerful command-line tool: The Manager. The Manager allows you to create a new project with the standard structure, initialize a project directory, build a distribution package, publish the distribution package, and more.

Pyrustic is flexible enough that you can use only one of its 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 for your users to consume through Hubstore.

Pyrustic is 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 constraints are just good practice and guess what, 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.

(*) If you are wondering how to deal with the hyphen versus underscore issue in a project structure, take a look at tk-cyberpunk-theme. In short, use a hyphen in the distribution package name and use an underscore in the import package name.

GUI

Pyrustic proudly uses Tkinter as GUI Toolkit. Why Tkinter ? Read this answer.

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.Theme: a style/theme mechanism to make it easy for you to build beautiful GUIs.
  • tk_cyberpunk_theme: a dark theme ready to use.
  • 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

The following is an excerpt from the demo. Explore the demo project.

Click to expand (or collapse)
from pyrustic.app import App
from tk_cyberpunk_theme.main 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 graphical 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 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 get 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 a command-line application with an API that you can use to automate your workflow.

Via the Manager you can:

  • create a project with battery included (project structure, pyproject.toml, default README.md, etc);
  • easily add multiples packages, modules or files to your project with a one line command;
  • run a specific module or package of your project;
  • run any package previously installed with pip, in others words, you just need to type run jupitest to open the graphical test runner Jupitest;
  • view recent projects list and quickly switch between projects;
  • build a distribution package according to setup.cfg and MANIFEST.in;
  • publish your application (distribution package);
  • find out if the project is installed ('pip install -e') in the current virtual env;
  • and more...

Type help in the Manager to discover the commands. Basically, you will often need to use the command link or relink to link a project to the Manager, init to initialize your project, run to run your project, build to build a distribution package and publish to publish your app.

You need a personal access token to publish your application. It is easy to generate a personal access token. Read this article.

Some Desktop Apps Built With Pyrustic

The following apps are made with Pyrustic:

  • Rustiql: a graphical SQL Editor;
  • Jupitest: a graphical Test Runner;
  • Jupitest: a graphical Test Runner;
  • Hubway: an application to publish your project;
  • Hubstore: an application to connect your apps with your users.

Their themes are based on tk-cyberpunk-theme.

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...

Install Rustiql:

pip install rustiql

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...

Install Jupitest:

pip install jupitest

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.

Install Hubway:

pip install hubway

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

Hubstore

Hubstore

Once you have published your app to Github with the command publish, the next 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.

Note that any Python Wheel app is compatible with Hubstore, in others words, you don't need to use the Pyrustic Framework to have a Hubstore compatible app.

Hubstore is available on PyPI.

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

tk-cyberpunk-theme - A Dark Theme For Desktop Apps

The tk-cyberpunk-theme is used as base theme in Hubstore, Jupitest, Rustiql and Hubway.

Pyrustic is shipped with tk-cyberpunk-theme, so you don't need to install it.

Install tk-cyberpunk-theme:

pip install tk-cyberpunk-theme

Discover the cyberpunk theme !

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

Built on Ubuntu with Python 3.5. Pyrustic comes with absolutely no warranty and is available on the Python Package Index PyPI.

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

Documentation

Pyrustic is a work in progress. The versions of Pyrustic under 1.0.0 are aimed at an audience of early adopters. Check the FAQ and the Tutorial.

FAQ

Read the FAQ.

Tutorial

Read the Tutorial.

Guide

Read the Guide.

Glossary

Read the Glossary.

Framework Reference

Read the Framework Reference.

External Learning Resources

Interesting links below to get started with Python, Tkinter and SQLite.

Introduction to Python

Introduction to Tkinter

Introduction to SQLite

Note: I am not affiliated with any of these entities. A simple web search brings them up.

Philosophy

Click to expand (or collapse)

Wisdom from Antiquity


He owned a cup which served also as a bowl for food but threw it away when he saw a boy drinking water from his hands and realized one did not even need a cup to sustain oneself.

--Mark, J. J. (2014, August 02). Diogenes of Sinope. Ancient History Encyclopedia. Retrieved from https://www.ancient.eu/Diogenes_of_Sinope/


Advertisement from the twentieth century

IBM

By Cecile & Presbrey advertising agency for International Business Machines. - Scanned from the December 1951 issue of Fortune by User:Swtpc6800 Michael Holley. The image was touched up with Adobe Photo Elements., Public Domain, Link


150 Extra Engineers

An IBM Electronic Calculator speeds through thousands of intricate computations so quickly that on many complex problems it's like having 150 EXTRA Engineers.

No longer must valuable engineering personnel ... now in critical shortage ... spend priceless creative time at routine repetive figuring.

Thousands of IBM Electronic Business Machines ... vital to our nation's defense ... are at work for science, industry, and the armed forces, in laboratories, factories, and offices, helping to meet urgent demands for greater production.

-- IBM International Business Machines

License

Pyrustic is licensed under the terms of the permissive free software license MIT License.

Contact

Click to expand (or collapse)

Hi ! I'm Alex, operating by "Crocker's Rules"

email



Congratz ! You just found the Easter Meggs !

Meme


Meme


Meme


Meme


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrustic-0.1.2.tar.gz (77.4 kB view hashes)

Uploaded Source

Built Distribution

pyrustic-0.1.2-py3-none-any.whl (95.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page