Saravanan666/pypi-org huggingface dataset:
Package: configjy
configjyLoads variables from a .json, .yaml or .yml fileGetting startedYou cangetconfigjyfrom PyPI,
which means it's easily installable withpip:python-mpipinstallconfigjyExample usagefromconfigjyimportConfigFile# given this file:"""{"key1": 10,"key2": {"key3": 20},"key4": "{{key1}}"}"""fvar=ConfigFile(config_file_path)key1=fvar.get('key1')print(key1)# 10key2=fvar.get('key2')print(key2)# {"key3": 20}key3=fvar.get('key2.key3')print(key3)# 20key4=fvar.get('key4')print(key4)# str(key1) = "10"key5=fvar.get('key5',default=1,print_when_not_exists=False)print(key5)# 1try:key6=fvar.get('key6',raise_when_not_exists=True)# raises key errorexceptKeyError:passkey6=fvar.get('key6')# print a warning abou non existent keyprint(key6)# NoneChangelogRefer to theCHANGELOG.mdfile.
Package: configkeeper
DescriptionConfigKeeper provides a single backup command which copies a comfiguration file (.vimrc,
.bashrc, etc) into a repository and pushes it.Usageconfigkeeperpath/to/config-fileSetupClone the repository. Link the script somewhere under your$PATH.
The following assumes that~/.local/binis added to your path.gitclonehttps://gitlab.com/loxosceles/configkeeper.git~/toolsln-s~/tools/configkeeper/configkeeper~/.local/bin/configkeeperCreate a repository for your config files you want to back up. The default is~/.local_configurations.DocumentationThe full documentation is athttp://configkeeper.rtfd.org.History0.1.0 (18/06/2019)First release on PyPI.
Package: configless
configless is tiny small configurator, inspired by pyramid’s configurator.
but this is silly not comprehensive.how to useyou can develop foo function, so IHasFoo interface.
and you are providing two variants of foo function.
(my.foo and your.foo are these)## definitionfromzope.interfaceimportInterface,implementerfromconfigless.interfacesimportIPluginclassIHasFoo(Interface):deffoo():pass@implementer(IHasFoo,IPlugin)classMyFoo(object):@classmethoddefcreate_from_setting(cls,settings):returncls()deffoo(self):return"my"@implementer(IHasFoo)classYourFoo(object):@classmethoddefcreate_from_setting(cls,settings):returncls()deffoo(self):return"your"## usingfromconfiglessimportConfiguratorconfig=Configrator()## install many plugins about `foo`config.add_plugin("my.foo",MyFoo,categoryname="foo")config.add_plugin("your.foo",YourFoo,categoryname="foo")## activate my.foo plugin, then, my.foo is used by plugin about `foo`.result=config.activate_plugin("my.foo")## so, configurator has function about resultconfig.foo.foo()# => "my"summaryyou can provides ‘foo’ functiondefine plugininstall plugin – via config.add_plugin(..)activate plugin – via config.activate_plugin(..)
Package: configlib
configlibsimple python wrapper for .conf file get, set, delete operations.Use thusly:.conf file:[options]
somesetting=aDifferentValuepython code:from configlib import getConfig,OptionParser
    def initConfig():
        #initialize config options
        #sets defaults or overrides from config file.
        options.something=getConfig('somesetting','defaultvalue',options.configfile)

    if __name__ == "__main__":
        parser=OptionParser()
        parser.add_option("-c", dest='configfile' , default='', help="configuration file to use")
        (options,args) = parser.parse_args()
        initConfig()pip install configlib
