cs-configutils


Namecs-configutils JSON
Version 20250103 PyPI version JSON
download
home_pageNone
SummaryUtility functions and classes for .ini style configuration files.
upload_time2025-01-03 04:27:00
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseGNU General Public License v3 or later (GPLv3+)
keywords python2 python3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Utility functions and classes for .ini style configuration files.

*Latest release 20250103*:
Import and requirement update for recent changes elsewhere.

## <a name="ConfigSectionWatcher"></a>Class `ConfigSectionWatcher(collections.abc.Mapping)`

A class for monitoring a particular clause in a config file.

*`ConfigSectionWatcher.__init__(self, config, section, defaults=None)`*:
Initialise a `ConfigSectionWatcher` to monitor a particular section
of a config file.
`config`: path of config file or `ConfigWatcher`
`section`: the section to watch
`defaults`: the defaults section to use, default 'DEFAULT'

*`ConfigSectionWatcher.__getitem__(self, key)`*:
#### Mapping methods.

*`ConfigSectionWatcher.as_dict(self)`*:
Return the config section as a `dict`.

*`ConfigSectionWatcher.keys(self)`*:
Return the keys of the config section.

*`ConfigSectionWatcher.path`*:
The pathname of the config file.

## <a name="ConfigWatcher"></a>Class `ConfigWatcher(collections.abc.Mapping)`

A monitor for a windows style `.ini` file.
The current `SafeConfigParser` object is presented as the `.config` property.

*`ConfigWatcher.__getitem__(self, section)`*:
Return the `ConfigSectionWatcher` for the specified section.

*`ConfigWatcher.as_dict(self)`*:
Construct and return a dictionary containing an entry for each section
whose value is a dictionary of section items and values.

*`ConfigWatcher.config`*:
Live configuration.

*`ConfigWatcher.path`*:
The path to the config file.

*`ConfigWatcher.section_keys(self, section)`*:
Return the field names for the specified section.

*`ConfigWatcher.section_value(self, section, key)`*:
Return the value of [section]key.

## <a name="HasConfigIni"></a>Class `HasConfigIni`

Class for objects with a `config.ini` file.
A section of the config is designated "our" configuration
and its fields parsed into a `TagSet`;
in particular the field values use the `TagSet` transcription syntax.

The default implementation is expected to be mixed into a
class with a `.pathto(rpath)` method, such as one which
inherits from `HasFSPath`.

The mixin provides the following attributes:
* `config`: an on demand property which is a `TagSet` made
  from the configuration file section
* `config_ini`: the relative path to the configuration file
* `configpath`: the full pathname of the configuration file
* `config_flush()`: update the configuration file if the tags
  have been modified

*`HasConfigIni.__init__(self, section, config_ini=None)`*:
Initialise the configuration.

*`HasConfigIni.config`*:
The configuration as a `TagSet`.

*`HasConfigIni.config_flush(self)`*:
Save the current configuration to the `config.ini` file if `self.__modified`.

*`HasConfigIni.configpath`*:
The path to the `config.ini` file.

*`HasConfigIni.info_dict(self, d=None)`*:
Return an informational `dict` containing salient information
about this `HasCOnfigIni`, handy for use with `pprint()`.

## <a name="load_config"></a>`load_config(config_path, parser=None)`

Load a configuration from the named `config_path`.

If `parser` is missing or `None`, use `SafeConfigParser` (just
`ConfigParser` in Python 3).
Return the parser.

# Release Log



*Release 20250103*:
Import and requirement update for recent changes elsewhere.

*Release 20220606*:
HasConfigIni: new info_dict() method (name subject to change) to return a descriptive dict, part of a new scheme I'm trying out to report summary data from commands.

*Release 20220430*:
New HasConfigIni mixin for classes keeping some configuration in a .ini config file section.

*Release 20210306*:
Fix imports from collections.abc.

*Release 20190101*:
Internal changes.

*Release 20160828*:
Update metadata with "install_requires" instead of "requires".

