Skip to main content

An INI parser or config parser

Project description

iniparser2

Build Status

iniparser2 is An INI parser or a Config parser.

this package is the improved version of iniparser (it's gone, but will be back soon...) with more features.


Installation

  • using pip
    • from pypi
      • pip install iniparser2
      • pip install iniparser2 --upgrade
    • from github repository
      • pip install git+https://github.com/HugeBrain16/iniparser2.git
    • from source
      • pip install .
  • from source
    • python setup.py install
    • python setup.py install --user

Examples

reading ini basic example

import iniparser2

string = """
[stuff] # stuff that i stole from your house
microwave = 2
bagle = 8
money = $2100
person = 1
something_else = 69
"""

parser = iniparser2.INI()
parser.read(string)

print(parser)

read-write example

something.ini

[stuff] # stuff that i stole from your house
microwave = 2
bagle = 8
money = $2100
person = 1
something_else = 69

le_main.py

import iniparser2

parser = iniparser2.INI(convert_property=True) # this `convert_property` does something like conversion...

parser.read_file('something.ini')
print(parser) # old stuff

# let's steal some more stuff
parser.set('person', parser.get('person', section='stuff') + 1, section='stuff') # kidnap one more person from your house
parser.set('bagle', parser.get('bagle', section='stuff') + 3, section='stuff') # and some bagles...
parser.set('dog', 1, section='stuff') # ohh, there is a dog, imma take that
parser.write('something.ini') # update file

print(parser) # let's see what i got here..., ohh wait!-

parser.remove_property('dog', section='stuff') # nevermind
parser.write('something.ini') # alright let's get outta here

# overread parser items
parser.read_file('something.ini')
print(parser) # new stuff

weird binary file stuff

import iniparser2

string = """
[robot-1]
text = beep boop?

[robot-2]
text = boop? beep beep sus

[robot-3]
text = amogus
"""

parser = iniparser2.INI()
parser.write_string_bin('something.ini', string)
parser.read_binfile('something.ini')

print(parser)

Exceptions

exceptions because why not

  • base exception
    • ParsingError
      • SectionError
      • PropertyError
  • something else
    • DuplicateError

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

iniparser2-2.0.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

iniparser2-2.0.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file iniparser2-2.0.1.tar.gz.

File metadata

  • Download URL: iniparser2-2.0.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.2 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for iniparser2-2.0.1.tar.gz
Algorithm Hash digest
SHA256 892924949872f781d95f7f57e06cd525fdf0fccab03d852b5128ba32b91e5a23
MD5 92afb349e9e307df96dccf995a7b1751
BLAKE2b-256 5a8bd7dbe5a2348ef3c32fbdd8ec35943c63f46ffa19f25c5b23c5ce9950d061

See more details on using hashes here.

File details

Details for the file iniparser2-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: iniparser2-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.2 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for iniparser2-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a1285ce530c92501d9a930cd0fa23a530b5e9afc7243ec696a91258041ea262
MD5 82f574592035f0b253aeda8a81a4e5d5
BLAKE2b-256 3e97cf64349515357df728a3b5cb69426d4cf01ad88905a7f0c32c832a7de32b

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