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
htmlmaster

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.4

  • Fixed a bug in path resolution.

v0.0.3

  • Added reliance on htmlmaster.

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 Distribution

cfgtools-0.0.4.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

cfgtools-0.0.4-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file cfgtools-0.0.4.tar.gz.

File metadata

  • Download URL: cfgtools-0.0.4.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for cfgtools-0.0.4.tar.gz
Algorithm Hash digest
SHA256 db241da3da5446326972cea9fb8b576a96dd03feac46cb9a1762f2d57a69338b
MD5 940897fbf64ff082255b8544de0a2fee
BLAKE2b-256 1c718db71a6652e0910350049104aaff6cc26d7e0e4e8fbb201bfe747313a3f6

See more details on using hashes here.

File details

Details for the file cfgtools-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: cfgtools-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for cfgtools-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f9c6f11a89250569f4b7e3b48eacc5d03a23b57cf45399084f82f9ef27fe004a
MD5 496118118ea254b34f86d56cd189fcb6
BLAKE2b-256 315847fdcc57eac0bc203b3742174f5da939483e1010324afa5a74181631b5b4

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