Skip to main content

A convinient .ini file to NamedTuple parser that supports type hinting

Project description

Convert a .ini config file to a typed Object

/videos/best_now.gif

Installation

Install via pip pip install config-to-object.
There are no dependencies.

Usage

Create your .ini configuration file. For an example look at example_config.ini. You can use any type of native python object such as tuples, lists, strings, floats, integers as parameter values (except dict). There type will be automatically recognized when loading the config file.

Load your configuration file using from config_to_object import load_config and config = load_config("path/to/your/config.ini")

You can access the values from your .ini using . syntax: words = config.Params.words.

If you want your config object to be type hinted, so that your IDE can give you better code completions, run ini_typefile path/to/your/config.ini config_types.py. Then, in your code add from config_types import Config and initialize your config with config:Config = load_config("path/to/your/config.ini")

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

config-to-object-1.0.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

config_to_object-1.0.3-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file config-to-object-1.0.3.tar.gz.

File metadata

  • Download URL: config-to-object-1.0.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for config-to-object-1.0.3.tar.gz
Algorithm Hash digest
SHA256 f83f7a632053deae15886150710f994dfa9f2a4bad3ad8f2b9a92258f2b5b42a
MD5 a07ca2daeafe2403c6209567eceb2f0e
BLAKE2b-256 dd4f39339b591f1ea4f35a3b9c19799035f27a5549c51e7c6fd57101b0f06641

See more details on using hashes here.

File details

Details for the file config_to_object-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: config_to_object-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for config_to_object-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 24185b0f29e3a44b21d48a24c77018ab901571d3d0387195e706a6f8aa67801f
MD5 123646075a8c359a31785070bc4e982b
BLAKE2b-256 b0d5c0e1780fc45e9e38e5ca9a2bf1058f5f67f5f7169afbd3274db231caa951

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