Skip to main content

A small example package

Project description

PyPositron

PyPositron is a Python-powered desktop app framework that lets you build cross-platform apps using HTML, CSS, and Python—just like Electron, but with Python as the backend. Write your UI in HTML/CSS, add interactivity with Python, and run your app natively!

Features

  • Build desktop apps using HTML and CSS.
  • Use Python for backend logic.
  • Virtual environment support.
  • Effecient installer creation for easy distribution (the installer automatically finds an existing browser instead of installing a new one for every app like Electron.JS).

Quick Start

1. Create a New Project

Install PyPositron if not already installed:

pip install py-positron 

Them create a new project using the CLI:

positron create
# Follow the prompts to set up your project
cd <your_app_name>

2. Run Your App

positron start

3. Install Python Packages

positron install <package>

4. Create a Virtual Environment

positron venv

Example Project Structure

your_app/
├── main
│   └── main.py
├── views/
│   └── index.html
├── [win/linux]venv/
│   └──[bin/Scripts]/
│       ├── activate
│       ├── python.exe
│       └── ...
├──LICENSE
└── ...
  • main_app.py: Entry point for your app.
  • views/index.html: Your app's UI (HTML/CSS/inline Python).
  • winvenv/ or linuxvenv/:: (Optional) Virtual environment for dependencies.

Example: Hello World App

main_app.py

import py_positron as main

# Run this file by typing 'positron start' in your project root.
main.openUI("views/index.html", None, 900, 700, title="Example app") #openUI opens a UI
main.start() #Run this function in a seperate thread if you need to do 
             #anything while the app is running
print("Stopping...") #This runs after the app is closed

views/index.html

<!DOCTYPE html>
<html>
<head>
    <title>Python-Powered App</title>
</head>
<body>
    <h1>Hello from PyPositron!</h1>
    <button id="button">Show Time</button>
<py>
import time
button = document.getElementById('button')
def button_handler():
    document.alert("The current time is " + str(time.strftime("%H:%M:%S")))
button.addEventListener('click', button_handler)
</py>
<!--<script>
    //You can also use JavaScript if you want.
</script>-->
</body>
</html>

CLI Commands

Command Description
positron create Create a new PyPositron project (interactive setup).
positron start Run your PyPositron app from the project root.
positron install <package> Install a Python package into the project venv.
positron venv Create a virtual environment inside your project folder.

Documentation & Resources

License

GNU AGPL v3 License. See LICENSE for details.

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

py_positron-0.0.1.4.tar.gz (47.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_positron-0.0.1.4-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file py_positron-0.0.1.4.tar.gz.

File metadata

  • Download URL: py_positron-0.0.1.4.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for py_positron-0.0.1.4.tar.gz
Algorithm Hash digest
SHA256 14f6b35b347efad2c7198e6b4ccbec9ee12afa547295f46c3542d288a5ee86bf
MD5 a434932cfec69161cb73211be8426f88
BLAKE2b-256 ccd5c76340b741da8b7c7c6640f3bfc8d8bcd5b9cdaaf9dc56c0268ded872d3b

See more details on using hashes here.

File details

Details for the file py_positron-0.0.1.4-py3-none-any.whl.

File metadata

  • Download URL: py_positron-0.0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for py_positron-0.0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 65c7c55d4ed6319c3f68fc97df9e2477a0d04f8af0b6595d027beaaf73cca27b
MD5 1993dea0ec3372bfb4463d64739d79f9
BLAKE2b-256 9ca9732c7f9ce2bc2e8a2c26d9ecfd82ad7fa56ff356f90fe8ee7557365cb3b4

See more details on using hashes here.

Supported by

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