Lightweight framework to develop, package, and publish Python desktop applications
Project description
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:
Project Manager
: command-line tool that allows you to initialize a project directory with a structure as described in the Python Packaging User Guide, performversioning
,build
a distribution package,publish
the distribution package, and more. This tool comes with a nicehooking
mechanism and anAPI
so you could easily automate your workflow withPython
code.- Viewable: subclass it to implement a view with a transparent
lifecycle
mechanism that will make it easier to build and maintain yourGUI
. - Megawidget: a set of useful megawidgets like
Table
,Scrollbox
,Toast
,Tree
and more. - Themebase and stylebase: a style/theme mechanism to make it easy for you to create your own
styles
andthemes
. - Cyberpunk-theme: give a modern look to your desktop app with this
dark theme
. - Winter-theme: give a modern look to your desktop app with this
light theme
. - Threadom: it is well known how difficult it is to implement
multithreading
in aTkinter
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/whateverJSON
files easily, thanks to its internal mechanism that creates a fresh copy of the given defaultJSON
file at the target path.Jayson
also comes with a lock to openJSON
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 acreational 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
- python-guide
- python tutorial
- freeCodeCamp on Youtube
Introduction to Tkinter
- tkdocs
- tkinter tutorial
- freeCodeCamp on Youtube
Introduction to SQLite
- sqlitetutorial
- freeCodeCamp on Youtube
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 - 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.
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.
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
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"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.