Skip to main content
# os-config

[![Build Status](https://www.travis-ci.org/cfhamlet/os-config.svg?branch=master)](https://www.travis-ci.org/cfhamlet/os-config)
[![codecov](https://codecov.io/gh/cfhamlet/os-config/branch/master/graph/badge.svg)](https://codecov.io/gh/cfhamlet/os-config)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/os-config.svg)](https://pypi.python.org/pypi/os-config)
[![PyPI](https://img.shields.io/pypi/v/os-config.svg)](https://pypi.python.org/pypi/os-config)


Config utility.

In python world, it is common to use an object as config. But normal object lacks of some useful features for config purpose. This library offers an ``Config`` object which support create, update, attribute access, etc. Consider the usability and complexity in real programming work, config attribute types are limited into: ``int``, ``long``, ``float``, ``NoneType``, ``bool``, ``str``, ``unicode``, ``tuple`` and ``Config``. ``list``, ``dict`` will convert to ``tuple`` and ``Config``.


# Install

`pip install os-config`

# Usage

* create an empty config
```
from os_config import Config
config = Config.create()
```

* create from params
```
config = Config.create(a=1, b=2)
assert config.a == 1
assert config.b == 2
```

* create from dict
```
config = Config.from_dict({'a':1, 'b':2})
```

* create from json
```
json_string = '{"a": 1, "b": 2}'
config = Config.from_json(json_string)
```


* update from another config/dict
```
config1 = Config.create(a=1)
config2 = Config.create(a=2, b=3)
Config.update(config2, config1)
```


# Unit Tests

`$ tox`

# License

MIT licensed.

Metadata

Release files for os-config 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for os-config 0.2.3
File Size Uploaded Provenance
os-config-0.2.3.tar.gz 6.1 kB Without provenance Details

Release files / os-config-0.2.3.tar.gz

Download URL os-config-0.2.3.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cb5fa6a45f1d37f06dc81df7804e04d0d04256df82889e9cdfed66c3260e280e
BLAKE2b-256 checksum
How to use checksums
c647772f3336b5736f63ece58e22a5fc2ba762659d1a1de3e1ffaa0817734c17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.0 CPython/2.7.14

Security for os-config 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page