Skip to main content

bobbie

Version PyPI Latest Release GitHub Latest Release
Status Build Status Development Status Project Stability
Documentation Hosted By
Tools Documentation Linter Dependency Manager Pre-commit CI Editor Settings Repository Template Dependency Maintainer
Compatibility Compatible Python Versions Linux MacOS Windows
Stats GitHub Stars GitHub Contributors GitHub Issues GitHub Forks

What is bobbie?

It's better to know what you want and who you are

Named after Roberta Draper ("Bobbie") from "The Expanse," bobbie provides a lightweight and easy-to-use way to store and access configuration settings for a Python project.

Why use bobbie?

It's better to know what you want and who you are

There are numerous options for storing configuration settings in Python. So, what makes bobbie different?

  • Flexible: a Settings instance is easily built from a dict, Python module, or file (ini, json, toml, and yaml formats are supported).
  • Lightweight: an efficient codebase ensures a very small memory footprint.
  • Intuitive: a create class method constructs Settings (from any data source).
  • Convenient: unlike configparser, automatic data and type validation is performed when Settings is created.

The comparison table below shows how bobbie compares to the other major options that store configuration options for Python projects.

Getting started

It's better to know what you want and who you are

Installation

To install bobbie, use pip:

pip install bobbie

Create a Settings instance

bobbie supports several ways to create a Settings instance. You can either:

  • If the settings are in a file, call a class method specific to the file type (from_yaml in the second example below);
  • Call a class method for the general type of source data (from_dict or from_file);
  • Call the create class method and it will automatically figure out the appropriate constructor; or
  • If the settings data is in a dict-like object, pass it as the first argument to Settings.

From a dict

import bobbie

configuration = {
  'general': {
    'verbose': False,
    'seed': 43,
    'parallelize': False},
  'files': {
    'source_format': 'csv',
    'file_encoding': 'windows-1252',
    'float_format': '%.4f',
    'export_results': True}}
# You can pick a specific constructor method.
settings = bobbie.Settings.from_dict(configuration)
# Or, may use the general `create` method.
settings = bobbie.Settings.create(configuration)
# Or, just send a `dict` to `Settings` itself.
settings = bobbie.Settings(configuration)

From a file

import bobbie

# You may use the general `create` method.
settings = bobbie.Settings.create('settings_file.yaml')
# Or, the `from_file` method.
settings = bobbie.Settings.from_file('settings_file.yaml')
# Or, the `from_yaml` method. They all do the same thing.
settings = bobbie.Settings.from_yaml('settings_file.yaml')
# Or,

If the file is a Python module, it must contain a variable named settings in the module namespace (unless you change the global setting for the variable name).

Contributing

This could be a really big deal

Contributors are always welcome. Feel free to grab an issue to work on or make a suggested improvement. If you wish to contribute, please read the Contribution Guide and Code of Conduct.

Similar projects

There are a lot of great packages for storing project settings. The table below shows the features of the leading libraries.

Feature Comparison of Python Configuration Libraries

Library Typing Secrets dict ini json py toml yaml
bobbie ✅ ✅ ✅ ✅ ✅ ✅ ✅
configParser ✅
dynaconf ✅ ✅ ✅ ✅ ✅ ✅
Parser-it ✅ ✅ ✅ ✅ ✅
python-decouple ✅ ✅ ✅
pyconfig ✅
pydantic-settings ✅ ✅

Bobbie Draper destroys a robotic arm in an arm-wrestling match

As you can see, bobbie lacks a method for storing passwords, encryption keys, and other secrets. That is because it is focused on internal Python projects and the goal of keeping its resource usage as low as possible. So, if you need secrets stored in your project settings, there are several good options linked above that you should explore.

Acknowledgments

I would like to thank the University of Kansas School of Law for tolerating and supporting this law professor's coding efforts, an endeavor which is well outside the typical scholarly activities in the discipline.

License

Use of this repository is authorized under the Apache Software License 2.0.

Metadata

Release files for bobbie 0.2.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 bobbie 0.2.1
File Size Uploaded
bobbie-0.2.1.tar.gz 118.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bobbie 0.2.1
File Interpreter ABI Platform
bobbie-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 131.6 kB

Release files / bobbie-0.2.1.tar.gz

Download URL bobbie-0.2.1.tar.gz
Size 118.3 kB
Tags Source
SHA-256 checksum
How to use checksums
259d9151c859ce72e426e99fcb79e0a99dc930b5b782b3769f11429a65132d69
BLAKE2b-256 checksum
How to use checksums
859f1601f3757bdfa8b8e7429e9c947cb003a17a46a655db811f50476be5f279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.20 {"installer":{"name":"uv","version":"0.12.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / bobbie-0.2.1-py3-none-any.whl

Download URL bobbie-0.2.1-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
296e6073c464cd6c5bda66dfb06c4574ce8e41725a579c30b71e7bb27b53d874
BLAKE2b-256 checksum
How to use checksums
e331c8f9bd82e4fc93e3954696b1454b5a8d2ac32afc6912652ed7a197c8818b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.20 {"installer":{"name":"uv","version":"0.12.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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