Package: configlines
DescriptionThis module is an extension to Python’s standardconfigparsermodule
that adds file and line number information to each stored option. This
is primarily useful in reporting error messages: you can point your user
to exactly where a bad value occurred:try:timeout=config.getint('connection','retry')exceptValueError:filename,line=config.get_location('connection','retry')logging.error("retry must be an integer (%s:%d)",filename,line)...This package is compatible with both Python 2 and 3.InstallationInstall with pip:$ pip install configlinesUsageGiven the following two configuration files:# Line one of data1.cfg[some_section]foo=1[DEFAULT]bar=2# Line one of data2.cfg[some_section]baz=3You can read and manipulate them exactly the same as the standard module:>>>fromconfiglinesimportConfigParser>>>cfg=ConfigParser()>>>cfg.read(['data1.cfg','data2.cfg'])>>>cfg.get('some_section','foo')'1'You can also access file and line information:>>>cfg.get_location('some_section','foo')('data1.cfg',3)>>>cfg.get_location('some_section','bar')('data1.cfg',6)>>>cfg.get_location('some_section','baz')('data2.cfg',3)In addition toget_location, this module also providesget_lineandget_filenamefunctions for convenience.If an option didn’t come from a file, (i.e., you set it programmatically,) then
line number information will not be present:>>>cfg.set('some_section','qwerty','1234')>>>cfg.get_location('some_section','qwerty')NoneOverwriting options programmatically will erase line number information:>>>cfg.get_location('some_section','foo')('data1.cfg',3)>>>cfg.set('some_section','foo','1234')>>>cfg.get_location('some_section','foo')NoneLine number information can be set explicitly:>>>cfg.set('some_section','foo','1234',location=('somefile.cfg',10))>>>cfg.get_location('some_section','foo')('somefile.cfg',10)>>>cfg.set('some_section','foo','1234',location='preserve')>>>cfg.get_location('some_section','foo')('somefile.cfg',10)>>>cfg.set_location('some_section','foo',('otherfile.cfg',50))>>>cfg.get_location('some_section','foo')('otherfile.cfg',50)
Package: configload
InstallUsageLimitationsFlat structureSimple types only.inidefault sectionConfig File FormatsconfigloadTeeny package to support loading a dataclass from a config file (.ini,.json; optionally, with extensions.yaml,.toml).Note:dynaconfis amuchmore
featureful implementation of a similar idea, so for anything serious it might be
a better choice! see alsoconfigloaderfor another similar implementationInstall# install with extras: support for yaml and toml (requires extra dependencies)pipinstallconfigload[yaml,toml]UsageInstantiate a child class like so:fromconfigloadimportPyConfigFileclassMyConfigClass(PyConfigFile):# setting defaults makes it simpler to instantiateyolo:int=1234heyo:str="hi!"numbertime:float=1.23myconfig=MyConfigClass(configfile="settings.ini")# keys from "settings.ini" that match fields in the dataclass will be converted# to specified types and loaded into myconfig. unknown keys are silently skippedLimitationsFlat structureTo keep things consistent between ini and structured formats, and due to the
limitations of dataclasses, really only top-level (flat) structure is suited to
this.For example, this JSON:{"top_level_key":{"nested_key":1}}Will result in a dataclass with adictfield.top_level_key, but after that,
nested values will have to use dict semantics, i.e.:# to access nested keys:myconfig.top_level_key["nested_key"]Simple types onlyOnly simple dataclass types (str,int,list,dict, etc) are supported,
and ini format only supports scalar types.TODOsupport may be added for more complex data types by usingast.literal_evalto convert string repr of a data structure in an ini key
value, but this is:kinda sketchy, error pronemight not be that useful anyway 🤷Example might be:[DEFAULT]# python string repr of a dictionarykey_1={ "nested_key": 123, }.inidefault sectionThe.iniformat has section markers (eg[DEFAULT]) as optional, but the
python standard library configparser requires at least one section marker.This library (configload) willonlyparse keys from the[DEFAULT]section, all other sections are ignored.If the ini file doesn't contain a[DEFAULT]section an error will be raised.Config File FormatsSubjective comparision:.ini- built into python standard library, supports comments, no types.json- built in, no comments 😞, types.yaml- not built in, comments, types.toml- not built in, comments, types
Package: configloader
ConfigLoader is a Python dictionary subclass that provides convenience methods
for common app configuration-loading scenarios, inspired byflask.Config.FeaturesEasily load config settings from:Python modules, classes or objectsJSON filesYAML filesEnvironment variablesSupports Python 2.6+ and 3.3+.InstallationInstall ConfigLoader fromPyPIusingpip:pip install configloader[all]The[all]indicates that all optional dependencies (AttrDict and PyYAML)
should be installed.Example usage>>> from configloader import ConfigLoader
>>> config = ConfigLoader
>>> config.update_from_object('my_app.settings')
>>> config.update_from_yaml_env('YAML_SETTINGS_PATH')Documentationhttps://configloader.readthedocs.org/en/stable/
Package: configloaders
ConfigloadersConfigloaders is a Python library that allows you to easily load configuration from various types of configuration files and inject them into various types of objects, such as classes, dictionaries, functions, and methods.InstallationYou can install Configloaders using pip:pipinstallconfigloadersUsageLoading configuration from a fileConfigloaders supports loading configuration from various types of configuration files, including YAML, JSON, INI, and Python files.importconfigloadersname='jack'age=18configloaders.load(globals())Injecting configuration into an object or classConfigloaders supports injecting configuration into various types of objects, including classes, dictionaries, functions, and methods.importconfigloaders@configloaders.configclassconfig:name='jack'age=18Using configuration in a function or methodConfigloaders supports using configuration in a function or method by using the@configdecorator.importconfigloaders@configloaders.configdefhello(name,age):print(name,age)Supported file formatsConfigloaders supports the following file formats:JSONINIPICKLEPYTOMLTXTXMLYAMLSupported object typesConfigloaders supports the following object types:ClassesDictionariesFunctionsMethodsargparse.ArgumentParserContributingIf you would like to contribute to Configloaders, please submit a pull request or open an issue on GitHub.LicenseConfigloaders is licensed under the MIT License. See the LICENSE file for more information.
Package: config-logger
Build StatusProject detailsDescriptionTheconfig-loggerpackage is a basic configurable logger. It reads the configuration data for the logging from an
external YAML, JSON file or from a given python dictionary and validates it. The contents of this dictionary are
described inConfiguration dictionary schema. This package is currently tested on Python 2.7.Issue trackerChangelogInstallationpip install config-loggerordownload thelatest releaseand runpython setup.py installUsageConfigured from external .yaml or .json file#logging.yaml contains the configuration data which defines the logging in your project

