cod

codegame

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

Showing:

Popularity

Downloads/wk

0

GitHub Stars

87

Maintenance

Last Commit

24d ago

Contributors

1

Package

Dependencies

1

License

MIT

Categories

Readme

Pyrustic

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

Installation | Tutorial | Guide | Reference | Website

Table Of Contents

Overview

Python is one of the world's most popular programming languages. It's used in many application domains from machine learning to web development. Desktop application development is exciting. Pyrustic Framework aims to help you build great desktop apps.

Batteries included

Pyrustic Framework comes with batteries included:

  • Backstage: a project manager command-line tool that allows you to initialize a project directory with a structure as described in the Python Packaging User Guide, perform versioning, build a distribution package, publish the distribution package, and more. This tool comes with a nice hooking mechanism and an API so you could easily automate your workflow with Python code.
  • Viewable: subclass it to implement a view with a transparent lifecycle mechanism that will make it easier to build and maintain your GUI.
  • Megawidget: a set of useful megawidgets like Table, Scrollbox, Toast, Tree and more.
  • TkStyle: a library to make it easy for you to create your own styles and themes.
  • Cyberpunk-theme: give a modern look to your desktop app with this dark theme. Theme built with TkStyle.
  • Winter-theme: give a modern look to your desktop app with this light theme. Coming soon !
  • Threadom: it is well known how difficult it is to implement multithreading in a Tkinter application. Threadom is a library to make it easy to develop multithreading applications. You can retrieve from the main thread the values returned and the exceptions raised by the functions executed in other threads.
  • Shared: library to store, expose, read, and edit collections of data.
  • Diaspora: as a software grows, so is its complexity. Diaspora allows loosely coupled components to exchange data, subscribe to events and publish events notifications.
  • Jayson: intuitive interaction with JSON files. With Jayson, you can initialize preferences/configuration/whatever JSON files easily, thanks to its internal mechanism that creates a fresh copy of the given default JSON file at the target path. Jayson also comes with a lock to open JSON files in readonly mode.
  • Kurl: library to fetch resources with an implementation of conditional request and a smart responses caching system.
  • Litedao: library to simplify the connection to your SQLite database with 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.

As you can see, the framework covers various topics, from GUI to database connection, and it enforces good practices like the project structure by example.

Examples

This is the typical content of __main__.py:

Click to expand (or collapse)
from pyrustic.app import App
from cyberpunk_theme import Cyberpunk
# the framework comes with a graphical 'Hello World' view
from pyrustic.hello import HelloView


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


if __name__ == "__main__":
    main()

This is an example of a view definition:

Click to expand (or collapse)
import tkinter as tk
from viewable import Viewable


class View(Viewable):
    def __init__(self, master):
        super().__init__()
        self._master = master

    def _build(self):
        self._body = tk.Frame(self._master)
        label = tk.Label(self._body, text="Hello !")
        label.pack()

    def _on_map(self):
        """ This method is called when the view is mapped for the first time """

    def _on_destroy(self):
        """ This method is called when the view is destroyed """


if __name__ == "__main__":
    root = tk.Tk()
    view = View(root)
    # the method build_pack() builds then packs the view.
    # In fact you could do:
    #   view.build() then view.pack()
    # or:
    #   view.build() then view.body.pack()
    view.build_pack()  # it accepts arguments like the Tkinter pack() method
    root.mainloop()
    

This is an example of a naked view (a view that doesn't subclass Viewable):

Click to expand (or collapse)
import tkinter as tk
from pyrustic.app import App
from cyberpunk_theme import Cyberpunk


def view(app):
    """ A Naked View is a function that accepts the app reference as argument
    and returns a Tkinter object (generally a container like tk.Frame) """
    master = app.root
    # The body of this naked view is a tk.Frame
    body = tk.Frame(master)
    label = tk.Label(body, text="Hello !")
    label.pack()
    return body  # mandatory !


if __name__ == "__main__":
    app = App()
    app.theme = Cyberpunk()
    app.view = view  # Naked view reference
    app.start()
    

Installation

Requirements

Pyrustic Framework is cross platform and versions under 1.0.0 will be considered Beta at best. It is built on Ubuntu with Python 3.8 and should work on Python 3.5.

As Pyrustic Framework is built with Python for Python developers you may need to learn Python and Tkinter.

First time

Install for the first time:

$ pip install pyrustic

Upgrade

To upgrade Pyrustic Framework:

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

I recommend upgrading Pyrustic Framework with the eager upgrade strategy as specified since the project is under active development.

Documentation

FAQ

Read the FAQ.

Tutorial

Read the Tutorial.

Guide

Read the Guide.

Glossary

Read the Glossary.

Reference

Read the Reference.

External Learning Resources

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

Linked Projects

Pyrustic Framework is part of the Open Pyrustic Ecosystem. Let's discover some other ecosystem projects.

Hubstore

Once you have published your app to Github with the command publish in the Project Manager, the next question that arises is: "How to make the find-download-install-run process easier for users ?". This is where Hubstore comes in.

Hubstore

Hubstore - To Connect Apps With Users

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.

Pyrustic Hubstore

The Pyrustic Open Pipeline to distribute apps

Hubstore itself is built with Pyrustic Framework and is available on PyPI.

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

Dresscode

If Pyrustic Framework is C, Dresscode would be Python.

Dresscode is a high productivity framework for developing a graphical user interface without prior knowledge of using a GUI Toolkit.

As a high productivity framework, Dresscode is suitable for teaching, prototyping, testing, adding a GUI to command-line scripts, developing simple to complex desktop applications, etc.

Pyrustic Hubstore

Dresscode demo built with 1 hex-digit lines of Python code

Under the hood, Dresscode uses Pyrustic Framework.

Discover Dresscode !

Desktop apps built with Pyrustic Framework

Here are some desktop apps built with Pyrustic Framework

Click to expand (or collapse)
Jupitest

Jupitest - Graphical test runner


Rustiql

Rustiql - Graphical SQL editor

License

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

Contact

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

email

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100