*Release 20150118*:
Initial PyPI release.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cs-configutils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python2, python3",
    "author": null,
    "author_email": "Cameron Simpson <cs@cskk.id.au>",
    "download_url": "https://files.pythonhosted.org/packages/f0/9c/9c9ee02fb86bf5ec4c9da3c44e08d0fee1ca33de6f06e4af5bb7ba97d200/cs_configutils-20250103.tar.gz",
    "platform": null,
    "description": "Utility functions and classes for .ini style configuration files.\n\n*Latest release 20250103*:\nImport and requirement update for recent changes elsewhere.\n\n## <a name=\"ConfigSectionWatcher\"></a>Class `ConfigSectionWatcher(collections.abc.Mapping)`\n\nA class for monitoring a particular clause in a config file.\n\n*`ConfigSectionWatcher.__init__(self, config, section, defaults=None)`*:\nInitialise a `ConfigSectionWatcher` to monitor a particular section\nof a config file.\n`config`: path of config file or `ConfigWatcher`\n`section`: the section to watch\n`defaults`: the defaults section to use, default 'DEFAULT'\n\n*`ConfigSectionWatcher.__getitem__(self, key)`*:\n#### Mapping methods.\n\n*`ConfigSectionWatcher.as_dict(self)`*:\nReturn the config section as a `dict`.\n\n*`ConfigSectionWatcher.keys(self)`*:\nReturn the keys of the config section.\n\n*`ConfigSectionWatcher.path`*:\nThe pathname of the config file.\n\n## <a name=\"ConfigWatcher\"></a>Class `ConfigWatcher(collections.abc.Mapping)`\n\nA monitor for a windows style `.ini` file.\nThe current `SafeConfigParser` object is presented as the `.config` property.\n\n*`ConfigWatcher.__getitem__(self, section)`*:\nReturn the `ConfigSectionWatcher` for the specified section.\n\n*`ConfigWatcher.as_dict(self)`*:\nConstruct and return a dictionary containing an entry for each section\nwhose value is a dictionary of section items and values.\n\n*`ConfigWatcher.config`*:\nLive configuration.\n\n*`ConfigWatcher.path`*:\nThe path to the config file.\n\n*`ConfigWatcher.section_keys(self, section)`*:\nReturn the field names for the specified section.\n\n*`ConfigWatcher.section_value(self, section, key)`*:\nReturn the value of [section]key.\n\n## <a name=\"HasConfigIni\"></a>Class `HasConfigIni`\n\nClass for objects with a `config.ini` file.\nA section of the config is designated \"our\" configuration\nand its fields parsed into a `TagSet`;\nin particular the field values use the `TagSet` transcription syntax.\n\nThe default implementation is expected to be mixed into a\nclass with a `.pathto(rpath)` method, such as one which\ninherits from `HasFSPath`.\n\nThe mixin provides the following attributes:\n* `config`: an on demand property which is a `TagSet` made\n  from the configuration file section\n* `config_ini`: the relative path to the configuration file\n* `configpath`: the full pathname of the configuration file\n* `config_flush()`: update the configuration file if the tags\n  have been modified\n\n*`HasConfigIni.__init__(self, section, config_ini=None)`*:\nInitialise the configuration.\n\n*`HasConfigIni.config`*:\nThe configuration as a `TagSet`.\n\n*`HasConfigIni.config_flush(self)`*:\nSave the current configuration to the `config.ini` file if `self.__modified`.\n\n*`HasConfigIni.configpath`*:\nThe path to the `config.ini` file.\n\n*`HasConfigIni.info_dict(self, d=None)`*:\nReturn an informational `dict` containing salient information\nabout this `HasCOnfigIni`, handy for use with `pprint()`.\n\n## <a name=\"load_config\"></a>`load_config(config_path, parser=None)`\n\nLoad a configuration from the named `config_path`.\n\nIf `parser` is missing or `None`, use `SafeConfigParser` (just\n`ConfigParser` in Python 3).\nReturn the parser.\n\n# Release Log\n\n\n\n*Release 20250103*:\nImport and requirement update for recent changes elsewhere.\n\n*Release 20220606*:\nHasConfigIni: new info_dict() method (name subject to change) to return a descriptive dict, part of a new scheme I'm trying out to report summary data from commands.\n\n*Release 20220430*:\nNew HasConfigIni mixin for classes keeping some configuration in a .ini config file section.\n\n*Release 20210306*:\nFix imports from collections.abc.\n\n*Release 20190101*:\nInternal changes.\n\n*Release 20160828*:\nUpdate metadata with \"install_requires\" instead of \"requires\".\n\n*Release 20150118*:\nInitial PyPI release.\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3 or later (GPLv3+)",
    "summary": "Utility functions and classes for .ini style configuration files.",
    "version": "20250103",
    "project_urls": {
        "MonoRepo Commits": "https://bitbucket.org/cameron_simpson/css/commits/branch/main",
        "Monorepo Git Mirror": "https://github.com/cameron-simpson/css",
        "Monorepo Hg/Mercurial Mirror": "https://hg.sr.ht/~cameron-simpson/css",
        "Source": "https://github.com/cameron-simpson/css/blob/main/lib/python/cs/configutils.py"
    },
    "split_keywords": [
        "python2",
        " python3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c3e46151330309bdfd54e78becee35e5972aeeb741d546c1ce7f482cf27272d0",
                "md5": "120d06d4369e687f8a1a4eb65d4a217e",
                "sha256": "7409ea168009d6ccffcbedbf24416f5b37a5abfb3c0c0a53ca5bdce3edff91c1"
            },
            "downloads": -1,
            "filename": "cs_configutils-20250103-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "120d06d4369e687f8a1a4eb65d4a217e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5196,
            "upload_time": "2025-01-03T04:26:57",
            "upload_time_iso_8601": "2025-01-03T04:26:57.141640Z",
            "url": "https://files.pythonhosted.org/packages/c3/e4/6151330309bdfd54e78becee35e5972aeeb741d546c1ce7f482cf27272d0/cs_configutils-20250103-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f09c9c9ee02fb86bf5ec4c9da3c44e08d0fee1ca33de6f06e4af5bb7ba97d200",
                "md5": "23d9b8e9412098403a69847efdb72750",
                "sha256": "997138cf0b643dc7dd4ebc4c8a78861a2b972964e6211718e3e99df87e75f914"
            },
            "downloads": -1,
            "filename": "cs_configutils-20250103.tar.gz",
            "has_sig": false,
            "md5_digest": "23d9b8e9412098403a69847efdb72750",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4822,
            "upload_time": "2025-01-03T04:27:00",
            "upload_time_iso_8601": "2025-01-03T04:27:00.424062Z",
            "url": "https://files.pythonhosted.org/packages/f0/9c/9c9ee02fb86bf5ec4c9da3c44e08d0fee1ca33de6f06e4af5bb7ba97d200/cs_configutils-20250103.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-03 04:27:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cameron-simpson",
    "github_project": "css",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "cs-configutils"
}
        
Elapsed time: 0.46850s