YMLEditor


NameYMLEditor JSON
Version 0.3.2 PyPI version JSON
download
home_pageNone
SummaryYMLEditor is a package for quickly creating editors for simple YAML configuration files.
upload_time2025-01-19 17:43:26
maintainerNone
docs_urlNone
authorcorb
requires_python>=3.8
licenseNone
keywords yaml configuration editor
VCS
bugtrack_url
requirements pytest PyQt6 PyYAML
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Readme

<img width="622" alt="sample" src="https://github.com/corb555/YMLEditor/blob/62749ffe58806449d0adba7040e1157ae4b184c2/images/YMLEditor.png?raw=true">

## Overview

`YMLEditor` is a package for easily creating editors for YAML configuration files.  

## Features

**SettingsWidget** provides a Widget for displaying and editing config file fields. You
simply list the fields with their config key and the widget type you want for 
each (line_edit, text_edit, etc.). You can also add a regex for data entry validation. 
The SettingsWiget and YamlConfig  will
read the config file, display the fields for editing, and then save the data.

- **Easy Front-End Creation:** Create a configuration editor with a few lines of code.
- **Configurable Layout:** Displays settings using the format you provide.
- **Input Validation:** Validates input based on supplied regular expressions and 
highlights invalid entries. In the sample above, Tip Amount is highlighted because it contains letters.
- **Data Syncing:** Synchronizes data values between the UI and the config file, seamlessly using the
  ConfigFile manager described below.
- **Utilizes PyQt6 or PySide6**

**Supported Widgets** 

- text_edit - options=regex for validation
- line_edit - options=regex for validation
- read_only - a read-only line_edit
- combo - options=[comboBox items]
- checkbox
- spinbox - floating point spin box.  options=[min, max, step, precision]
- slider - options=[min, max]
- label

**YamlConfig** provides functionality for creating, loading, updating, and saving YAML files using PyYAML.

- **Load / Save / Create** Provides interfaces to load and save YAML files and to create new YAML files.
- **Get / Set Operations:** Provides simple key/value access to data fields in the YAML configuration, including
scalars (int, float, str, bool, date), lists, and dictionaries.  _Complex  hierarchies are not supported._
- **Undo Support:** Keeps a snapshot for each save _in session_ and restores from stack.
- **Granular Dependency Management:** For build system integration, this can be configured to touch a proxy file 
when a specified field changes, offering more granular dependency tracking for build systems.

## Installation

To install `YMLEditor`:
Select the install below depending on whether you want to use PyQt6 or PySide6.  Both have identical functionality.

```bash
pip install YMLEditor[pyqt]  # Installs PyQt6, or:
pip install YMLEditor[pyside]  # Installs PySide6
```

### Format Layout

Each line in the format corresponds to a field in the config file and contains the following:  
`ConfigKey: (DisplayName, WidgetType, Options, Width, <style>)`

- Config Key: The name of the item in the YAML config file
- Display Name: The name to show in the UI.
- Widget Type: The type of input control (see **Supported Widgets** above)
- Options: Either a regex pattern for field validation (e.g., line_edit), 
       or options for the widget
- Field Width: Width of the widget.
- Style: (optional) Contains a QT style for the widget. e.g. "color: slategray;"),

### Sample layout format

```python
formats = {
        "layout1": {
            "TIP": ("Tip Amount", "line_edit", r'^\d{1,2}$', 50),
            "DESSERT": ("Dessert", "combo", ["Tiramisu", "Apple Tart", "Cheesecake"], 200),
            "HOME": ("Home", "combo", ["A", "B", "C", "D"], 200),
            "SITES.@HOME": ("Preferred", "read_only", None, 180, "color: slategray;"),
            "SITES.B": ("Location B", "line_edit", None, 180),
            "SITES": ("Sites", "line_edit", None, 500),
            "BRIGHT": ("Brightness", "slider", [0, 10], 200),
            "EXPERT": ("Expert", "checkbox", None, 200),
            "VALUE": ("Value", "spinbox", [-.5, 1.5, .1, 1], 200),
        },
    }
```
- SITES.@HOME - If '@' is present, that key will be looked up and replace by its contents (SITES.A in this example)
- SITES.B - You can access sub hierarchies by using "." to separate keys (Boston in this example)
- TIP - The regex for Tips highlights entries that aren't 1 or 2 digits.

