Metadata-Version: 2.0
Name: appconfigpy
Version: 0.0.3
Summary: A Python library to create/load an application configuration file.
Home-page: https://github.com/thombashi/appconfigpy
Author: Tsuyoshi Hombashi
Author-email: gogogo.vm@gmail.com
License: MIT License
Description-Content-Type: UNKNOWN
Keywords: configuration
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: click (>=0.6.7)
Requires-Dist: logbook (>=1.1.0)
Requires-Dist: six
Requires-Dist: typepy (>=0.0.20)
Requires-Dist: pathvalidate (>=0.16.2)

appconfigpy
===============

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

.. image:: https://img.shields.io/pypi/pyversions/appconfigpy.svg
    :target: https://pypi.python.org/pypi/appconfigpy


Summary
=======
A Python library to create/load an application configuration file.


Installation
============

::

    pip install appconfigpy


Usage
=====

Create A Configuration File
------------------------------------
.. code:: python

    # configure.py

    import appconfigpy

    app_config_manager = appconfigpy.ConfigManager(
        config_name="example",
        config_item_list=[
            appconfigpy.ConfigItem(
                name="token",
                initial_value=None,
                prompt_text="API Token",
                default_display_style=appconfigpy.DefaultDisplayStyle.PART_VISIBLE
            ),
            appconfigpy.ConfigItem(
                name="path",
                prompt_text="Path",
                initial_value=".",
            ),
        ])

    try:
        app_config_manager.configure()
    except KeyboardInterrupt:
        print()


.. code::

    $ ./configure.py
    API Token: abcdefghijklmn
    Path [.]:
    $ cat ~/.example
    {
        "path": ".",
        "token": "abcdefghijklmn"
    }

Load A Configuration File
------------------------------------
.. code:: python

    # load.py

    import appconfigpy

    app_config_manager = appconfigpy.ConfigManager(
        config_name="example",
        config_item_list=[
            appconfigpy.ConfigItem(
                name="token",
                initial_value=None,
                prompt_text="API Token",
                default_display_style=appconfigpy.DefaultDisplayStyle.PART_VISIBLE
            ),
            appconfigpy.ConfigItem(
                name="path",
                prompt_text="Path",
                initial_value=".",
            ),
        ])

    print(app_config_manager.load())

.. code::

    $ ./load.py
    {'token': 'abcdefghijklmn', 'path': '.'}


Dependencies
============
Python 2.7+ or 3.4+

- `click <https://github.com/pallets/click>`__
- `logbook <http://logbook.readthedocs.io/en/stable/>`__
- `pathvalidate <https://github.com/thombashi/pathvalidate>`__
- `typepy <https://github.com/thombashi/typepy>`__


