confix


Nameconfix JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://pypi.python.org/pypi/confix
SummaryLanguage agnostic configuration parser
upload_time2024-01-24 08:02:59
maintainer
docs_urlhttps://pythonhosted.org/confix/
authorGiampaolo Rodola'
requires_python
licenseMIT
keywords config yaml toml json ini sensitive password
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://img.shields.io/pypi/dm/confix.svg
    :target: https://pypi.python.org/pypi/confix#downloads
    :alt: Downloads this month

.. image:: https://api.travis-ci.org/giampaolo/confix.png?branch=master
    :target: https://travis-ci.org/giampaolo/confix
    :alt: Linux tests (Travis)

.. image:: https://ci.appveyor.com/api/projects/status/kmkc7f7muvrcr8oq?svg=true
    :target: https://ci.appveyor.com/project/giampaolo/confix
    :alt: Windows tests (Appveyor)

.. image:: https://coveralls.io/repos/giampaolo/confix/badge.svg?branch=master&service=github
    :target: https://coveralls.io/github/giampaolo/confix?branch=master
    :alt: Test coverage (coverall.io)

.. image:: https://img.shields.io/pypi/v/confix.svg
    :target: https://pypi.python.org/pypi/confix/
    :alt: Latest version

.. image:: https://img.shields.io/pypi/l/confix.svg
    :target: https://pypi.python.org/pypi/confix/
    :alt: License

Confix
======

Quick links
-----------

* `Home page <https://github.com/giampaolo/confix>`__
* `Documentation <http://pythonhosted.org/confix/>`__
* `Blog <http://grodola.blogspot.com/search/label/confix>`__
* `Forum <https://groups.google.com/forum/#!forum/python-confix>`__
* `Download <https://pypi.python.org/pypi?:action=display&name=confix#downloads>`__

About
-----

Confix is a language-agnostic configuration parser for Python.
It lets you define the default configuration of an app as a standard Python
class, then overwrite its attributes from a static configuration file (be it
YAML, JSON, INI or TOML) and / or via
`environment variables <http://pythonhosted.org/confix/#override-a-key-via-environment-variables>`_.
In doing so it validates the overridden settings by:

- making sure they are of the same type
- (optional) marking them as mandatory (useful for passwords)
- (optional) validating them via a callable

Example:

config file:

.. code-block:: yaml

    # config.yml
    password: secret

python file:

.. code-block:: python

    # main.py
    from confix import register, parse

    @register()
    class config:
        username = 'ftp'
        password = None

    parse('config.yaml')
    print(config.username)
    print(config.password)

shell:

.. code-block:: bash

    $ python main.py
    ftp
    secret

For more examples see `docs <http://pythonhosted.org/confix>`_.

Main features
-------------

- supports **YAML**, **JSON**, **INI** and **TOML** serialization formats.
- can be easily extended to support other formats.
- support for Python 3
- small code base
- 100% test coverage
- allows you to define 'schemas' in order to **validate** fields and mark them
  as **required**:

 .. code-block:: python

  # ftp.py
  from confix import register, schema

  @register()
  class config:
      port = schema(default=21, validator=lambda x: isinstance(x, int))
      password = schema(required=True)

Status
------

