| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- Metadata-Version: 2.1
- Name: setoptconf-tmp
- Version: 0.3.1
- Summary: A module for retrieving program settings from various sources in a consistant method.
- Home-page: https://github.com/carlio/setoptconf-tmp
- Author: Jason Simeone
- Author-email: jay@classless.net
- Maintainer: Carl Crowder
- Maintainer-email: git@carlcrowder.com
- License: MIT
- Keywords: settings,options,configuration,config,arguments
- Platform: UNKNOWN
- Classifier: Development Status :: 4 - Beta
- Classifier: Intended Audience :: Developers
- Classifier: License :: OSI Approved :: MIT License
- Classifier: Operating System :: OS Independent
- Classifier: Programming Language :: Python :: 3.6
- Classifier: Programming Language :: Python :: 3.7
- Classifier: Programming Language :: Python :: 3.8
- Classifier: Programming Language :: Python :: 3.9
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
- License-File: LICENSE
- Provides-Extra: yaml
- Requires-Dist: pyyaml ; extra == 'yaml'
- ==========
- IMPORTANT!
- ==========
- This is a fork of `setoptconf <https://github.com/jayclassless/setoptconf>`_ .
- It is a temporary solution to fix `prospector <https://github.com/PyCQA/prospector>`_
- being unable to install due to setoptconf not working with setuptools >= 58 -
- see `the issue here <https://github.com/PyCQA/prospector/issues/438>`_.
- This package is only meant as a temporary solution to fix CI builds using prosector
- until setoptconf can be removed from there. Therefore do not expect this fork to be
- maintained and it will be purged once prospector is updated.
- ==============
- setoptconf-tmp
- ==============
- ``setoptconf`` is a Python library that can be used to retrieve program settings
- from a variety of common sources:
- * Command Line
- * Environment Variables
- * INI Files
- * JSON Files
- * YAML Files
- * Python Objects/Modules
- The goal of this project is to define your desired settings in a simple and
- consistent way, and then point setoptconf at as many of the sources as you'd
- like to use, and let it comb them all, looking for your settings.
- This README is admittedly very light on details. Full documentation will come
- in time. For now, here's an example of its use:
- Import the library::
- import setoptconf as soc
- Instantiate the manager::
- manager = soc.ConfigurationManager('myprogram')
- Define the settings we'd like to collect::
- manager.add(soc.StringSetting('foo'))
- manager.add(soc.IntegerSetting('bar', required=True))
- manager.add(soc.BooleanSetting('baz', default=True))
- Retreive the settings from our desired sources, combining the settings and
- overriding with the priority implied by the order of the sources we pass::
- config = manager.retrieve(
- # This source pulls from the command line using argparse.
- soc.CommandLineSource,
- # This source pulls from environment variables that are prefixed
- # with MYPROGRAM_*
- soc.EnvironmentVariableSource,
- # This source pulls from the named INI files. It stops at the first
- # file it finds.
- soc.ConfigFileSource(('.myprogramrc', '/etc/myprogram.conf')),
- )
- We now have a Configuration object named ``config`` that has three attributes;
- ``foo``, ``bar``, and ``baz``.
|