configparserc


Nameconfigparserc JSON
Version 2.0.2 PyPI version JSON
download
home_pagehttps://gitlab.com/onegreyonewhite/configparserc
SummaryPython (Cython) based implementation of ConfigParser based on POSIX and stdlib functions.
upload_time2023-11-03 16:44:40
maintainer
docs_urlNone
authorSergey Klyuykov
requires_python>=3.8
licenseApache Software License
keywords config configparser configparserc ini
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Fast ConfigParser
=================

.. image:: https://gitlab.com/onegreyonewhite/configparserc/badges/master/pipeline.svg
    :target: https://gitlab.com/onegreyonewhite/configparserc/commits/master
    :alt: Pipeline status

.. image:: https://gitlab.com/onegreyonewhite/configparserc/badges/master/coverage.svg
    :target: https://gitlab.com/onegreyonewhite/configparserc/pipelines
    :alt: Coverage report

.. image:: https://badge.fury.io/py/configparserc.svg
    :target: https://badge.fury.io/py/configparserc


Python (Cython) based implementation of ConfigParser based on POSIX and stdlib functions.
Wrapped via Cython, uses POSIX stat and libc stdio functions for read file.

Support converting values in formats:

*  `StrType` - force convert to string all values (defaults too).
*  `IntType` - convert values to integer (include suffixes 'K', 'M' and 'G' multiples of 1000).
*  `BytesSizeType` - convert values to integer size of bytes (include suffixes 'K', 'M' and 'G' multiples of 1024).
*  `BoolType` - convert 'False', 'false', 'True' and 'true' to valid Python bool type.
*  `IntSecondsType` - convert time to seconds. Uses 'pytimeparse' python package.
*  `TimedeltaType` - convert time to timdelta/relativedelta(if installed). Uses 'pytimeparse' python package.
*  `ListType` - convert separated by symbol (default is comma) string to list of values.
*  `JsonType` - convert json value to python value.


Usage
-----

Install package in your environment:

.. sourcecode:: bash

    pip install configparserc

Example code for parse ini-config:

.. sourcecode:: python

    import os
    from configparserc import config, tools


    class MainSection(config.AppendSection):
        """
        Simple section where:
        *  some_int_key has int value;
        *  some_bool_key has int value;
        *  some_list_key has semicolon separated list value;
        *  some_other_key has int value in bytes.

        and all values appends or override defaults.
        """
        type_some_int_key = config.IntType()
        type_some_bool_key = config.BoolType()
        type_some_list_key = config.ListType(separator=';')
        type_some_other_key = config.ListType(separator=';')


    config = config.ConfigParserC(
        # Override section class for section `main`
        section_overload={'main': MainSection},
        # Set deafults for all sections.
        section_defaults={
            'main': {
                'some_int_key': "123",
                'some_bool_key': "false",
                'some_list_key': "a;c;d"
            }
        },
        # Allow to use values from environment
        # via "{ENVIRONMENT_VAR}" values.
        format_kwargs=os.environ.copy()
    )

    config.parse_files(['/path/to/ini/config', '/other/path/to/ini/config'])
    config.parse_text('''
    [main]
    # Support comments
    ; in different ini formats.
    int_key = 1234
    ''')

    config_as_dict = config.all()


Authors
-------

Author:
    Sergey Klyuykov <onegreyonewhite@mail.ru>


Contributor(s):
    Kirill Bychkov <kirill970528@yandex.ru>


License
-------

