pylon-app


Namepylon-app JSON
Version 0.9.5 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-10-10 05:18:59
maintainerNone
docs_urlNone
authoraesthetics-of-record
requires_python<3.13,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pylonic 👋

Pylonic is the Python backend version of Electron and Tauri, designed to simplify desktop application development. This open-source project, built on **QtWebEngine** and **PySide6**, provides seamless integration with various Python features, making it easy to build powerful applications effortlessly.

![example image](example.png)

## 🚀 Why Pylonic?

With Pylonic, you can leverage the full power of Python in your desktop applications. Its simplicity and flexibility make it the perfect choice for both beginners and experienced developers looking for a Python-focused alternative to Electron or Tauri. It is especially optimized for building AI-powered desktop applications.

## Key Features 🚀

- **Web-based GUI Generation**: Easily build the UI for desktop applications using HTML, CSS, and JavaScript.
- **System Tray Icon Support** 🖥️: Implement system tray icons with ease to add various utilities to your app.
- **Multi-Window Management**: Create and manage multiple windows effortlessly.
- **Bridge API between Python and JavaScript** 🌉: Facilitates smooth communication between Python and JavaScript to integrate various functionalities.
- **Single Instance Application Support**: Prevents duplicate app instances and manages applications with a single instance.
- **Comprehensive Desktop App Features**: Provides a wide range of functions for desktop apps, including monitor management, desktop capture, notifications, shortcuts, and clipboard access.
- **Clean and Intuitive Code Structure**: Offers a simple and readable code structure that enhances developer productivity.
- **Live UI Development Experience**: Experience real-time UI updates as you modify your code, providing an efficient development workflow.
- **Cross-Platform Support**: Runs on various operating systems, including Windows, macOS, and Linux.
- **Integration with Various Frontend Libraries**: Supports integration with frontend frameworks like HTML/CSS/JS and React.

## Documentation 📚

