Skip to main content

Simple text configuration file reading/writing

Project description

TextConfig

TextConfig is a Class for managing simple text configuration files with python. By simple, it means that they are simple text files, there are no sections and all options in the configuration files use a strict

OPTION=value

format, with no spaces between OPTION, = and value. The same OPTION can be used more than once, so you can have multiple values, for example:

EXAMPLE=one
EXAMPLE=two

Here's a real-world example of such a file, taken from the slapt-get package manager repository configuration file in Salix:

# Working directory for local storage/cache.
WORKINGDIR=/var/slapt-get

# Exclude package names and expressions.
# To exclude pre and beta packages, add this to the exclude:
#   [0-9\_\.\-]{1}pre[0-9\-\.\-]{1}
EXCLUDE=^aaa_elflibs,^aaa_base,^devs,^glibc.*,^kernel-.*,^rootuser-settings,^zzz-settings.*,-i?86-

# The Slackware repositories, including dependency information
SOURCE=http://www.mirrorservice.org/sites/download.salixos.org/x86_64/slackware-14.2/:OFFICIAL
SOURCE=http://www.mirrorservice.org/sites/download.salixos.org/x86_64/slackware-14.2/extra/:OFFICIAL

# The Salix repository
SOURCE=http://www.mirrorservice.org/sites/download.salixos.org/x86_64/14.2/:PREFERRED
# And the Salix extra repository
SOURCE=http://www.mirrorservice.org/sites/download.salixos.org/x86_64/extra-14.2/:OFFICIAL

You may call it like this:

from textconfig import TextConfig
c = TextConfig('/path/to/configfile')

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

textconfig-0.1.tar.gz (15.6 kB view details)

Uploaded Source

File details

Details for the file textconfig-0.1.tar.gz.

File metadata

  • Download URL: textconfig-0.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

File hashes

Hashes for textconfig-0.1.tar.gz
Algorithm Hash digest
SHA256 ad5568911d070948a8b3ce2ffd360d6ca8fb4c1b7b7514309fc1c31df5ca5a54
MD5 289d1f839c0bf3cf9d4f3140753f5807
BLAKE2b-256 b9a65bdd32fbe0f2c4cae6e7c3d542b18d147abfe556bfc961b75eb4c8630e1f

See more details on using hashes here.

Supported by

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