The ConfigParserC Project (https://gitlab.com/onegreyonewhite/configparserc)
Copyright (C) 2019-2023 Sergey Klyuykov

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/onegreyonewhite/configparserc",
    "name": "configparserc",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "config,configparser,configparserc,ini",
    "author": "Sergey Klyuykov",
    "author_email": "onegreyonewhite@mail.ru",
    "download_url": "https://files.pythonhosted.org/packages/10/aa/55035569cf900f6fe7607a336566ec1aec597a527e60a96593e335ca90e1/configparserc-2.0.2.tar.gz",
    "platform": null,
    "description": "Fast ConfigParser\n=================\n\n.. image:: https://gitlab.com/onegreyonewhite/configparserc/badges/master/pipeline.svg\n    :target: https://gitlab.com/onegreyonewhite/configparserc/commits/master\n    :alt: Pipeline status\n\n.. image:: https://gitlab.com/onegreyonewhite/configparserc/badges/master/coverage.svg\n    :target: https://gitlab.com/onegreyonewhite/configparserc/pipelines\n    :alt: Coverage report\n\n.. image:: https://badge.fury.io/py/configparserc.svg\n    :target: https://badge.fury.io/py/configparserc\n\n\nPython (Cython) based implementation of ConfigParser based on POSIX and stdlib functions.\nWrapped via Cython, uses POSIX stat and libc stdio functions for read file.\n\nSupport converting values in formats:\n\n*  `StrType` - force convert to string all values (defaults too).\n*  `IntType` - convert values to integer (include suffixes 'K', 'M' and 'G' multiples of 1000).\n*  `BytesSizeType` - convert values to integer size of bytes (include suffixes 'K', 'M' and 'G' multiples of 1024).\n*  `BoolType` - convert 'False', 'false', 'True' and 'true' to valid Python bool type.\n*  `IntSecondsType` - convert time to seconds. Uses 'pytimeparse' python package.\n*  `TimedeltaType` - convert time to timdelta/relativedelta(if installed). Uses 'pytimeparse' python package.\n*  `ListType` - convert separated by symbol (default is comma) string to list of values.\n*  `JsonType` - convert json value to python value.\n\n\nUsage\n-----\n\nInstall package in your environment:\n\n.. sourcecode:: bash\n\n    pip install configparserc\n\nExample code for parse ini-config:\n\n.. sourcecode:: python\n\n    import os\n    from configparserc import config, tools\n\n\n    class MainSection(config.AppendSection):\n        \"\"\"\n        Simple section where:\n        *  some_int_key has int value;\n        *  some_bool_key has int value;\n        *  some_list_key has semicolon separated list value;\n        *  some_other_key has int value in bytes.\n\n        and all values appends or override defaults.\n        \"\"\"\n        type_some_int_key = config.IntType()\n        type_some_bool_key = config.BoolType()\n        type_some_list_key = config.ListType(separator=';')\n        type_some_other_key = config.ListType(separator=';')\n\n\n    config = config.ConfigParserC(\n        # Override section class for section `main`\n        section_overload={'main': MainSection},\n        # Set deafults for all sections.\n        section_defaults={\n            'main': {\n                'some_int_key': \"123\",\n                'some_bool_key': \"false\",\n                'some_list_key': \"a;c;d\"\n            }\n        },\n        # Allow to use values from environment\n        # via \"{ENVIRONMENT_VAR}\" values.\n        format_kwargs=os.environ.copy()\n    )\n\n    config.parse_files(['/path/to/ini/config', '/other/path/to/ini/config'])\n    config.parse_text('''\n    [main]\n    # Support comments\n    ; in different ini formats.\n    int_key = 1234\n    ''')\n\n    config_as_dict = config.all()\n\n\nAuthors\n-------\n\nAuthor:\n    Sergey Klyuykov <onegreyonewhite@mail.ru>\n\n\nContributor(s):\n    Kirill Bychkov <kirill970528@yandex.ru>\n\n\nLicense\n-------\n\nThe ConfigParserC Project (https://gitlab.com/onegreyonewhite/configparserc)\nCopyright (C) 2019-2023 Sergey Klyuykov\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n",
    "bugtrack_url": null,
    "license": "Apache Software License",
    "summary": "Python (Cython) based implementation of ConfigParser based on POSIX and stdlib functions.",
    "version": "2.0.2",
    "project_urls": {
        "Homepage": "https://gitlab.com/onegreyonewhite/configparserc",
        "Issue Tracker": "https://gitlab.com/onegreyonewhite/configparserc/-/issues",
        "Releases": "https://pypi.org/project/configparserc/#history",
        "Source Code": "https://gitlab.com/onegreyonewhite/configparserc.git"
    },
    "split_keywords": [
        "config",
        "configparser",
        "configparserc",
        "ini"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "905d358d59ad2a6ffc5e9c9c4a0140923cfea7e281160d62f7f0a57cfc16edd1",
                "md5": "b94823d41b0f439f33f4907aa0fc1c5e",
                "sha256": "6fbc163e730a4a6f6769565f05ac219dd85ddb1906cca3bd43ec3e8513f676d6"
            },
            "downloads": -1,
            "filename": "configparserc-2.0.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "b94823d41b0f439f33f4907aa0fc1c5e",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 289899,
            "upload_time": "2023-11-03T16:44:29",
            "upload_time_iso_8601": "2023-11-03T16:44:29.673975Z",
            "url": "https://files.pythonhosted.org/packages/90/5d/358d59ad2a6ffc5e9c9c4a0140923cfea7e281160d62f7f0a57cfc16edd1/configparserc-2.0.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8b1591bdf8e8d614d278eecd844c0a0322a6be09535021eeb4a15b6aa62a444",
                "md5": "60cf78ae7e1e342d51aee62552469910",
                "sha256": "d79c4b4575196f3107a260f1ec506a0b733cd866b12cb5e444c56591bf7b43c1"
            },
            "downloads": -1,
            "filename": "configparserc-2.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "60cf78ae7e1e342d51aee62552469910",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 299408,
            "upload_time": "2023-11-03T16:44:31",
            "upload_time_iso_8601": "2023-11-03T16:44:31.518596Z",
            "url": "https://files.pythonhosted.org/packages/e8/b1/591bdf8e8d614d278eecd844c0a0322a6be09535021eeb4a15b6aa62a444/configparserc-2.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "06ef464c761c668216e22b9ce19081e9e27f3dd4da07d8825d501329191dbb63",
                "md5": "672d111fc4547622dfbaebd8d65444f5",
                "sha256": "91f547093813e9fdd882292f6c3166c83379e3f994159c22e69e7e907ad4422b"
            },
            "downloads": -1,
            "filename": "configparserc-2.0.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "672d111fc4547622dfbaebd8d65444f5",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.8",
            "size": 324803,
            "upload_time": "2023-11-03T16:44:33",
            "upload_time_iso_8601": "2023-11-03T16:44:33.499087Z",
            "url": "https://files.pythonhosted.org/packages/06/ef/464c761c668216e22b9ce19081e9e27f3dd4da07d8825d501329191dbb63/configparserc-2.0.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "afabb8d7789c719f903755ec925e4411a2fcf84544216a3d350da7aaf2678d8a",
                "md5": "326c65c6dffab1f9c0b4c2dc99228e69",
                "sha256": "47612d72e577b7c2185f591ece59bb2ac785c1a0b774eedb06b209e0202ff943"
            },
            "downloads": -1,
            "filename": "configparserc-2.0.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "326c65c6dffab1f9c0b4c2dc99228e69",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.8",
            "size": 297942,
            "upload_time": "2023-11-03T16:44:36",
            "upload_time_iso_8601": "2023-11-03T16:44:36.505437Z",
            "url": "https://files.pythonhosted.org/packages/af/ab/b8d7789c719f903755ec925e4411a2fcf84544216a3d350da7aaf2678d8a/configparserc-2.0.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dcdfb26156386b301a6a689fb56e38ccfdf0a313ff17107fd96d954654a3008a",
                "md5": "f8e55df4daf8d194731e4db60dcc09ac",
                "sha256": "5d9a4166c438701f88341000705889b19d052b6536c9c1018f5eef5db0fc63f3"
            },
            "downloads": -1,
            "filename": "configparserc-2.0.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "has_sig": false,
            "md5_digest": "f8e55df4daf8d194731e4db60dcc09ac",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.8",
            "size": 290511,
            "upload_time": "2023-11-03T16:44:38",
            "upload_time_iso_8601": "2023-11-03T16:44:38.755369Z",
            "url": "https://files.pythonhosted.org/packages/dc/df/b26156386b301a6a689fb56e38ccfdf0a313ff17107fd96d954654a3008a/configparserc-2.0.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10aa55035569cf900f6fe7607a336566ec1aec597a527e60a96593e335ca90e1",
                "md5": "1b32646a8bfee14ec542b82ce13109c6",
                "sha256": "3bc1e5d11220b326d2c10be10bd70d0ea2e3868496b211384a8d9b06d3f14779"
            },
            "downloads": -1,
            "filename": "configparserc-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1b32646a8bfee14ec542b82ce13109c6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 16550,
            "upload_time": "2023-11-03T16:44:40",
            "upload_time_iso_8601": "2023-11-03T16:44:40.469261Z",
            "url": "https://files.pythonhosted.org/packages/10/aa/55035569cf900f6fe7607a336566ec1aec597a527e60a96593e335ca90e1/configparserc-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-03 16:44:40",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "onegreyonewhite",
    "gitlab_project": "configparserc",
    "lcname": "configparserc"
}
        
Elapsed time: 0.13130s