get-settings


Nameget-settings JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://pypi.org/project/get-settings/
Summaryget-settings is a python library designed to facilitate the retrieval of configuration variables from a settings.py file.
upload_time2024-01-30 13:31:07
maintainerAhmed
docs_urlNone
authorAhmed
requires_python>=3.8,<4.0
licenseMIT
keywords packaging poetry
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # get-settings

[![PyPI version][pypi_badge]][pypi_link]

get-settings is a python library designed to facilitate the retrieval of configuration variables from a `settings.py` file. It provides a convenient way to load these variables as a Python dictionary. This library is particularly useful in the development of Python libraries, as it can dynamically detect and load configuration file content.

- [Installation](#installation)
- [Usage](#usage)
  * [Automatic configuration](#usage)
  * [Manual configuration](#manual-configuration)
- [File format](#file-format)
- [Contributing](#contributing)
- [License](#license)
- [Credits](#credits)


## Installation

```shell
pip install get-settings
```

## Usage

```python
from get_settings import load_settings()

settings = load_settings()  # settings = {"USER": "foo", "EMAIL": "foo@example.org"}
```

Ensure that `settings.py` file exists in the project root and contains the necessary configuration parameters
```
.
├── settings.py
└── foo.py
```

Don't forget to add `get_settings` to your pyproject.toml:
```toml
dependencies = [
    "get-settings>=0.1.1",
]
```

### Manual configuration

Also, you can manually provide the file path to the library's configuration function:

```python
# Provide the path to the settings.py file
settings_path = "/path/to/settings.py"
settings = load_settings(settings_path)
```

## File format
Varibales accepts from the library
```python
# settings.py

USER = "FOO" # YES
PORT = 8000 # YES
DEBUG = True # YES
ORIGINS = ["http://localhost", ...] # YES
FOO = {"email": "foo@example.com"} # YES

foo = "user" # NO
__FOO__ = "user" # NO
```
the result of `load_settings()` will be the following:
```python
{
    "USER": "FOO",
    "PORT": 8000,
    "DEBUG": True,
    "ORIGINS": ["http://localhost", ...],
    "FOO": {"email": "foo@example.com"},
}
```

## Contributing
We welcome contributions to this project! If you would like to contribute, please fork this repository and submit a pull request with your changes. Before submitting a pull request, please make sure that your changes are fully tested and that they adhere to our code standards.

## License
This project is licensed under the MIT License - see the LICENSE file for details.

## Credits
Some features in this library are partially inspired by the [python-dotenv]([pyton-dotenv]) library
Copyright (c) 2014, Saurabh Kumar, 2013, Ted Tieken, 2013, Jacob Kaplan-Moss

<br>
Thank you for using get-settings library! 

[pypi_badge]: https://badge.fury.io/py/get-settings.svg
[pypi_link]: https://badge.fury.io/py/get-settings
[pyton-dotenv]: https://github.com/theskumar/python-dotenv
            

Raw data

            {
    "_id": null,
    "home_page": "https://pypi.org/project/get-settings/",
    "name": "get-settings",
    "maintainer": "Ahmed",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "ahmedtamer552001@gmail.com",
    "keywords": "packaging,poetry",
    "author": "Ahmed",
    "author_email": "ahmedtamer552001@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bd/0f/9701671167886f48de84fdc38698ee27f1635332260294cf43e18d35bda0/get_settings-0.1.1.tar.gz",
    "platform": null,
    "description": "# get-settings\n\n[![PyPI version][pypi_badge]][pypi_link]\n\nget-settings is a python library designed to facilitate the retrieval of configuration variables from a `settings.py` file. It provides a convenient way to load these variables as a Python dictionary. This library is particularly useful in the development of Python libraries, as it can dynamically detect and load configuration file content.\n\n- [Installation](#installation)\n- [Usage](#usage)\n  * [Automatic configuration](#usage)\n  * [Manual configuration](#manual-configuration)\n- [File format](#file-format)\n- [Contributing](#contributing)\n- [License](#license)\n- [Credits](#credits)\n\n\n## Installation\n\n```shell\npip install get-settings\n```\n\n## Usage\n\n```python\nfrom get_settings import load_settings()\n\nsettings = load_settings()  # settings = {\"USER\": \"foo\", \"EMAIL\": \"foo@example.org\"}\n```\n\nEnsure that `settings.py` file exists in the project root and contains the necessary configuration parameters\n```\n.\n\u251c\u2500\u2500 settings.py\n\u2514\u2500\u2500 foo.py\n```\n\nDon't forget to add `get_settings` to your pyproject.toml:\n```toml\ndependencies = [\n    \"get-settings>=0.1.1\",\n]\n```\n\n### Manual configuration\n\nAlso, you can manually provide the file path to the library's configuration function:\n\n```python\n# Provide the path to the settings.py file\nsettings_path = \"/path/to/settings.py\"\nsettings = load_settings(settings_path)\n```\n\n## File format\nVaribales accepts from the library\n```python\n# settings.py\n\nUSER = \"FOO\" # YES\nPORT = 8000 # YES\nDEBUG = True # YES\nORIGINS = [\"http://localhost\", ...] # YES\nFOO = {\"email\": \"foo@example.com\"} # YES\n\nfoo = \"user\" # NO\n__FOO__ = \"user\" # NO\n```\nthe result of `load_settings()` will be the following:\n```python\n{\n    \"USER\": \"FOO\",\n    \"PORT\": 8000,\n    \"DEBUG\": True,\n    \"ORIGINS\": [\"http://localhost\", ...],\n    \"FOO\": {\"email\": \"foo@example.com\"},\n}\n```\n\n## Contributing\nWe welcome contributions to this project! If you would like to contribute, please fork this repository and submit a pull request with your changes. Before submitting a pull request, please make sure that your changes are fully tested and that they adhere to our code standards.\n\n## License\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Credits\nSome features in this library are partially inspired by the [python-dotenv]([pyton-dotenv]) library\nCopyright (c) 2014, Saurabh Kumar, 2013, Ted Tieken, 2013, Jacob Kaplan-Moss\n\n<br>\nThank you for using get-settings library! \n\n[pypi_badge]: https://badge.fury.io/py/get-settings.svg\n[pypi_link]: https://badge.fury.io/py/get-settings\n[pyton-dotenv]: https://github.com/theskumar/python-dotenv",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "get-settings is a python library designed to facilitate the retrieval of configuration variables from a settings.py file.",
    "version": "0.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/Tammura/get-settings/issues",
        "Homepage": "https://pypi.org/project/get-settings/",
        "Repository": "https://github.com/Tammura/get-settings"
    },
    "split_keywords": [
        "packaging",
        "poetry"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5764f47f0670ab5c52b48e7b2294067905080bb82e4db9e62bf6e6c620d30bf1",
                "md5": "93e7cdab7d9ea44fc2500be821f2241c",
                "sha256": "b87d15635c09c48a2bc9a16219cfb3abdde00d54e82504f1d55de4cfd0a57ac2"
            },
            "downloads": -1,
            "filename": "get_settings-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "93e7cdab7d9ea44fc2500be821f2241c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 4512,
            "upload_time": "2024-01-30T13:31:05",
            "upload_time_iso_8601": "2024-01-30T13:31:05.227680Z",
            "url": "https://files.pythonhosted.org/packages/57/64/f47f0670ab5c52b48e7b2294067905080bb82e4db9e62bf6e6c620d30bf1/get_settings-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd0f9701671167886f48de84fdc38698ee27f1635332260294cf43e18d35bda0",
                "md5": "67bddc2b5f154ec849cbb5e027cf0822",
                "sha256": "a6d9b1b04039636fd4ef45872cbaa0ca65f8258e0fac5689de18f4043cb85d61"
            },
            "downloads": -1,
            "filename": "get_settings-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "67bddc2b5f154ec849cbb5e027cf0822",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 4135,
            "upload_time": "2024-01-30T13:31:07",
            "upload_time_iso_8601": "2024-01-30T13:31:07.179145Z",
            "url": "https://files.pythonhosted.org/packages/bd/0f/9701671167886f48de84fdc38698ee27f1635332260294cf43e18d35bda0/get_settings-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-30 13:31:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Tammura",
    "github_project": "get-settings",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "get-settings"
}
        
Elapsed time: 0.17612s