Skip to main content

simple write config/setting, wrap of configparser

Project description

configset

simple write config/setting, wrap of configparser

Installing

Install and update using pip:

$ pip install configset

configset supports Python 2 and newer, Python 3 and newer, and PyPy.

Example

What does it look like? Here is an example of a simple configset program:

import configset
from pathlib import Path #for last version of python 2.7 and 3.+

class pcloud(object):

    def __init__(self, **kwargs):
        ...
        #self.CONFIG = configset(os.path.join(os.path.dirname(__file__), 'config.ini')) #for python start from 2.5 
        self.CONFIG = configset(str(Path(__file__).parent / 'config.ini') #for python or just
        #self.CONFIG = configset() #this will create *.ini file base on this file name
        ...

        self.username = self.CONFIG.get_config('AUTH', 'username', "admin") # 'admin' is default value
        self.password = self.CONFIG.get_config('AUTH', 'password', "12345678") # "12345678" is default value

        self.port = self.CONFIG.get_config_as_list('MAIN', 'PORTS') # outputs is list, example ['8181', '55', '32']
        self.host = self.CONFIG.write_config('MAIN', 'HOST', '127.0.0.1')  # this will write HOST = '127.0.0.1' on section [MAIN]
        ...

Support

  • Python 2.7+, 3.x+
  • Windows, Linux

author

Hadi Cahyadi

Buy Me a Coffee

Donate via Ko-fi Support me on Patreon

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

configset-1.54.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

configset-1.54-py2.py3-none-any.whl (8.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file configset-1.54.tar.gz.

File metadata

  • Download URL: configset-1.54.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for configset-1.54.tar.gz
Algorithm Hash digest
SHA256 ce47d4489686afbf389db172aa62ff412225d74938ad42cae91e27543c5fd50e
MD5 9aefc4fb2e676241b3c3ecd85a38d362
BLAKE2b-256 3e616fa137d7be00c4975af24d6a10e38355ea86611426e72f9368542ac38a3e

See more details on using hashes here.

File details

Details for the file configset-1.54-py2.py3-none-any.whl.

File metadata

  • Download URL: configset-1.54-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for configset-1.54-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f2def99f917f2b232b1e8dababdf6e8fd679bf45536be46aa891fd962c5ec212
MD5 101e134b608ee83b1366a6ce56c0bc75
BLAKE2b-256 45cb5b79c4ddd9e9700dd646b5587193ecfbd09c5388e00b44d8f5e0df56f2bc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page