Skip to main content

A basic configuration loader intended for my own scripts, but might be useful for other people.

Project description

basic-config-loader

Load a JSON configuration from a file, or from multiple folders on the filesystem.

Getting Started

Prerequisites

This project has no dependencies. Yay!

Installing

pip install basic-config-loader

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Usage

import configLoader as cl
...
CONFIG = cl.loadConfig(...)
...

:param path: the path to look for the file. It is recommended to provide the result of os.path.join() rather than a manually typed path because a certain OS which must not be named has different path conventions than everyone else.

:param default: the configuration to return if loading from the filesystem fails.

:param fromHome: if True, look from the current user's home directory. If False, look from the root directory.

:param topSearchPath: if None, only look in the specified path for the file. Otherwise, a path should be provided. 'HOME' can be filled in as a shortcut for os.environ['HOME']. The exact behavior depends on fullSearchAlways.

:param fullSearchAlways: if False, and the directory specified in path is empty, move up one folder, up to topSearchPath, until a config file is found, and use the first file found. If no file is found, use the default config. If True, start with the default configuration and apply any changes from topSearchPath to path in order.

:return: the configuration if loading was successful, or the default configuration if loading failed.

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

basic-config-loader-0.2.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

basic_config_loader-0.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file basic-config-loader-0.2.0.tar.gz.

File metadata

  • Download URL: basic-config-loader-0.2.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for basic-config-loader-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4d1f939edecd9f13200e4f9fe9515bd4d4b5d93174c02728d9874c2e73e211b9
MD5 cd46fa4400448386454d432215a40da4
BLAKE2b-256 0384de593eefc538048ed4d54a03b245827ef4efc499f7656e4f5707975a0acd

See more details on using hashes here.

File details

Details for the file basic_config_loader-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: basic_config_loader-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for basic_config_loader-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb58eb6074b96a9906642e84655e4a4c281fe0fb675166c4c8ffd99b6c57d130
MD5 b63a48e6962263f147957849d6d53d7e
BLAKE2b-256 d1032cc08f221d83652dd54a288f005a744190acf12b44b8158949642499132f

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