[Pylonic Documentation](https://docs.pylon-app.com/)

### Create Project 📦

#### Creating a HTML/CSS/JS + Pylon Project 🌐

[https://github.com/pylonic/pylonic_html_boilerplate](https://github.com/pylonic/pylonic_html_boilerplate)

#### Creating a React + Vite + Pylon Project ⚛️

[https://github.com/pylonic/pylonic_react_boilerplate](https://github.com/pylonic/pylonic_react_boilerplate)

### Custom Your Boilerplate 🔨

```bash
pip install pylonic
```

Package URL: [https://pypi.org/project/pylon-app/](https://pypi.org/project/pylon-app/)

## Usage 🛠️

### Creating a Basic Application

```python
from pylon import PylonApp

app = PylonApp(single_instance=True)

# set icon
if (is_production()):
    app.set_icon(os.path.join(get_production_path(), "icons/icon.png"))
else:
    app.set_icon("src-pylon/icons/icon.png")

# create window
window = app.create_window(
    title="Pylon Browser1",
    js_apis=[CustomAPI()],
    dev_tools=True
)

window.set_size(800, 600)

# load html
if (is_production()):
    window.set_dev_tools(False)
    window.load_file(os.path.join(get_production_path(), "src/index.html"))
else:
    window.load_file("src/index.html")

# show window
window.show_and_focus()

app.run()
```

### Setting Up System Tray

```python
from pylon import TrayEvent

def on_double_click():
    print("Tray icon was double-clicked.")

app.set_tray_actions({
    TrayEvent.DoubleClick: on_double_click,
})
app.set_tray_menu_items([
    {"label": "Show Window", "callback": app.show_main_window},
    {"label": "Quit", "callback": app.quit},
])
app.setup_tray()
```

```javascript
// CustomAPI method usage example
document.addEventListener('pylonReady', function () {
  // Using the echo method
  pylon.CustomAPI.echo('Hello', 42).then((result) => {
    console.log(result); // "Message received in Python: Hello, 42" output
  });

  // Using the getAppVersion method
  pylon.CustomAPI.getAppVersion().then((version) => {
    console.log('App version:', version); // "App version: 1.0.0" output
  });

  // Example using async/await syntax
  async function useCustomAPI() {
    const echoResult = await pylon.CustomAPI.echo('Test', 100);
    console.log(echoResult);

    const appVersion = await pylon.CustomAPI.getAppVersion();
    console.log('Current app version:', appVersion);
  }

  useCustomAPI();

  // Button click event binding
  document.getElementById('myButton').addEventListener('click', function () {
    // Using the create_window method
    pylon.CustomAPI.create_window().then((windowId) => {
      console.log('New window ID:', windowId); // "New window ID: [generated window ID]" output
    });
  });
});
```

### Using React

```javascript
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './App.jsx';
import './index.css';

document.addEventListener('pylonReady', function () {
  createRoot(document.getElementById('root')).render(
    <StrictMode>
      <App />
    </StrictMode>
  );
});

function App() {
  console.log('Pylon is ready');

  window.pylon.CustomAPI.getAppVersion().then((version) => {
    console.log('App version:', version); // "App version: 1.0.0"
  });
  return <h1>Hello World</h1>;
}
```

## License 📄

This project is licensed under the terms of the Apache License 2.0. See the [LICENSE](./LICENSE) file for details.

This project uses PySide6, which is licensed under the LGPL (Lesser General Public License).

## Contributing 🤝

(Add information about how to contribute here)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pylon-app",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "aesthetics-of-record",
    "author_email": "111675679+aesthetics-of-record@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/c1/cd/ed94f898250b8eb48084954860fe258177832538dc63150a741316ddbd1d/pylon_app-0.9.5.tar.gz",
    "platform": null,
    "description": "# Pylonic \ud83d\udc4b\n\nPylonic is the Python backend version of Electron and Tauri, designed to simplify desktop application development. This open-source project, built on **QtWebEngine** and **PySide6**, provides seamless integration with various Python features, making it easy to build powerful applications effortlessly.\n\n![example image](example.png)\n\n## \ud83d\ude80 Why Pylonic?\n\nWith Pylonic, you can leverage the full power of Python in your desktop applications. Its simplicity and flexibility make it the perfect choice for both beginners and experienced developers looking for a Python-focused alternative to Electron or Tauri. It is especially optimized for building AI-powered desktop applications.\n\n## Key Features \ud83d\ude80\n\n- **Web-based GUI Generation**: Easily build the UI for desktop applications using HTML, CSS, and JavaScript.\n- **System Tray Icon Support** \ud83d\udda5\ufe0f: Implement system tray icons with ease to add various utilities to your app.\n- **Multi-Window Management**: Create and manage multiple windows effortlessly.\n- **Bridge API between Python and JavaScript** \ud83c\udf09: Facilitates smooth communication between Python and JavaScript to integrate various functionalities.\n- **Single Instance Application Support**: Prevents duplicate app instances and manages applications with a single instance.\n- **Comprehensive Desktop App Features**: Provides a wide range of functions for desktop apps, including monitor management, desktop capture, notifications, shortcuts, and clipboard access.\n- **Clean and Intuitive Code Structure**: Offers a simple and readable code structure that enhances developer productivity.\n- **Live UI Development Experience**: Experience real-time UI updates as you modify your code, providing an efficient development workflow.\n- **Cross-Platform Support**: Runs on various operating systems, including Windows, macOS, and Linux.\n- **Integration with Various Frontend Libraries**: Supports integration with frontend frameworks like HTML/CSS/JS and React.\n\n## Documentation \ud83d\udcda\n\n[Pylonic Documentation](https://docs.pylon-app.com/)\n\n### Create Project \ud83d\udce6\n\n#### Creating a HTML/CSS/JS + Pylon Project \ud83c\udf10\n\n[https://github.com/pylonic/pylonic_html_boilerplate](https://github.com/pylonic/pylonic_html_boilerplate)\n\n#### Creating a React + Vite + Pylon Project \u269b\ufe0f\n\n[https://github.com/pylonic/pylonic_react_boilerplate](https://github.com/pylonic/pylonic_react_boilerplate)\n\n### Custom Your Boilerplate \ud83d\udd28\n\n```bash\npip install pylonic\n```\n\nPackage URL: [https://pypi.org/project/pylon-app/](https://pypi.org/project/pylon-app/)\n\n## Usage \ud83d\udee0\ufe0f\n\n### Creating a Basic Application\n\n```python\nfrom pylon import PylonApp\n\napp = PylonApp(single_instance=True)\n\n# set icon\nif (is_production()):\n    app.set_icon(os.path.join(get_production_path(), \"icons/icon.png\"))\nelse:\n    app.set_icon(\"src-pylon/icons/icon.png\")\n\n# create window\nwindow = app.create_window(\n    title=\"Pylon Browser1\",\n    js_apis=[CustomAPI()],\n    dev_tools=True\n)\n\nwindow.set_size(800, 600)\n\n# load html\nif (is_production()):\n    window.set_dev_tools(False)\n    window.load_file(os.path.join(get_production_path(), \"src/index.html\"))\nelse:\n    window.load_file(\"src/index.html\")\n\n# show window\nwindow.show_and_focus()\n\napp.run()\n```\n\n### Setting Up System Tray\n\n```python\nfrom pylon import TrayEvent\n\ndef on_double_click():\n    print(\"Tray icon was double-clicked.\")\n\napp.set_tray_actions({\n    TrayEvent.DoubleClick: on_double_click,\n})\napp.set_tray_menu_items([\n    {\"label\": \"Show Window\", \"callback\": app.show_main_window},\n    {\"label\": \"Quit\", \"callback\": app.quit},\n])\napp.setup_tray()\n```\n\n```javascript\n// CustomAPI method usage example\ndocument.addEventListener('pylonReady', function () {\n  // Using the echo method\n  pylon.CustomAPI.echo('Hello', 42).then((result) => {\n    console.log(result); // \"Message received in Python: Hello, 42\" output\n  });\n\n  // Using the getAppVersion method\n  pylon.CustomAPI.getAppVersion().then((version) => {\n    console.log('App version:', version); // \"App version: 1.0.0\" output\n  });\n\n  // Example using async/await syntax\n  async function useCustomAPI() {\n    const echoResult = await pylon.CustomAPI.echo('Test', 100);\n    console.log(echoResult);\n\n    const appVersion = await pylon.CustomAPI.getAppVersion();\n    console.log('Current app version:', appVersion);\n  }\n\n  useCustomAPI();\n\n  // Button click event binding\n  document.getElementById('myButton').addEventListener('click', function () {\n    // Using the create_window method\n    pylon.CustomAPI.create_window().then((windowId) => {\n      console.log('New window ID:', windowId); // \"New window ID: [generated window ID]\" output\n    });\n  });\n});\n```\n\n### Using React\n\n```javascript\nimport { StrictMode } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport App from './App.jsx';\nimport './index.css';\n\ndocument.addEventListener('pylonReady', function () {\n  createRoot(document.getElementById('root')).render(\n    <StrictMode>\n      <App />\n    </StrictMode>\n  );\n});\n\nfunction App() {\n  console.log('Pylon is ready');\n\n  window.pylon.CustomAPI.getAppVersion().then((version) => {\n    console.log('App version:', version); // \"App version: 1.0.0\"\n  });\n  return <h1>Hello World</h1>;\n}\n```\n\n## License \ud83d\udcc4\n\nThis project is licensed under the terms of the Apache License 2.0. See the [LICENSE](./LICENSE) file for details.\n\nThis project uses PySide6, which is licensed under the LGPL (Lesser General Public License).\n\n## Contributing \ud83e\udd1d\n\n(Add information about how to contribute here)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "0.9.5",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d74602f7c47ae9d6b64ba4e37cd5e720874b1f8ba9b4e2a2948d504b5f7c05e4",
                "md5": "06619e66c0c556aea553d86bb9de6825",
                "sha256": "b9239351beef52c17b78d00410a143f3a9c96da60e8d39448a746e0348a0c1d9"
            },
            "downloads": -1,
            "filename": "pylon_app-0.9.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "06619e66c0c556aea553d86bb9de6825",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 18808,
            "upload_time": "2024-10-10T05:18:58",
            "upload_time_iso_8601": "2024-10-10T05:18:58.563304Z",
            "url": "https://files.pythonhosted.org/packages/d7/46/02f7c47ae9d6b64ba4e37cd5e720874b1f8ba9b4e2a2948d504b5f7c05e4/pylon_app-0.9.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c1cded94f898250b8eb48084954860fe258177832538dc63150a741316ddbd1d",
                "md5": "cc823f0b1f1917641b65896035553907",
                "sha256": "c5340bb35b9b3bcf8eca990a6db2b23c4eca4a25709a15723046196f2f75b1d2"
            },
            "downloads": -1,
            "filename": "pylon_app-0.9.5.tar.gz",
            "has_sig": false,
            "md5_digest": "cc823f0b1f1917641b65896035553907",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 18986,
            "upload_time": "2024-10-10T05:18:59",
            "upload_time_iso_8601": "2024-10-10T05:18:59.925173Z",
            "url": "https://files.pythonhosted.org/packages/c1/cd/ed94f898250b8eb48084954860fe258177832538dc63150a741316ddbd1d/pylon_app-0.9.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-10 05:18:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pylon-app"
}
        
Elapsed time: 0.33899s