### Sample YAML file

```yaml
DESSERT: Apple Tart
TIP: 18
HOME: A
SITES:
  A: Albany
  B: Boston
  C: Chicago
BRIGHT: 3
EXPERT: '0'
VALUE: -0.3
  ```

### Sample App

Sample.py is provided to demonstrate the capabilities of `YMLEditor` with a sample YAML file.

## License

`YMLEditor` is licensed under the MIT License. See [LICENSE](LICENSE) for details.

## NOTES
- Only basic YAML syntax is supported:
- Data type specification tags such as !!int, !!float, etc. are ignored
- Anchors and aliases are not supported
- Comments are stripped

## Source Code Documentation
[Source Documentation](https://htmlpreview.github.io/?https://github.com/corb555/YMLEditor/blob/main/docs/_build/html/index.html)

## Support
To report an issue, please visit the [issue tracker](https://github.com/corb555/YMLEditor/issues).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "YMLEditor",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "YAML, configuration, editor",
    "author": "corb",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# Readme\n\n<img width=\"622\" alt=\"sample\" src=\"https://github.com/corb555/YMLEditor/blob/62749ffe58806449d0adba7040e1157ae4b184c2/images/YMLEditor.png?raw=true\">\n\n## Overview\n\n`YMLEditor` is a package for easily creating editors for YAML configuration files.  \n\n## Features\n\n**SettingsWidget** provides a Widget for displaying and editing config file fields. You\nsimply list the fields with their config key and the widget type you want for \neach (line_edit, text_edit, etc.). You can also add a regex for data entry validation. \nThe SettingsWiget and YamlConfig  will\nread the config file, display the fields for editing, and then save the data.\n\n- **Easy Front-End Creation:** Create a configuration editor with a few lines of code.\n- **Configurable Layout:** Displays settings using the format you provide.\n- **Input Validation:** Validates input based on supplied regular expressions and \nhighlights invalid entries. In the sample above, Tip Amount is highlighted because it contains letters.\n- **Data Syncing:** Synchronizes data values between the UI and the config file, seamlessly using the\n  ConfigFile manager described below.\n- **Utilizes PyQt6 or PySide6**\n\n**Supported Widgets** \n\n- text_edit - options=regex for validation\n- line_edit - options=regex for validation\n- read_only - a read-only line_edit\n- combo - options=[comboBox items]\n- checkbox\n- spinbox - floating point spin box.  options=[min, max, step, precision]\n- slider - options=[min, max]\n- label\n\n**YamlConfig** provides functionality for creating, loading, updating, and saving YAML files using PyYAML.\n\n- **Load / Save / Create** Provides interfaces to load and save YAML files and to create new YAML files.\n- **Get / Set Operations:** Provides simple key/value access to data fields in the YAML configuration, including\nscalars (int, float, str, bool, date), lists, and dictionaries.  _Complex  hierarchies are not supported._\n- **Undo Support:** Keeps a snapshot for each save _in session_ and restores from stack.\n- **Granular Dependency Management:** For build system integration, this can be configured to touch a proxy file \nwhen a specified field changes, offering more granular dependency tracking for build systems.\n\n## Installation\n\nTo install `YMLEditor`:\nSelect the install below depending on whether you want to use PyQt6 or PySide6.  Both have identical functionality.\n\n```bash\npip install YMLEditor[pyqt]  # Installs PyQt6, or:\npip install YMLEditor[pyside]  # Installs PySide6\n```\n\n### Format Layout\n\nEach line in the format corresponds to a field in the config file and contains the following:  \n`ConfigKey: (DisplayName, WidgetType, Options, Width, <style>)`\n\n- Config Key: The name of the item in the YAML config file\n- Display Name: The name to show in the UI.\n- Widget Type: The type of input control (see **Supported Widgets** above)\n- Options: Either a regex pattern for field validation (e.g., line_edit), \n       or options for the widget\n- Field Width: Width of the widget.\n- Style: (optional) Contains a QT style for the widget. e.g. \"color: slategray;\"),\n\n### Sample layout format\n\n```python\nformats = {\n        \"layout1\": {\n            \"TIP\": (\"Tip Amount\", \"line_edit\", r'^\\d{1,2}$', 50),\n            \"DESSERT\": (\"Dessert\", \"combo\", [\"Tiramisu\", \"Apple Tart\", \"Cheesecake\"], 200),\n            \"HOME\": (\"Home\", \"combo\", [\"A\", \"B\", \"C\", \"D\"], 200),\n            \"SITES.@HOME\": (\"Preferred\", \"read_only\", None, 180, \"color: slategray;\"),\n            \"SITES.B\": (\"Location B\", \"line_edit\", None, 180),\n            \"SITES\": (\"Sites\", \"line_edit\", None, 500),\n            \"BRIGHT\": (\"Brightness\", \"slider\", [0, 10], 200),\n            \"EXPERT\": (\"Expert\", \"checkbox\", None, 200),\n            \"VALUE\": (\"Value\", \"spinbox\", [-.5, 1.5, .1, 1], 200),\n        },\n    }\n```\n- SITES.@HOME - If '@' is present, that key will be looked up and replace by its contents (SITES.A in this example)\n- SITES.B - You can access sub hierarchies by using \".\" to separate keys (Boston in this example)\n- TIP - The regex for Tips highlights entries that aren't 1 or 2 digits.\n\n### Sample YAML file\n\n```yaml\nDESSERT: Apple Tart\nTIP: 18\nHOME: A\nSITES:\n  A: Albany\n  B: Boston\n  C: Chicago\nBRIGHT: 3\nEXPERT: '0'\nVALUE: -0.3\n  ```\n\n### Sample App\n\nSample.py is provided to demonstrate the capabilities of `YMLEditor` with a sample YAML file.\n\n## License\n\n`YMLEditor` is licensed under the MIT License. See [LICENSE](LICENSE) for details.\n\n## NOTES\n- Only basic YAML syntax is supported:\n- Data type specification tags such as !!int, !!float, etc. are ignored\n- Anchors and aliases are not supported\n- Comments are stripped\n\n## Source Code Documentation\n[Source Documentation](https://htmlpreview.github.io/?https://github.com/corb555/YMLEditor/blob/main/docs/_build/html/index.html)\n\n## Support\nTo report an issue, please visit the [issue tracker](https://github.com/corb555/YMLEditor/issues).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "YMLEditor is a package for quickly creating editors for simple YAML configuration files.",
    "version": "0.3.2",
    "project_urls": {
        "Repository": "https://github.com/corb555/YMLEditor"
    },
    "split_keywords": [
        "yaml",
        " configuration",
        " editor"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "84db2fe62702795c8399a09b15646b7a844ed1ba1c05f1940a09c8e5d4956e06",
                "md5": "f7595719eecf333eb081e663d502fe1c",
                "sha256": "e118cc855ced47b5b57f2da05858d60f1a4a7fc09b19f6d91513fef33172e2ec"
            },
            "downloads": -1,
            "filename": "YMLEditor-0.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f7595719eecf333eb081e663d502fe1c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 68067,
            "upload_time": "2025-01-19T17:43:26",
            "upload_time_iso_8601": "2025-01-19T17:43:26.563914Z",
            "url": "https://files.pythonhosted.org/packages/84/db/2fe62702795c8399a09b15646b7a844ed1ba1c05f1940a09c8e5d4956e06/YMLEditor-0.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-19 17:43:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "corb555",
    "github_project": "YMLEditor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "8.3.3"
                ]
            ]
        },
        {
            "name": "PyQt6",
            "specs": [
                [
                    ">=",
                    "6.6.1"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    ">=",
                    "6.0.2"
                ]
            ]
        }
    ],
    "lcname": "ymleditor"
}
        
Elapsed time: 0.45138s