Skip to main content

Python settings management with namespacing and modular files. Inspired by Django.

Project description

Pyttings

Lightweight Python settings management with namespacing and modular files. Inspired by Django.

Features

  • Namespaced Settings: Use a prefix (e.g., PYTTING_) to avoid conflicts.
  • Custom Prefix: Change the prefix using PYTTING_ENV_PREFIX.
  • Modular Settings: Load settings from a module with PYTTING_SETTINGS_MODULE.
  • Environment Variables: Override settings easily.

Installation

pip install pyttings

Quick Start

  1. Define Your Settings Module (myapp/settings.py):
DEBUG = True
DATABASE_URL = "sqlite:///db.sqlite3"
SECRET_KEY = "my-secret-key"
  1. Set the Settings Module:
export PYTTING_SETTINGS_MODULE="myapp.settings"
  1. Use Pyttings:
from pyttings import settings

print(settings.DEBUG)  # Output: True
print(settings.DATABASE_URL)  # Output: sqlite:///db.sqlite3

Configuration

Required: PYTTING_SETTINGS_MODULE

Specify the settings module using the PYTTING_SETTINGS_MODULE environment variable. This is mandatory for Pyttings to know where to load your settings from.

export PYTTING_SETTINGS_MODULE="myapp.settings"

Optional: PYTTING_ENV_PREFIX

By default, Pyttings uses PYTTING_ as the prefix for environment variables. For example, to override the DEBUG setting, you would set:

export PYTTING_DEBUG="False"

If you want to use a custom prefix (e.g., MYAPP_), set the PYTTING_ENV_PREFIX environment variable:

export PYTTING_ENV_PREFIX="MYAPP_"
export MYAPP_DEBUG="False"

Now, Pyttings will look for MYAPP_DEBUG instead of PYTTING_DEBUG.

Contributing

Contributions are welcome! If you'd like to contribute to Pyttings, please follow these steps:

  1. Fork the repository on GitHub.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes and ensure tests pass.
  4. Submit a pull request with a clear description of your changes.

Please ensure your code follows the project's style and includes appropriate tests.


License

Pyttings is licensed under the MIT License. See the LICENSE file for details.

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

pyttings-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

pyttings-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pyttings-0.1.0.tar.gz.

File metadata

  • Download URL: pyttings-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pyttings-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0fcc32bd43b484ed6d4f528032c2b774e68a36c5a7b3e6f71764a92c4fad4fde
MD5 058ccaf99ca6fc5073abb5e0b429882d
BLAKE2b-256 d79c8b283e463fce8ecd48ba2a02a44ac81feb3ef49c84cc385c1d8b8172a20c

See more details on using hashes here.

File details

Details for the file pyttings-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyttings-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for pyttings-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b22800895187789172c48f45db4d4ef25f9e380c941ff9068c2842bcf8e81435
MD5 1c891c13d49beebafe86f69b64c43b89
BLAKE2b-256 5e8b171a6c452e98c0f6d6a3ad497ed9ec0891e2547a075258bc5d52709e6175

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