Metadata-Version: 2.1
Name: appconfigpy
Version: 0.0.8
Summary: A Python library to create/load an application configuration file.
Home-page: https://github.com/thombashi/appconfigpy
Author: Tsuyoshi Hombashi
Author-email: tsuyoshi.hombashi@gmail.com
License: MIT License
Project-URL: Tracker, https://github.com/thombashi/appconfigpy/issues
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: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*
Requires-Dist: setuptools (>=38.3.0)
Requires-Dist: logbook (>=1.1.0)
Requires-Dist: msgfy (>=0.0.4)
Requires-Dist: six
Requires-Dist: typepy (>=0.3.0)
Requires-Dist: pathvalidate (>=0.22.0)
Provides-Extra: build
Requires-Dist: wheel; extra == 'build'
Provides-Extra: release
Requires-Dist: releasecmd (>=0.0.12); extra == 'release'

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.org/project/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+

- `logbook <https://logbook.readthedocs.io/en/stable/>`__
- `msgfy <https://github.com/thombashi/msgfy>`__
- `pathvalidate <https://github.com/thombashi/pathvalidate>`__
- `six <https://pypi.org/project/six/>`__
- `typepy <https://github.com/thombashi/typepy>`__

Optional Dependencies
------------------------------------
- `click <https://github.com/pallets/click>`__
- `simplejson <https://github.com/simplejson/simplejson>`__


