tini


Nametini JSON
Version 4.0.0 PyPI version JSON
download
home_pagehttps://github.com/beaugunderson/python-tini
SummaryRead simple .ini/configuration files.
upload_time2024-12-04 22:35:03
maintainerNone
docs_urlNone
authorBeau Gunderson
requires_pythonNone
licenseMIT
keywords config configuration ini
VCS
bugtrack_url
requirements configparser
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## tini

A simple module for loading `.ini`-style configuration files.

Based on [ConfigParser][configparser] and works in Python 2 and Python 3.

[configparser]: https://docs.python.org/3/library/configparser.html

### Running tests

```bash
$ py.test
```

Or, with `tox` (test with multiple Python versions):

```bash
$ tox
```

### Example

#### settings.py

```python
import os
import sys

from tini import Tini

filenames = [
    './foobar.ini',
    os.path.join(os.path.expanduser('~'), '.foobar.ini'),
    os.path.join(os.path.expanduser('~'), '.config', '.foobar.ini'),
]

defaults = {
    'foobar': {
        'baz': 'a string',
        'buzz': True,
        'bizz': 123,
    }
}

sys.modules[__name__] = Tini(filenames, defaults=defaults)
```

#### foobar.ini

```
[foobar]
buzz = false
```

#### test.py

```python
import settings

assert settings.foobar['baz'] == 'a string'
assert settings.foobar['buzz'] is False
assert settings.foobar['baz'] == 123
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/beaugunderson/python-tini",
    "name": "tini",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "config, configuration, ini",
    "author": "Beau Gunderson",
    "author_email": "beau@beaugunderson.com",
    "download_url": "https://files.pythonhosted.org/packages/59/da/6dbdaf2bf80e4e19f21dde2f51b5df203b4a3c65f7e1fd11ec4355aeba5a/tini-4.0.0.tar.gz",
    "platform": null,
    "description": "## tini\n\nA simple module for loading `.ini`-style configuration files.\n\nBased on [ConfigParser][configparser] and works in Python 2 and Python 3.\n\n[configparser]: https://docs.python.org/3/library/configparser.html\n\n### Running tests\n\n```bash\n$ py.test\n```\n\nOr, with `tox` (test with multiple Python versions):\n\n```bash\n$ tox\n```\n\n### Example\n\n#### settings.py\n\n```python\nimport os\nimport sys\n\nfrom tini import Tini\n\nfilenames = [\n    './foobar.ini',\n    os.path.join(os.path.expanduser('~'), '.foobar.ini'),\n    os.path.join(os.path.expanduser('~'), '.config', '.foobar.ini'),\n]\n\ndefaults = {\n    'foobar': {\n        'baz': 'a string',\n        'buzz': True,\n        'bizz': 123,\n    }\n}\n\nsys.modules[__name__] = Tini(filenames, defaults=defaults)\n```\n\n#### foobar.ini\n\n```\n[foobar]\nbuzz = false\n```\n\n#### test.py\n\n```python\nimport settings\n\nassert settings.foobar['baz'] == 'a string'\nassert settings.foobar['buzz'] is False\nassert settings.foobar['baz'] == 123\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Read simple .ini/configuration files.",
    "version": "4.0.0",
    "project_urls": {
        "Homepage": "https://github.com/beaugunderson/python-tini"
    },
    "split_keywords": [
        "config",
        " configuration",
        " ini"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91a33de3e42f2d5494e2d9ebf71c9412bfc909bbbd56cfe5642aa72a116ea0ff",
                "md5": "876d93a3da5f7904eb882c2f0a7e4d11",
                "sha256": "cdb3da607abfcacdad4e3ce9dc9cf0cc593e4d4ec2d24229437148804221c5b8"
            },
            "downloads": -1,
            "filename": "tini-4.0.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "876d93a3da5f7904eb882c2f0a7e4d11",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 3357,
            "upload_time": "2024-12-04T22:35:01",
            "upload_time_iso_8601": "2024-12-04T22:35:01.768068Z",
            "url": "https://files.pythonhosted.org/packages/91/a3/3de3e42f2d5494e2d9ebf71c9412bfc909bbbd56cfe5642aa72a116ea0ff/tini-4.0.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "59da6dbdaf2bf80e4e19f21dde2f51b5df203b4a3c65f7e1fd11ec4355aeba5a",
                "md5": "24ddf5526a7e6cca919051be5177d516",
                "sha256": "5aafb4c7439834e1e2aceafeab3c3ffa4d26b3b7d07c134c9ff562f599f56908"
            },
            "downloads": -1,
            "filename": "tini-4.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "24ddf5526a7e6cca919051be5177d516",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3436,
            "upload_time": "2024-12-04T22:35:03",
            "upload_time_iso_8601": "2024-12-04T22:35:03.361521Z",
            "url": "https://files.pythonhosted.org/packages/59/da/6dbdaf2bf80e4e19f21dde2f51b5df203b4a3c65f7e1fd11ec4355aeba5a/tini-4.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-04 22:35:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "beaugunderson",
    "github_project": "python-tini",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "configparser",
            "specs": [
                [
                    "==",
                    "3.5.0b2"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "tini"
}
        
Elapsed time: 1.21353s