Skip to main content

Flexible, easy Python project configuration

Project description

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 PyPI Download Rate (per month) GitHub Stars GitHub Contributors GitHub Issues GitHub Forks

What is bobbie?

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

bobbie provides a lightweight, easy-to-use, flexible, and extensible Settings class for loading and storing configuration settings for a Python project.

Why use bobbie?

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

  • Flexible: a Settings instance is easily built from a dict, Python module, or file.
  • 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.

This could be a really big deal

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

Getting started

Installation

To install bobbie, use pip:

pip install bobbie

Create a Settings instance

bobbie supports several ways to create a Settings instance. However, you can opt to always use the create class method for any data source.

From 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 may use the general `create` method.
settings = bobbie.Settings.create(configuration)
# Or, just send a `dict` to `Settings` itself.
settings = bobbie.Settings(configuration)

From 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')

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

Contributing

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

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

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

As you can see, bobbie lacks a method for storing passwords, encryption keys, and other secrets. That is largely 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 listed 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.

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

bobbie-0.1.7.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bobbie-0.1.7-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file bobbie-0.1.7.tar.gz.

File metadata

  • Download URL: bobbie-0.1.7.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.3 CPython/3.13.1 Linux/6.8.0-1020-azure

File hashes

Hashes for bobbie-0.1.7.tar.gz
Algorithm Hash digest
SHA256 05a0d246c1e1f03fa26550286bbf3cd38322c3343e4eed3e23e3cb904a6c5532
MD5 72abbccb2df365fcefb8efd77891b0fe
BLAKE2b-256 4a7c7368a59ed734bab66d5158b82641df0c1165e0532a174f34297297676cbe

See more details on using hashes here.

File details

Details for the file bobbie-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: bobbie-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.3 CPython/3.13.1 Linux/6.8.0-1020-azure

File hashes

Hashes for bobbie-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 220f5f38c59b91756f9de8cdc5794781eb37ed728071f29cf8d7a4820553fd1b
MD5 ec6eb9b14e67229969829f02c95ad173
BLAKE2b-256 f1c91525a212ea3f0f9fc513526b31529a8b71088323b6286c90c54d20ac0fb3

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