# PyDefinition
Environment-driven configuration helpers with low boilerplate.
## Installation
```bash
pip install pydefinition
```
## Features
- Environment variable management with descriptors
- Type casting for environment variables
- Default values and required variables
- Automatic naming based on class structure
- Caching for performance
## Usage
```python
from pydefinition import EnvVar, parse_bool, parse_int, Required
class AppConfig:
# Basic usage with default value
PORT = EnvVar(default=8080, cast=parse_int)
# Required environment variable (raises KeyError if not set)
API_KEY = EnvVar(default=Required)
# Boolean parsing
DEBUG = EnvVar(default=False, cast=parse_bool)
# Custom name for environment variable
DATABASE_URL = EnvVar(default="sqlite:///app.db", name="DB_URL")
# Usage
config = AppConfig()
port = config.PORT # Will read from APP_CONFIG_PORT or use default 8080
api_key = config.API_KEY # Will read from APP_CONFIG_API_KEY or raise KeyError
```
## Advanced Usage
See the [examples directory](https://github.com/Rushberg/PyDefinition/tree/main/pydefinition/examples) for more advanced usage patterns.
## License
This project is licensed under the MIT License - see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "pydefinition",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "environment, configuration, env, variables, settings",
"author": null,
"author_email": "PyDefinition Contributors <example@example.com>",
"download_url": "https://files.pythonhosted.org/packages/4c/11/d76bb423bf23c08b8989eb2a76e461a30fa254c5ab140abcedde452e87a7/pydefinition-0.1.1.tar.gz",
"platform": null,
"description": "# PyDefinition\r\n\r\nEnvironment-driven configuration helpers with low boilerplate.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install pydefinition\r\n```\r\n\r\n## Features\r\n\r\n- Environment variable management with descriptors\r\n- Type casting for environment variables\r\n- Default values and required variables\r\n- Automatic naming based on class structure\r\n- Caching for performance\r\n\r\n## Usage\r\n\r\n```python\r\nfrom pydefinition import EnvVar, parse_bool, parse_int, Required\r\n\r\nclass AppConfig:\r\n # Basic usage with default value\r\n PORT = EnvVar(default=8080, cast=parse_int)\r\n \r\n # Required environment variable (raises KeyError if not set)\r\n API_KEY = EnvVar(default=Required)\r\n \r\n # Boolean parsing\r\n DEBUG = EnvVar(default=False, cast=parse_bool)\r\n \r\n # Custom name for environment variable\r\n DATABASE_URL = EnvVar(default=\"sqlite:///app.db\", name=\"DB_URL\")\r\n\r\n# Usage\r\nconfig = AppConfig()\r\nport = config.PORT # Will read from APP_CONFIG_PORT or use default 8080\r\napi_key = config.API_KEY # Will read from APP_CONFIG_API_KEY or raise KeyError\r\n```\r\n\r\n## Advanced Usage\r\n\r\nSee the [examples directory](https://github.com/Rushberg/PyDefinition/tree/main/pydefinition/examples) for more advanced usage patterns.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Environment-driven configuration helpers with low boilerplate",
"version": "0.1.1",
"project_urls": {
"Changelog": "https://github.com/Rushberg/PyDefinition/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/Rushberg/PyDefinition#readme",
"Homepage": "https://github.com/Rushberg/PyDefinition",
"Issues": "https://github.com/Rushberg/PyDefinition/issues"
},
"split_keywords": [
"environment",
" configuration",
" env",
" variables",
" settings"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "f3e9a50fd5092ad7cba6f4729fd0ddc754c7be18025cb20b8e9f7f47e638db50",
"md5": "a03e4fd83c1b197002949da9d148b6d7",
"sha256": "55e84f45efdaac2d5aeae67d0289eca2447e43044daa44fec95e67a6735e447d"
},
"downloads": -1,
"filename": "pydefinition-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a03e4fd83c1b197002949da9d148b6d7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4382,
"upload_time": "2025-08-19T06:28:23",
"upload_time_iso_8601": "2025-08-19T06:28:23.012735Z",
"url": "https://files.pythonhosted.org/packages/f3/e9/a50fd5092ad7cba6f4729fd0ddc754c7be18025cb20b8e9f7f47e638db50/pydefinition-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4c11d76bb423bf23c08b8989eb2a76e461a30fa254c5ab140abcedde452e87a7",
"md5": "8fdd258cee59ae0b5687cb0a7df320a3",
"sha256": "d263d38880639ecdc3b64f93f7e3abaa79f8e142b43d45b0cde7973bcb24e01a"
},
"downloads": -1,
"filename": "pydefinition-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "8fdd258cee59ae0b5687cb0a7df320a3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 4044,
"upload_time": "2025-08-19T06:28:23",
"upload_time_iso_8601": "2025-08-19T06:28:23.929325Z",
"url": "https://files.pythonhosted.org/packages/4c/11/d76bb423bf23c08b8989eb2a76e461a30fa254c5ab140abcedde452e87a7/pydefinition-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-19 06:28:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Rushberg",
"github_project": "PyDefinition",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pydefinition"
}