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
- Define Your Settings Module (
myapp/settings.py):
DEBUG = True
DATABASE_URL = "sqlite:///db.sqlite3"
SECRET_KEY = "my-secret-key"
- Set the Settings Module:
export PYTTING_SETTINGS_MODULE="myapp.settings"
- 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:
- Fork the repository on GitHub.
- Create a new branch for your feature or bugfix.
- Make your changes and ensure tests pass.
- 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fcc32bd43b484ed6d4f528032c2b774e68a36c5a7b3e6f71764a92c4fad4fde
|
|
| MD5 |
058ccaf99ca6fc5073abb5e0b429882d
|
|
| BLAKE2b-256 |
d79c8b283e463fce8ecd48ba2a02a44ac81feb3ef49c84cc385c1d8b8172a20c
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b22800895187789172c48f45db4d4ef25f9e380c941ff9068c2842bcf8e81435
|
|
| MD5 |
1c891c13d49beebafe86f69b64c43b89
|
|
| BLAKE2b-256 |
5e8b171a6c452e98c0f6d6a3ad497ed9ec0891e2547a075258bc5d52709e6175
|