Skip to main content

Dot notation for configuration files.

Project description

dotini
======

Summary
-------
This package is a simple layer on top of the built-in configparser module.
The advantage of dotini is the option of using dot notation to access
settings in a configuration file, provided the settings and section names are
valid variable names. This is aesthetically pleasing.

Usage
-----
With the dotini module imported, use the read() function to parse a config-
uration file. This is done using configparser, for more details regarding
file format and rules, see the official documentation for configparser.

Once the configuration file has been read, it’s settings can be accessed with
dot notation for settings with valid variable names. Settings without valid
variable names can still be accessed with square brackets.

import dotini
settings = dotini.read(‘settings.ini’)
_login(user=settings.user.name,
pass=settings.user[‘pass’])

Notes
-----
As mentioned previously, to be able to use the dot notation access, settings
should be made with variable safe names.

Setting values are read in as strings, and there is no automatic type conversion
when they are stored or accessed. Type conversion is up to you!

Example Configuration File
—-------------------------
[user]
name = ‘thomas’
pass = ‘samoht’

[performance]
speed = 10
cores = 4

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

dotini-0.0.1.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dotini-0.0.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file dotini-0.0.1.tar.gz.

File metadata

  • Download URL: dotini-0.0.1.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for dotini-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3ac56e2af6916901f2bb490ac2f530fd715769d80af6768396696faad55c6bd2
MD5 63c743b811e30d7ef8313b5300ec7657
BLAKE2b-256 b59f28bfd45e063b2b28cb8230dc0855bfed0b98af5d502de42bcd2e83c4f21f

See more details on using hashes here.

File details

Details for the file dotini-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: dotini-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.0

File hashes

Hashes for dotini-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dfb55815e3955d71fef2f31d7457d69cc2dad644c8c7700c6294e18be0b8cc10
MD5 1d48b33028784b8621ed874f42a70997
BLAKE2b-256 8dad5e05590a027c7729296c15bb3a0a49f2ab9254228a3ae828660bbddf3a9d

See more details on using hashes here.

Supported by

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