Skip to main content

Nchantrs

    [![Python Version](https://img.shields.io/pypi/pyversions/nchantrs)](https://pypi.org/project/nchantrs/)
    [![License](https://img.shields.io/pypi/l/nchantrs)](LICENSE)
    [![Status](https://img.shields.io/pypi/status/nchantrs)](https://pypi.org/project/nchantrs/)
    [![Downloads](https://img.shields.io/pypi/dm/nchantrs)](https://pypi.org/project/nchantrs/)
    
    [![CI](https://github.com/solutionsbrewer/nchantrs/actions/workflows/ci.yml/badge.svg)](https://github.com/solutionsbrewer/nchantrs/actions)
    [![codecov](https://codecov.io/gh/solutionsbrewer/nchantrs/branch/main/graph/badge.svg)](https://codecov.io/gh/solutionsbrewer/nchantrs)
    [![Code Quality](https://img.shields.io/badge/code%20quality-95%25-success)](https://github.com/solutionsbrewer/nchantrs)
    
    [![PyPI Version](https://img.shields.io/pypi/v/nchantrs)](https://pypi.org/project/nchantrs/)
    [![Python Versions](https://img.shields.io/pypi/pyversions/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.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nchantrs 0.0.1.post1
File Size Uploaded Provenance Actions
nchantrs-0.0.1.post1.tar.gz 3.6 MB Without provenance Details for nchantrs-0.0.1.post1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nchantrs 0.0.1.post1
File Interpreter ABI Platform Actions
nchantrs-0.0.1.post1-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.post1-cp312-cp312-manylinux_2_39_x86_64.whl

Total release size: 8.1 MB

Release files / nchantrs-0.0.1.post1.tar.gz

Download URL nchantrs-0.0.1.post1.tar.gz
Size 3.6 MB
Tags Source
SHA-256 checksum
How to use checksums
75e4ef0d76586fa05b2db7397f6c52d595d8443a93d3b7663ac5326f7fa434c4
BLAKE2b-256 checksum
How to use checksums
40321a8aff5cc8bd2420866b4e2d0bf34f1e47b2768ca757634339823a0677ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / nchantrs-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl

Download URL nchantrs-0.0.1.post1-cp312-cp312-manylinux_2_39_x86_64.whl
Size 4.5 MB
Tags CPython 3.12 Linux glibc 2.39+ x86-64
SHA-256 checksum
How to use checksums
7b98e320297c44c4771d5725f5a50d2f3252ca1621b5660e88c174638fc66e65
BLAKE2b-256 checksum
How to use checksums
7541f62a33be9f1b6cb85ad6d56ea8930f1dc7242f82bab5f8c873f8181c0f25
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.post1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page