Skip to main content

dotrc

Build Status

Simple .rc file loading for your Python projects. Looks for config files passed via --config as well as typical locations based on your app name:

  • Files provided via --config option (see below)
  • .apprc
  • ~/.config/app

Files are loaded such that files earlier in the above list override settings in later ones. The content of each file is parsed as YAML, falling back to JSON if that fails.

Usage

import dotrc

# Loads .apprc, ~/.config/app, etc.
config = dotrc.load('app')

--config

Additional configuration files may be provided via the --config commandline option. This parses sys.argv directly, so load your configs before doing anything that might modify it. Files are loaded in order, so options in later files override options set in earlier ones.

$ python app.py --config .extrarc .lastrc
$ python app.py --config=.extrarc
$ python app.py --config=.1rc --config=.2rc

A list of files will be populated from the commandline arguments until a switch or option is detected. You need to be mindful if you for some reason have config files starting with dashes, so you don't signal the end of your file list.

$ python app.py --config .1rc --config=--.weirdrc
$ python app.py --config=--.1rc --config=--.2rc
$ python app.py --config ./-.1rc ./-.2rc

Metadata

Release files for dotrc 0.1.1

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

Source distribution (sdist)

Source distribution for dotrc 0.1.1
File Size Uploaded
dotrc-0.1.1.tar.gz 2.7 kB Details

Release files / dotrc-0.1.1.tar.gz

Download URL dotrc-0.1.1.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f231548eca536cdccf1b092b414f3f7896bbfb6bf1e9896fccfdad81645a1e32
BLAKE2b-256 checksum
How to use checksums
4fccbe16cc1a80996ba4771e2c162ca17ccb868bd9568a8a02b993b9a393cf80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1

1 release file

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