Code is solid and fully tested (100% coverage). Its API may change (break)
between major versions though.

            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.python.org/pypi/confix",
    "name": "confix",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/confix/",
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "config,yaml,toml,json,ini,sensitive,password",
    "author": "Giampaolo Rodola'",
    "author_email": "g.rodola@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d5/40/d972a8d9dc02ff4ac2cad4bbbd7936a2344a22aae0d820515c72e34c3e6c/confix-0.2.2.tar.gz",
    "platform": "Platform Independent",
    "description": ".. image:: https://img.shields.io/pypi/dm/confix.svg\n    :target: https://pypi.python.org/pypi/confix#downloads\n    :alt: Downloads this month\n\n.. image:: https://api.travis-ci.org/giampaolo/confix.png?branch=master\n    :target: https://travis-ci.org/giampaolo/confix\n    :alt: Linux tests (Travis)\n\n.. image:: https://ci.appveyor.com/api/projects/status/kmkc7f7muvrcr8oq?svg=true\n    :target: https://ci.appveyor.com/project/giampaolo/confix\n    :alt: Windows tests (Appveyor)\n\n.. image:: https://coveralls.io/repos/giampaolo/confix/badge.svg?branch=master&service=github\n    :target: https://coveralls.io/github/giampaolo/confix?branch=master\n    :alt: Test coverage (coverall.io)\n\n.. image:: https://img.shields.io/pypi/v/confix.svg\n    :target: https://pypi.python.org/pypi/confix/\n    :alt: Latest version\n\n.. image:: https://img.shields.io/pypi/l/confix.svg\n    :target: https://pypi.python.org/pypi/confix/\n    :alt: License\n\nConfix\n======\n\nQuick links\n-----------\n\n* `Home page <https://github.com/giampaolo/confix>`__\n* `Documentation <http://pythonhosted.org/confix/>`__\n* `Blog <http://grodola.blogspot.com/search/label/confix>`__\n* `Forum <https://groups.google.com/forum/#!forum/python-confix>`__\n* `Download <https://pypi.python.org/pypi?:action=display&name=confix#downloads>`__\n\nAbout\n-----\n\nConfix is a language-agnostic configuration parser for Python.\nIt lets you define the default configuration of an app as a standard Python\nclass, then overwrite its attributes from a static configuration file (be it\nYAML, JSON, INI or TOML) and / or via\n`environment variables <http://pythonhosted.org/confix/#override-a-key-via-environment-variables>`_.\nIn doing so it validates the overridden settings by:\n\n- making sure they are of the same type\n- (optional) marking them as mandatory (useful for passwords)\n- (optional) validating them via a callable\n\nExample:\n\nconfig file:\n\n.. code-block:: yaml\n\n    # config.yml\n    password: secret\n\npython file:\n\n.. code-block:: python\n\n    # main.py\n    from confix import register, parse\n\n    @register()\n    class config:\n        username = 'ftp'\n        password = None\n\n    parse('config.yaml')\n    print(config.username)\n    print(config.password)\n\nshell:\n\n.. code-block:: bash\n\n    $ python main.py\n    ftp\n    secret\n\nFor more examples see `docs <http://pythonhosted.org/confix>`_.\n\nMain features\n-------------\n\n- supports **YAML**, **JSON**, **INI** and **TOML** serialization formats.\n- can be easily extended to support other formats.\n- support for Python 3\n- small code base\n- 100% test coverage\n- allows you to define 'schemas' in order to **validate** fields and mark them\n  as **required**:\n\n .. code-block:: python\n\n  # ftp.py\n  from confix import register, schema\n\n  @register()\n  class config:\n      port = schema(default=21, validator=lambda x: isinstance(x, int))\n      password = schema(required=True)\n\nStatus\n------\n\nCode is solid and fully tested (100% coverage). Its API may change (break)\nbetween major versions though.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Language agnostic configuration parser",
    "version": "0.2.2",
    "project_urls": {
        "Homepage": "https://pypi.python.org/pypi/confix"
    },
    "split_keywords": [
        "config",
        "yaml",
        "toml",
        "json",
        "ini",
        "sensitive",
        "password"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d540d972a8d9dc02ff4ac2cad4bbbd7936a2344a22aae0d820515c72e34c3e6c",
                "md5": "34986dbacc8b57af42447696646ac12a",
                "sha256": "e993af189ed64898c152c1444c129d1f4056d6e5cec3dbc9675574fc1da2c92e"
            },
            "downloads": -1,
            "filename": "confix-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "34986dbacc8b57af42447696646ac12a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 44811,
            "upload_time": "2024-01-24T08:02:59",
            "upload_time_iso_8601": "2024-01-24T08:02:59.941711Z",
            "url": "https://files.pythonhosted.org/packages/d5/40/d972a8d9dc02ff4ac2cad4bbbd7936a2344a22aae0d820515c72e34c3e6c/confix-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-24 08:02:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "confix"
}
        
Elapsed time: 0.51274s