pyconfviewer


Namepyconfviewer JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryA Python library for generating HTML views and diffs for configuration files.
upload_time2024-11-02 10:01:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords configuration html diff yaml json env
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyconfviewer

`pyconfviewer` is a Python library designed for viewing and comparing configuration files in various formats such as YAML, JSON, INI, and .env. It simplifies the management and review of configuration files by generating visual HTML reports.

Please let me know if you use the other configuration files as issues or pull requests. I will try to add support for them.

## Features

- Supports loading configurations in multiple formats: YAML, JSON, INI, and .env
- Generates HTML reports for easy visualization of configurations
- Compares configurations between two directories, highlighting differences in HTML format
- Easily installable and runnable with simple command examples

## Requirements

- Python 3.8 or higher(latest version is 3.13 as of now)

## Installation

`pyconfviewer` is available on PyPI. Install it with:

```bash
pip install pyconfviewer
```

## Usage

After installation, use `pyconfviewer` in your own scripts to generate configuration reports or compare configuration files.
Please see the example/run_generator.py script below for a demonstration.

### 1. Generate an HTML report of configuration files

The following example script, `rungenerator.py`, reads configuration files from a specified directory and generates an HTML report at `config_report.html`.

```python
import os
from pyconfviewer.config_generator import ConfigGenerator

# Define the configuration directory
config_dir = "path/to/config_a"
output_dir = "output"
config_html = os.path.join(output_dir, "config_report.html")

# Create an instance of ConfigGenerator and generate the HTML report
config_generator = ConfigGenerator()
configs = config_generator.load_configs(config_dir)
config_generator.generate_config_html(configs, output_dir=output_dir, output_html_path=config_html)

print(f"Configuration HTML generated at {config_html}")
```

Example output:

