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.test_case.ip_locations(3, 0)
>>> 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({
    '38.113.227.125': [
        'Changchester', '4759 William Haven Apt. 194', 'West Corey, CA 90152',
    ],
    '128.18.185.81': ['Ryanborough', 'Unit 7784 Box 0801', 'DPO AP 52775'],
    '85.75.200.206': [
        'Claytonmouth', '139 John Divide Suite 115', 'Rodriguezside, LA 93111',
    ],
})

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.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.1-py2.py3-none-any.whl (17.6 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: cfgtools-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.6 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.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8a74d12e725ce4150e8a711d6b500086f31999d60460af0757e97591872c4070
MD5 deaca5fa03b6a1d4f3ce91559fefc7d0
BLAKE2b-256 2486abed3725202752785598fb935d90e4b72b230dcb611016313be276325ba5

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