Nchantrs
[](https://pypi.org/project/nchantrs/)
[](LICENSE)
[](https://pypi.org/project/nchantrs/)
[](https://pypi.org/project/nchantrs/)
[](https://github.com/solutionsbrewer/nchantrs/actions)
[](https://codecov.io/gh/solutionsbrewer/nchantrs)
[](https://github.com/solutionsbrewer/nchantrs)
[](https://pypi.org/project/nchantrs/)
[](https://pypi.org/project/nchantrs/)
Nchantrs is a Python module for rapidly creating PyQt5/PySide6 applications using YAML configuration and Python widget files. Applications are built over a SQLite backend using FxSQuiRL for database operations.
## Features
- **4 Entry Points**: Choose the right architecture for your app (aberration, distortion, nchantment, flection)
- **YAML-Based Configuration**: Define application structure, UI layouts, widgets, and database schemas
- **Python Widget Files**: Extend functionality with custom widgets, events, and logic
- **PyQt5/PySide6 Integration**: Cross-platform desktop GUI framework support
- **SQLite Backend via FxSQuiRL**: Seamless database operations with one or more SQLite databases
- **Theme System**: Built-in theming with customizable QSS templates
- **Authentication**: Built-in password dialog and user authentication
- **Model-View Architecture**: Clean separation of concerns (Cape/Cloak/Sigil pattern)
## Installation
You can install Nchantrs via pip:
```bash
pip install nchantrs
```
Alternatively, clone the repository and install from source:
```bash
git clone https://github.com/<USER_OR_ORG>/nchantrs.git
cd nchantrs
pip install -e .
```
### Requirements
- Python 3.10 or higher
- PyQt5, PyQt6, or PySide6
- Dependencies: pyyaml, sqlalchemy, fxsquirl, kahndor, ogma, pycurity
## Quick Start
### Choose Your Entry Point
Nchantrs provides 4 entry points depending on your app's complexity:
| Entry Point | Use When | Backend |
|-------------|----------|---------|
| **aberration** | Simple dialogs, popups | None |
| **distortion** | Single-pane tools/utilities | YAML + SQLite |
| **nchantment** | Multi-pane office applications | SQLite + YAML |
| **flection** | Networked/P2P applications | SQLite + YAML + P2P |
### Basic Usage
```python
import nchantrs
# Choose the right entry point for your app:
# - aberration: Simple popup dialogs
# - distortion: Single-pane tool apps (YAML-first)
# - nchantment: Multi-pane office apps (SQLite-first)
# - flection: Networked apps with P2P
# For a distortion (single-pane tool) app:
from nchantrs.dialogs.distortion import NchantdDistortion
app = NchantdDistortion()
app.initModel() # Initialize YAML/SQLite backend
app.initView() # Set up UI
app.run() # Start application
```
## Usage
### Loading Configurations
Nchantrs uses YAML files to define the app's UI and database interactions. A sample YAML might look like:
```yaml
app_name: MyApp
ui:
main_window:
title: Main Window
widgets:
- type: button
label: Submit
on_click: custom_handler
database:
schema: path/to/schema.sql
connections:
- name: primary
file: database.db
```
Use `nchantrs.load_config(yaml_path)` to parse and validate the config.
### Creating Applications
```python
# Load config
config = nchantrs.load_config('app.yaml')
# Specify widget directory
app = nchantrs.Application(config, widget_dir='widgets/')
# Add custom widget logic from Python files
app.register_widget('custom_widget.py')
# Initialize database with FxSQuiRL
app.init_database(config['database']['connections'][0]['file'])
# Execute queries
results = app.query('SELECT * FROM <TABLE_NAME>')
```
### Database Interactions
Leverage FxSQuiRL for SQLite operations:
```python
# Write data
app.insert('INSERT INTO <TABLE_NAME> (column) VALUES (?)', ('value',))
# Read data
data = app.fetch('SELECT * FROM <TABLE_NAME> WHERE id = ?', (1,))
```
### Supported Frameworks
- PyQt5
- PyQt6
- PySide2
- PySide6
## Examples
### Example 1: Simple CRUD Application
```python
import nchantrs
config = nchantrs.load_config('crud_app.yaml')
app = nchantrs.Application(config, widget_dir='crud_widgets/')
app.init_database('crud.db')
# Add a form widget for data entry
app.add_form('user_form', fields=['name', 'email'])
# Run with event loop
app.run()
```
### Example 2: Multi-Database Dashboard
```python
import nchantrs
config = nchantrs.load_config('dashboard.yaml')
app = nchantrs.Application(config, widget_dir='dashboard_widgets/')
# Connect to multiple databases
app.init_databases(['db1.db', 'db2.db'])
# Display data in UI
app.update_table('dashboard_table', query='SELECT * FROM metrics')
app.run()
```
## Configuration Guide
Each YAML config must include:
- `app_name`: String identifier for the application
- `ui`: Dictionary defining windows, widgets, layouts, and events
- `database`: Details for SQLite connections, schemas, and FxSQuiRL settings
- `widgets`: Optional mappings to Python files for custom logic
For advanced customization, refer to the [docs/config-reference.md](docs/config-reference.md).
## Contributing
Contributions are welcome! Please follow these steps:
1. Fork the repository.
2. Create a feature branch (`git checkout -b feature/<FEATURE_NAME>`).
3. Commit your changes (`git commit -am 'Add some feature'`).
4. Push to the branch (`git push origin feature/<FEATURE_NAME>`).
5. Open a Pull Request.
See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
## License
This project is licensed under the <LICENSE_TYPE> License - see the [LICENSE](LICENSE) file for details.
## Acknowledgments
- Built with inspiration from open-source GUI and database communities.
- Thanks to contributors of underlying libraries like <PYQT_LIB>, FxSQuiRL.
Metadata
Release files for nchantrs 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nchantrs-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.39+ x86-64 | Details for nchantrs-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl |
Release files / nchantrs-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl
| Download URL | nchantrs-0.0.1-cp312-cp312-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.12 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
9e26bd6764b78bf8c267f0732810cdc62f97775d03d6bcefe56fb83c6b84a0b8
|
|
BLAKE2b-256 checksum How to use checksums |
311d077e41a7a69cf33503b26e23409adeb318f01cf1250ad81c11d7447b3649
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for nchantrs 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.