cfg-diag


Namecfg-diag JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/storpool/python-cfg_diag
SummaryA common configuration-storage class with a .diag() method
upload_time2021-03-31 06:15:17
maintainer
docs_urlNone
authorPeter Pentchev
requires_python
licenseBSD-2
keywords version
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # A common configuration-storage class with a .diag() method

## Description

This module provides four classes that may be used as base classes for
storing program runtime configuration with a `verbose` boolean field.
The classes provide a `.diag(msg)` method that decides whether to
output the provided message based on the value of the object's
`verbose` field.

The `ConfigDiagUnfrozen` and `ConfigDiagUnfrozenStdOut` classes are
normal dataclasses, while the `ConfigDiag` and `ConfigDiagStdOut` ones
are frozen.

The `ConfigDiag` and `ConfigDiagUnfrozen` classes will output any
diagnostic messages to the standard error stream, while
the `ConfigDiagStdOut` and `ConfigDiagUnfrozenStdOut` ones will output
the diagnostic messages to the standard output stream.

## Example

Subclass the frozen `ConfigDiag` class, add a program-specific field:

    @dataclasses.dataclass(frozen=True)
    class Config(cfg_diag.ConfigDiag):
        """Runtime configuration for the fribble program."""
        path: pathlib.Path

Initialize this class from an argument parser object:

    return Config(path=args.path, verbose=args.verbose)

Output a diagnostic message if requested:

    cfg.diag("This will either appear or it will not")

## Contact

This module is [developed in a GitHub repository][github].
Contact [the StorPool support team][support] for information.

[github]: https://github.com/storpool/python-cfg_diag
[support]: mailto:support@storpool.com

## Version history

### 0.1.1

- move some tool configuration options to setup.py and pyproject.toml
- add Python 3.9 as a supported version
- use unittest.mock instead of mock
- fix a code comment
- add a manifest to include more files in the source distribution

### 0.1.0

- first public release
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/storpool/python-cfg_diag",
    "name": "cfg-diag",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "version",
    "author": "Peter Pentchev",
    "author_email": "support@storpool.com",
    "download_url": "https://files.pythonhosted.org/packages/f3/5e/0e405a217e87f95316411435448da32570aca908a39f22ee49a23026bbb5/cfg_diag-0.1.1.tar.gz",
    "platform": "",
    "description": "# A common configuration-storage class with a .diag() method\n\n## Description\n\nThis module provides four classes that may be used as base classes for\nstoring program runtime configuration with a `verbose` boolean field.\nThe classes provide a `.diag(msg)` method that decides whether to\noutput the provided message based on the value of the object's\n`verbose` field.\n\nThe `ConfigDiagUnfrozen` and `ConfigDiagUnfrozenStdOut` classes are\nnormal dataclasses, while the `ConfigDiag` and `ConfigDiagStdOut` ones\nare frozen.\n\nThe `ConfigDiag` and `ConfigDiagUnfrozen` classes will output any\ndiagnostic messages to the standard error stream, while\nthe `ConfigDiagStdOut` and `ConfigDiagUnfrozenStdOut` ones will output\nthe diagnostic messages to the standard output stream.\n\n## Example\n\nSubclass the frozen `ConfigDiag` class, add a program-specific field:\n\n    @dataclasses.dataclass(frozen=True)\n    class Config(cfg_diag.ConfigDiag):\n        \"\"\"Runtime configuration for the fribble program.\"\"\"\n        path: pathlib.Path\n\nInitialize this class from an argument parser object:\n\n    return Config(path=args.path, verbose=args.verbose)\n\nOutput a diagnostic message if requested:\n\n    cfg.diag(\"This will either appear or it will not\")\n\n## Contact\n\nThis module is [developed in a GitHub repository][github].\nContact [the StorPool support team][support] for information.\n\n[github]: https://github.com/storpool/python-cfg_diag\n[support]: mailto:support@storpool.com\n\n## Version history\n\n### 0.1.1\n\n- move some tool configuration options to setup.py and pyproject.toml\n- add Python 3.9 as a supported version\n- use unittest.mock instead of mock\n- fix a code comment\n- add a manifest to include more files in the source distribution\n\n### 0.1.0\n\n- first public release",
    "bugtrack_url": null,
    "license": "BSD-2",
    "summary": "A common configuration-storage class with a .diag() method",
    "version": "0.1.1",
    "split_keywords": [
        "version"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c9bf399f69630b07f3de52f138484afc",
                "sha256": "41a1784932a6d710e4f6cde5a577259138663aeb19cbdf95fca2b7a04f7eb5f2"
            },
            "downloads": -1,
            "filename": "cfg_diag-0.1.1-py3-none-any.whl",
            "has_sig": true,
            "md5_digest": "c9bf399f69630b07f3de52f138484afc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5024,
            "upload_time": "2021-03-31T06:15:25",
            "upload_time_iso_8601": "2021-03-31T06:15:25.380918Z",
            "url": "https://files.pythonhosted.org/packages/74/89/5778587a31fa31bcb86cc82b56804b727f67f63de4a33c44a843d1cde7d7/cfg_diag-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "c865ba014ab14a60bc9777edcb7456b8",
                "sha256": "f9220236c35cb28ce17f351960376109e9a7ff552fa411c19827b91dc4f14cb6"
            },
            "downloads": -1,
            "filename": "cfg_diag-0.1.1.tar.gz",
            "has_sig": true,
            "md5_digest": "c865ba014ab14a60bc9777edcb7456b8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5405,
            "upload_time": "2021-03-31T06:15:17",
            "upload_time_iso_8601": "2021-03-31T06:15:17.191067Z",
            "url": "https://files.pythonhosted.org/packages/f3/5e/0e405a217e87f95316411435448da32570aca908a39f22ee49a23026bbb5/cfg_diag-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-03-31 06:15:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "storpool",
    "error": "Could not fetch GitHub repository",
    "lcname": "cfg-diag"
}
        
Elapsed time: 0.23678s