from config_logger import Logger
logger = Logger(name='my_logger', cfg_path='/path/to/logging.yaml')
logger.info("This will be written in a file called info.log")Console Output2017-01-31 12:20:32,693 - my_logger - INFO - This will be written in a file called info.logConfigured from dictionarylog_config = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'basic': {
            'format': '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
        }
    },
    'handlers': {
        'console': {
            'class': 'logging.StreamHandler',
            'formatter': 'basic',
            'level': 'WARNING',
            'stream': 'ext://sys.stdout'
        }
    'root': {
        'handlers': ['console'],
        'level': 'WARNING'
    }
}

from config_logger import Logger
logger = Logger(name='my_logger', default_conf=log_config)
logger.warning("This will be written in a file called warning.log")Console Output2017-01-31 13:12:56,002 - my_logger - WARNING - This will be written in a file called warning.logNote: You can find sample of logging configuration files supported by config-logger inthis repo.LicenseThis project is licensed under the MIT license.
Package: configman
[![Travis](https://travis-ci.org/mozilla/configman.png?branch=master)](https://travis-ci.org/mozilla/configman)Copyright Mozilla, 2013 - 2015General tool for setting up configuration options per namespaces.
Supports reading and writing configs generally from and into config
files.Running testsWe use [nose](http://code.google.com/p/python-nose/) to run all the
unit tests and [tox](http://tox.testrun.org/latest/) to test multiple
python versions. To run the whole suite just run:toxtoxwill pass arguments after–tonosetests. To run with test
coverage calculation, runtoxlike this:tox – –with-coverage –cover-html –cover-package=configmanIf you want to run a specific test in a testcase class, though,
you might consider just usingnosetests:nosetests configman.tests.test_config_manager:TestCase.test_write_flatMaking a releaseBecause our.travis.ymlhas all the necessary information to automatically
make a release, all you need to do is to push a commit onto master.
Most likely you will only want to do this after you have
edited theconfigman/version.txtfile. Suppose you make some changes:git add configman/configman.py
git commit -m “fixed something”You might want to push that to your fork and make a pull request. Then,
to update the version and make a release, first do this:vim configman/version.txt
git add configman/version.txt
git commit -m “bump to version x.y.z”
git push origin masterAfter that travis, upon a successful build will automatically make a new
tarball and wheel and upload it to [PyPI](https://pypi.python.org/pypi/configman)
Package: configmanager
Update on 2019-05-13: Version 1.35 and above require Python 3.6+.Update on 2018-10-20: I no longer use this library. It tries to do too many things. It was written in
Python 2.7 and made work with Python 3. With type hints, dataclasses, and many other cool features in Python 3.6+
you can express the same things in a much nicer way than this.Don’t let standard library’s configparser drive your configuration value access design. Let it do what it does
best – parse and write configuration files. And letconfigmanagerdo the rest.Main FeaturesEvery configuration item is an object with a type, a default value, a custom value and other metadataNo sections requiredAny depth of sections allowedINI (ConfigParser), JSON, YAML formatsclick framework integrationDocumentationhttps://jbasko.github.io/configmanager/Source Code and Issue Trackinghttps://github.com/jbasko/configmanagerQuick StartInstall from Python Package index withpip install configmanager.Declare your configuration, the sources, and off you go.
Remember, every configuration item is an object, not just a plain
configuration value.
If you don’t need the rich features of configuration items,
useconfigmanager.PlainConfiginstead.importwarningsfromconfigmanagerimportConfigconfig=Config({'uploads':{'threads':1,'enabled':False,'db':{'user':'root','password':{'@default':'root','@envvar':'MY_UPLOADER_DB_PASSWORD',},}}},load_sources=['/etc/my-uploader/config.ini','~/.config/my-uploader/config.json',],auto_load=True)ifconfig.uploads.db.user.is_default:warnings.warn('Using default db user!')ifconfig.uploads.enabled.get():connect_to_database(user=config.uploads.db.user.get(),password=config.uploads.db.password.get(),)
Package: config-manager
Build StatusProject detailsDescriptionTheconfig-managerpackage is a basic configuration reader and manager. It reads the configuration data from
an external YAML or JSON file and it injects this data into the application that is called from. It’s currently
tested on Python 2.7.Issue trackerChangelogInstallationpip install config-managerordownload thelatest releaseand runpython setup.py installUsage#configs.yaml contains the configuration data

from config_manager import ConfigManager
confman = ConfigManager(config_file_path='/path/to/configs.yaml', defaults={'maintenance':'False'}, required=['maintenance'])
maintenance = confman['maintenance']LicenseThis project is licensed under the MIT license.
Package: config-manager-evjeny
config_managerConfiguration manager for parsing from different sourcesInstallationpython-mpipinstallconfig-manager-evjenyUsageCreate class with config variables and inherit it fromconfig_manager.config.Config.
You can define variables and their types or even define values.
Then we can parse variables from different sources.
For example, this isexample_parser.py:fromconfig_manager.configimportConfigfromconfig_manager.variable_parsersimportListTypeclassTestConfig(Config):"""Config example with some variables of different types"""name:strage:intis_useful:bool=Falseparts:ListType[float]my_config=TestConfig()\.parse_env(prefix="test_config_")\.parse_json(json_path="test_config.json")\.parse_arguments("TestConfig parser")print(my_config)If we run it:test_config_age=33pythonexample_parser.py\--namehello\--is_usefulfalse\--parts"[0.25, 0.5, 0.75]"It will output something like and all theprimitivetypes will be parsed correctly:age = 33
is_useful = False
name = hello
parts = [0.25, 0.5, 0.75]Type detailsstr,intandfloatForstr,intandfloatcasting is the same as builtin functions.boolGenerally all not empty containers (even string"false")
cast toboolwould returnTrue.Thus, there is aBoolParserthat casts value toTruein one of these cases:variable is subclass ofstrand it's value one of (in any case):"yes""true""1""on"in other cases defaultboolcall usedfromconfig_manager.variable_parsersimportBoolParserparser=BoolParser()assertparser("yes")==Trueassertparser("yES")==Trueassertparser("tRuE")==Trueassertparser("1")==Trueassertparser("on")==Trueassertparser("no")==Falseassertparser("FaLsE")==Falseassertparser(1.0)==Trueassertparser(0.0)==Falseassertparser(1)==Trueassertparser(0)==Falseassertparser(True)==Trueassertparser(False)==FalseListTypeAs it is impossible to get type fromtyping.List[T](plus this annotation removed in Python 3.9) there is aListType.
It can be used with any parseable type, so every element will be cast
to target type. For example:fromconfig_manager.variable_parsersimportListType# shallow listsassertListType[int](["1","2","3"])==[1,2,3]assertListType[str]([1.0,-213.5122,52.123])==["1.0","-213.5122","52.123"]assertListType[int]("[1, 2, 3]")==[1,2,3]All the parse sources provide different ways to define list, so there they are:inpredefineandjsoncase simply assign any python list to variableinenvironmentandargumentcases every list is parsed from string[item_1, item_2, ...]
Package: configmate-pydantic-validator
configmate-pydantic-validatorExtendsconfigmateto levarage Pydantic for config validation.Installationpipinstallconfigmate-pydanticvalidatorOR directly with the extras ofconfigmate:pipinstallconfigmate[pydantic]UsageBy loading this plugin,configmatewill use Pydantic to validate the config.
Under the hood, a new validator is registered toconfigmate.components.validators.TypeValidatorFactory.
This validator will be used for any non-function passed tovalidationin configmate.get_config.fromtypingimportDictimportdataclassesimportconfigmate@dataclasses.dataclassclassConfig:host:strport:intconfig=configmate.get_config("config.json",# main configvalidation=Dict[str,str],# pydantic will handle validation)## >> {'host': 'localhost', 'port': '8080'} # note that port is a string due to pydanticconfig=configmate.get_config("config.json",# main configvalidation=Config,# pydantic will handle validation)## >> Config(host='localhost', port=8080) # port is an int as expectedconfig=configmate.get_config("config.json",# main configvalidation=lambdaconfig_dict:...,# callables will be called with the config dict (as without this plugin))## >> ... # whatever the callable returns
Package: configmelt
configmeltIntroductionThe ConfigMeld package simplifies configuration handling by providing a class to manage JSON or YAML configurations. This class allows for easy loading, accessing, and manipulation of configuration attributes.InstallationTo install configmelt, simply use pip:pipinstallconfigmeltFeatures:Loading Configurations: Load configurations from JSON or YAML files.Accessing Configurations: Access configuration attributes as object properties.Flexible Representation: Manage configurations in an object-oriented manner.Environmental Integration: Easily convert configurations to environment variables.Schema Generation: Generate JSON schema based on existing configurations.UsageInitializing ConfigMeld:fromconfigmeldimportConfigMeld# Initialize ConfigMeld with attributesconfig=ConfigMeld(foo='bar',nested={'key':'value'})# Access configuration attributesprint(config.foo)# Output: 'bar'Loading Configurations from Files:# Load configurations from a JSON/YAML filepath_to_config='path/to/config.json'loaded_config=ConfigMeld.load_config_from_file(path_to_config)# Access loaded configurationsprint(loaded_config.attribute_name)schema Generation:# Generate JSON schema based on existing configurationsschema=loaded_config.generate_schema()print(schema)DocumentationThe Sphinx-generated documentation for configmelt can be foundhere.ContributionFeel free to contribute by submitting issueshere.
Package: configmerger
configmergermerge multi level configurations.UsagefromconfigmergerimportMerger# your configurations, read from app.json, machine.yaml, user.toml, or moreconfs=[read_from_app(),read_from_machine(),read_from_user(),]# merge all configurations into one.runtime_conf=Merger().merge(confs)Merge RulesHere is the default merge rules:merger=Merger()# for dict, a little like Chainmapmerger.merge([{'a':1},{'a':2,'b':3},{'b':4}])#   {'a': 2, 'b': 4}# for list, default behavior is connect each# change `merger.connect_list` to `False` can change this behaviormerger.merge([[1,2,3],[4,5]])# [4, 5, 1, 2, 3]# for str, int and others, latest have highest prioritymerger.merge(['first','last'])# 'last'# basic, `None` is ignoredmerger.merge([1,None])# 1# but if all values is `None`, return `None`merger.merge([None,None])# None# if type changed, merge will stop,merger.merge([{'a':1},# <--- ignored1,# <--- type changed, ignore all before this{'b':2},None,# <--- None is ignored{'c':3},])# {'b': 2, 'c': 3}Override any methods to modify the default behavior.
Package: config-mgmt-server
VSCode Python Project TemplateTemplate for my python (version 3) projects with vscodeCommandsInit space (with bash) :source _initial_setup.shCreate virtualenv virtualenv :virtualenv -p python3 .venvLoad/Source virtuelenv :source .venv/bin/activateInstall requirements :pip install -r requirements.txtInstall test requirements :pip install -r tests/requirements.txtLaunch unitary tests :python3 -m pytest tests -vLaunch coverage tests :python3 -m pytest --cov-report xml:cov.xml --cov my_module tests -vTools choicesFormat python code withautopep8. Others here :https://code.visualstudio.com/docs/python/editing#_formattingStatic analysis withpylint. Others here :https://code.visualstudio.com/docs/python/lintingUnitary tests withpytest. Others here :https://code.visualstudio.com/docs/python/unit-testingAvailable options for python with vscode available here : <https://code.visualstudio.com/docs/python/settings-reference>ExtensionsUsefull extensions :Python (https://marketplace.visualstudio.com/items?itemName=ms-python.python)Coverage Gutters (https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters)Better Comments (https://marketplace.visualstudio.com/items?itemName=aaron-bond.better-comments)indent-rainbow (https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow)Trailing Spaces (https://marketplace.visualstudio.com/items?itemName=shardulm94.trailing-spaces)Rainbow Brackets (https://marketplace.visualstudio.com/items?itemName=2gua.rainbow-brackets)Git Lens (https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)EditorConfig (https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)Git Project Manager (https://marketplace.visualstudio.com/items?itemName=felipecaputo.git-project-manager)TasksUnitary tests with code coverageUse itClone this repo as a new vscode workspaceCreate virtualenv and install requirements (seeCommands)Rename foldermy_modulewith your module nameIn.vscode/tasks.json, replacemy_moduleby your module nameFix module import inmain.pyand./tests/test_my_module.yyif neededTry everything by:Launching unitary testsLaunching taskLaunching configurationsDebugging with a breakpointSourceshttps://github.com/dwd-umd/python-project-template