![config_report.html](https://github.com/pkaiy81/pyconfviewer/blob/main/examples/images/image.png)

### 2. Generate an HTML diff report comparing two configuration directories

Compare configuration files in two directories and generate an HTML report at `diff_report.html`.

```python
from pyconfviewer.diff_generator import DiffGenerator

# Define the configuration directories to compare
config_a_dir = "path/to/config_a"
config_b_dir = "path/to/config_b"
diff_html = os.path.join(output_dir, "diff_report.html")

# Create an instance of DiffGenerator and generate the HTML diff report
diff_generator = DiffGenerator()
configs_a = config_generator.load_configs(config_a_dir)
configs_b = config_generator.load_configs(config_b_dir)
diffs = diff_generator.generate_diff(configs_a, configs_b)
diff_generator.generate_diff_html(diffs, output_dir=output_dir, output_html_path=diff_html)

print(f"Diff HTML generated at {diff_html}")
```

Example output:
![diif_report.html](https://github.com/pkaiy81/pyconfviewer/blob/develop/examples/images/image-1.png)

## Contributing

`pyconfviewer` is an open-source project, and contributions are welcome!
If you have ideas for improvements or would like to fix bugs, please feel free to submit a pull request.

For more details, see [CONTRIBUTION.md](CONTRIBUTION.md).

## License

This project is licensed under the [MIT License](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyconfviewer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "configuration, HTML, diff, YAML, JSON, env",
    "author": null,
    "author_email": "pkaiy81 <pkaiy81@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/49/4e/89c0db8ec404eba7478734300ebfaa5d4da3e81255de4dd6e79947ff70c1/pyconfviewer-0.1.1.tar.gz",
    "platform": null,
    "description": "# pyconfviewer\r\n\r\n`pyconfviewer` is a Python library designed for viewing and comparing configuration files in various formats such as YAML, JSON, INI, and .env. It simplifies the management and review of configuration files by generating visual HTML reports.\r\n\r\nPlease let me know if you use the other configuration files as issues or pull requests. I will try to add support for them.\r\n\r\n## Features\r\n\r\n- Supports loading configurations in multiple formats: YAML, JSON, INI, and .env\r\n- Generates HTML reports for easy visualization of configurations\r\n- Compares configurations between two directories, highlighting differences in HTML format\r\n- Easily installable and runnable with simple command examples\r\n\r\n## Requirements\r\n\r\n- Python 3.8 or higher(latest version is 3.13 as of now)\r\n\r\n## Installation\r\n\r\n`pyconfviewer` is available on PyPI. Install it with:\r\n\r\n```bash\r\npip install pyconfviewer\r\n```\r\n\r\n## Usage\r\n\r\nAfter installation, use `pyconfviewer` in your own scripts to generate configuration reports or compare configuration files.\r\nPlease see the example/run_generator.py script below for a demonstration.\r\n\r\n### 1. Generate an HTML report of configuration files\r\n\r\nThe following example script, `rungenerator.py`, reads configuration files from a specified directory and generates an HTML report at `config_report.html`.\r\n\r\n```python\r\nimport os\r\nfrom pyconfviewer.config_generator import ConfigGenerator\r\n\r\n# Define the configuration directory\r\nconfig_dir = \"path/to/config_a\"\r\noutput_dir = \"output\"\r\nconfig_html = os.path.join(output_dir, \"config_report.html\")\r\n\r\n# Create an instance of ConfigGenerator and generate the HTML report\r\nconfig_generator = ConfigGenerator()\r\nconfigs = config_generator.load_configs(config_dir)\r\nconfig_generator.generate_config_html(configs, output_dir=output_dir, output_html_path=config_html)\r\n\r\nprint(f\"Configuration HTML generated at {config_html}\")\r\n```\r\n\r\nExample output:\r\n\r\n![config_report.html](https://github.com/pkaiy81/pyconfviewer/blob/main/examples/images/image.png)\r\n\r\n### 2. Generate an HTML diff report comparing two configuration directories\r\n\r\nCompare configuration files in two directories and generate an HTML report at `diff_report.html`.\r\n\r\n```python\r\nfrom pyconfviewer.diff_generator import DiffGenerator\r\n\r\n# Define the configuration directories to compare\r\nconfig_a_dir = \"path/to/config_a\"\r\nconfig_b_dir = \"path/to/config_b\"\r\ndiff_html = os.path.join(output_dir, \"diff_report.html\")\r\n\r\n# Create an instance of DiffGenerator and generate the HTML diff report\r\ndiff_generator = DiffGenerator()\r\nconfigs_a = config_generator.load_configs(config_a_dir)\r\nconfigs_b = config_generator.load_configs(config_b_dir)\r\ndiffs = diff_generator.generate_diff(configs_a, configs_b)\r\ndiff_generator.generate_diff_html(diffs, output_dir=output_dir, output_html_path=diff_html)\r\n\r\nprint(f\"Diff HTML generated at {diff_html}\")\r\n```\r\n\r\nExample output:\r\n![diif_report.html](https://github.com/pkaiy81/pyconfviewer/blob/develop/examples/images/image-1.png)\r\n\r\n## Contributing\r\n\r\n`pyconfviewer` is an open-source project, and contributions are welcome!\r\nIf you have ideas for improvements or would like to fix bugs, please feel free to submit a pull request.\r\n\r\nFor more details, see [CONTRIBUTION.md](CONTRIBUTION.md).\r\n\r\n## License\r\n\r\nThis project is licensed under the [MIT License](LICENSE).\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python library for generating HTML views and diffs for configuration files.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/pkaiy81/pyconfviewer"
    },
    "split_keywords": [
        "configuration",
        " html",
        " diff",
        " yaml",
        " json",
        " env"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "18fe03fbf750328eee0147f27bdba687c52576c33ce3d73cf03ca849336820ce",
                "md5": "c0310abb29f61d8cb1ca1737d49d0357",
                "sha256": "50a96f6009043ecb76930bd9eb3f105057ce4342c3943cbde7fe171816703b4d"
            },
            "downloads": -1,
            "filename": "pyconfviewer-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0310abb29f61d8cb1ca1737d49d0357",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7920,
            "upload_time": "2024-11-02T10:01:19",
            "upload_time_iso_8601": "2024-11-02T10:01:19.400759Z",
            "url": "https://files.pythonhosted.org/packages/18/fe/03fbf750328eee0147f27bdba687c52576c33ce3d73cf03ca849336820ce/pyconfviewer-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "494e89c0db8ec404eba7478734300ebfaa5d4da3e81255de4dd6e79947ff70c1",
                "md5": "315e51b1c7a2755d638b8c95c593e9f2",
                "sha256": "88f7734b4d4f7e694b0362c96f67255f2b6604581f853aa36de968fd5335c87f"
            },
            "downloads": -1,
            "filename": "pyconfviewer-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "315e51b1c7a2755d638b8c95c593e9f2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8289,
            "upload_time": "2024-11-02T10:01:20",
            "upload_time_iso_8601": "2024-11-02T10:01:20.888384Z",
            "url": "https://files.pythonhosted.org/packages/49/4e/89c0db8ec404eba7478734300ebfaa5d4da3e81255de4dd6e79947ff70c1/pyconfviewer-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-02 10:01:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pkaiy81",
    "github_project": "pyconfviewer",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyconfviewer"
}
        
Elapsed time: 0.37082s