Metadata-Version: 2.2
Name: PyBootstrapUI
Version: 1.1.1
Summary: A Python library for building web interfaces with dynamic and desktop features.
Home-page: https://github.com/oject0r/pybootstrapui
Author: oject0r
Author-email: oject0r <hd076@protonmail.com>
Maintainer-email: oject0r <hd076@protonmail.com>
License: MIT License
        
        Copyright (c) 2025 oject0r
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Keywords: PyBootstrapUI,bootstrap,web,desktop,gui,nwjs,nwjs-python,pyinstaller,pyinstaller-nwjs,interface,ui,user-interface,dynamic,dynamic-ui,dynamic-user-interface,dynamic-interface,aiohttp
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: User Interfaces
Classifier: Development Status :: 4 - Beta
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp
Requires-Dist: aiofiles
Provides-Extra: all
Requires-Dist: aiofiles; extra == "all"
Requires-Dist: pygments; extra == "all"
Requires-Dist: pyinstaller; extra == "all"
Requires-Dist: markdown; extra == "all"
Requires-Dist: httpx; extra == "all"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# PyBootstrapUI

**PyBootstrapUI** is a Python framework for building modern web interfaces, integrating HTML components, dynamic user interactions, and creating desktop applications powered by **NW.js**.

---

## 🚀 **Key Features**

- **🖥️ Dynamic UI:** Build interactive web pages with server-side callbacks for user events.
- **💻 Desktop Applications:** Launch web pages as standalone desktop apps using NW.js.
- **📦 Prebuilt Components:** Access a library of ready-to-use HTML components like buttons, headers, forms, modals, and more.
- **🎨 Custom Templates:** Use predefined themes or your own HTML templates for quick styling.
- **🔗 Seamless Integration:** Works well with Bootstrap (and other frameworks in the future) for modern web development.

---

## ⚡ **Quick Start**

### 📥 **Installation**

1. Install the package:
   ```bash
   pip install pybootstrapui
   ```

2. Install **NW.js** if you plan to build desktop applications:
   - [Download NW.js](https://nwjs.io/).
   - Or use the PyBootstrapUI command:
     ```bash
     python -m pybootstrapui download %path_to_nwjs%
     ```

---

### 📝 **Basic Usage**

#### **📄 Creating a Page**

```python
from pybootstrapui import Page
from pybootstrapui.components import Header, Button, BootstrapIcon
from pybootstrapui.modifiers import *

# Create a new page
page = Page(page_title="Hello PyBootstrapUI")

# Add components
page.add(Header(BootstrapIcon('box-seam-fill'), "Welcome to PyBootstrapUI!"))
page.add(Button(label="Click Me", modifier=ButtonModifier.color(ButtonStyle.PRIMARY)))

# Generate HTML
print(page.compile())
```

---

#### **🔄 Adding Callbacks**

```python
import asyncio
from pybootstrapui import Page, ButtonCallbackContext
from pybootstrapui.components import Header, Button, ButtonStyle
from pybootstrapui.templates import Default


# Define a callback function
async def on_button_click(context: ButtonCallbackContext):
    context.show_spinner()
    
    print(f"Button clicked with ID: {context.id}")
    await asyncio.sleep(15)
    
    context.hide_spinner()


# Create a page with a button callback
page = Page(page_title="Callback Demo")
page.add(Header("Dynamic Callbacks Example"))
page.add(Button("Click Me", modifier=ButtonModifier.color(ButtonStyle.SUCCESS), on_click=on_button_click))

# Run as a desktop application
page.run_in_desktop(
    nwjs_path="/path/to/nwjs",
    title="Callback App",
    width=800,
    height=600
)
```

---

## 🖥️ **Running as a Desktop App**

Use the `Page.run_in_desktop` method to run your page as a desktop application.

```python
from pybootstrapui import Page
from pybootstrapui.components import Header

# Create the page
page = Page(page_title="My App")

# Add components
page.add(Header("This is a desktop app!"))

# Run the app
page.run_in_desktop(
    nwjs_path="/path/to/nwjs",
    icon="icon.png",
    title="My Desktop App",
    width=1024,
    height=768
)
```

---

## 📦 **Easy Packaging**

Easily package and distribute your **PyBootstrapUI** applications with minimal effort!

### 🛠️ **Step 1: Create a New Project**

Generate a fully templated **PyBootstrapUI** project structure:

```bash
python -m pybootstrapui create MyProject
```

### ⚙️ **Step 2: Build Your Application**

Package your application into a standalone build:

```bash
python -m pybootstrapui build MyProject
```

- **Dependencies Management:** All required packages are bundled.
- **Optimized Build Process:** Ensures efficient and clean packaging.
- **Platform-Specific Binaries:** Create executables for Windows, macOS, or Linux seamlessly.

---

## 🚀 **Migration to PyBootstrapUI 1.1.0**

For a detailed step-by-step migration guide, refer to the official tutorial:  
👉 [**Migrating to v1.1.0**](Migrating%20to%20v1.1.0.MD)  

This guide covers all the key updates and examples to help you transition smoothly.

---

## 📚 **Documentation**

Detailed documentation is available at [PyBootstrapUI Docs](https://pybootstrapui.076s.pw) (WIP).

---

## 🔗 **Useful Links**

- **GitHub:** [oject0r/pybootstrapui](https://github.com/oject0r/pybootstrapui)
- **Documentation:** [pybootstrapui.076s.pw](https://pybootstrapui.076s.pw)
- **Bootstrap:** [getbootstrap.com](https://getbootstrap.com)
- **FastAPI:** [fastapi.tiangolo.com](https://fastapi.tiangolo.com)

---

## 📜 **License**

This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.

---

✨ Start building beautiful, dynamic, and cross-platform applications with **PyBootstrapUI** today! 🚀

