Skip to main content

Provides tools for managing config files.

Project description

cfgtools

Provides tools for managing config files.

Installation

$ pip install cfgtools

Requirements

pyyaml
lazyr
Faker

Usage

Save to a config file

>>> import cfgtools
>>> cfg = cfgtools.config({"foo": "bar", "this": ["is", "an", "example"]})
>>> cfg.save("test.cfg", "yaml") # or: cfg.to_yaml("test.cfg")

If not specifeid, the format of the file will be automatically detected according to the file suffix. Valid formats include ini, json, yaml, pickle, etc. For example:

>>> cfg.save("test.yaml") # a yaml file is created
>>> cfg.save("test.pkl") # a pickle file is created
>>> cfg.save("unspecified.cfg") # by default a json file is created

Read from a config file

>>> cfgtools.read("test.cfg")
cfgtools.config({'foo': 'bar', 'this': ['is', 'an', 'example']})

The encoding and format of the file will be automatically detected if not specified.

See Also

Github repository

PyPI project

License

This project falls under the BSD 3-Clause License.

History

v0.0.2

  • New method ConfigIOWrapper.safematch().

v0.0.1

  • Initial release.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

cfgtools-0.0.2-py2.py3-none-any.whl (17.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cfgtools-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: cfgtools-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.13

File hashes

Hashes for cfgtools-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 dcf698acd1e69beba3884b937fce32e3b7c5ea0fd65c08dc1131fa53037579b5
MD5 f2c013b79217c4c25fcb254d443d5fd0
BLAKE2b-256 389d575f30dd398b5c189daafe36c4bfccd47eec65e21965d9f3f1adfe994faf

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