# settipy-pure-python
## _settings should be simple, and with settipy it is._
Created for working with pypy.
settings parses command line and environment variables on one line.
And makes it available throughout the code base. Making using settings in your project as boring and unimportant as it should be.
settings vars is as simple as:
```go
settipy.set("FOO", "default value", "help text")
```
getting vars out has the same level of complexity as setting the value.
```go
settipy["FOO"]
```
## Features
Settipy offers a range of convenient features to help manage configuration settings, such as environment variables and command-line arguments. Here are some of the main features provided by Settipy:
* Unified access to environment variables and command-line arguments: Settipy allows you to access and manage both environment variables and command-line arguments through a single, consistent interface, making it easier to work with these configuration settings.
* Default values and descriptions: Settipy allows you to define default values and descriptions for configuration settings, ensuring that your application always has a fallback value and making it easier for other developers to understand the purpose of each setting.
* Encrypted storage: Settipy provides a secure method for storing sensitive information such as passwords, using a secret splitting technique that divides the data into two separate parts. This method ensures that an attacker would need access to both the process arguments and environment variables to reconstruct the full password, reducing the risk of unauthorized access.
* Flexible parsing: Settipy can be used to parse a wide range of data types, including integers, floats, booleans, and strings. This makes it suitable for various use cases and simplifies the process of working with different types of configuration settings.
* Easy integration: Settipy is designed to be easy to integrate into your existing projects. Simply import the library and start using it to manage your configuration settings without any complex setup.
* Platform independence: Settipy is compatible with both Unix and Windows systems, ensuring that your configuration settings can be managed consistently across different platforms.
## Example
example of how to use. More can be found in the [example_project](https://github.com/Attumm/settipy/blob/main/example.py)
```python
settipy.set("FOO", "default value", "handy help text")
settipy.parse()
print("foo = ", settipy["FOO"])
```
The above go will produce program that can be used as follows.
get handy help text set in the above example on the same line.
This can get very handy when the project grows and is used in different environments
```python
$ python example.py --help
Usage of example.py:
-FOO string
handy help text (default "default value")
```
When no value is given, default value is used
```python
$ python example.py
foo = default value
```
Running the binary with command line input
```python
$ python example.py -FOO bar
foo = bar
```
Running the binary with environment variable
```python
$ FOO=ok;python example.py
foo = ok
```
## Order of preference
variables are set with preference
variables on the command line will have highest preference.
This because while testing you might want to override environment
The priority order is as follows
1. Command line input
2. Environment variables
3. Default values
## Types
settipy supports different types. It's possible to use the method "get".
But to be more clear to the reader of the code you can add the type e.g "get_bool".
```python
// string
settipy.set("FOO", "default", "help text")
settipy["FOO"]
// integer
settipy.set_int("FOO", 42, "help text")
settipy["FOO"]
// boolean
settipy.set_bool("FOO", True, "help text")
settipy["FOO"]
// list
settipy.set_list("FOO", [1, 2, 3], "help text", sep=".")
settipy["FOO"]
dic = {
"foo": ["bar",],
"foo1": ["bar1", "bar2"]
}
settipy.set_dict("foodict", dic, "dict with lists", item_sep=";", key_sep=";", sep=",")
settipy["foodict"]
```
## Var Should be set
settipy supports different types.
```python
// string
settipy.set("foshure", True, "handy message", should=True)
```
```$ python3 example.py --hamlet_too
flag: foshure handy message: should be set
```
## Verbose mode
Run the variables that are set before your programs runs, this can help with debugging or in production.
It's possible to hide variables with setting `password=True`
Either run the program with `--settipy-verbose` as cli argument or `settipy.parse(verbose=True)`
## Install
```sh
$ pip install settipy-pure-python
```
## Future features
* Add Typing
* Use logging
* Add to Readme features such as 'should_if', 'options'.
* Add options that are available to user, when input is not part of options.
## License
MIT
Raw data
{
"_id": null,
"home_page": "https://github.com/Attumm/settipy_pure_python",
"name": "settipy-pure-python",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Melvin Bijman",
"author_email": "bijman.m.m@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/87/a3/3a81341d2deee251f1e9743407bf22564b141afaf723609abbfa73bf3339/settipy_pure_python-1.0.1.tar.gz",
"platform": null,
"description": "# settipy-pure-python\n## _settings should be simple, and with settipy it is._\n\nCreated for working with pypy.\n\nsettings parses command line and environment variables on one line.\nAnd makes it available throughout the code base. Making using settings in your project as boring and unimportant as it should be.\nsettings vars is as simple as:\n```go\nsettipy.set(\"FOO\", \"default value\", \"help text\")\n```\ngetting vars out has the same level of complexity as setting the value.\n```go\nsettipy[\"FOO\"]\n```\n\n\n## Features\nSettipy offers a range of convenient features to help manage configuration settings, such as environment variables and command-line arguments. Here are some of the main features provided by Settipy:\n\n* Unified access to environment variables and command-line arguments: Settipy allows you to access and manage both environment variables and command-line arguments through a single, consistent interface, making it easier to work with these configuration settings.\n\n* Default values and descriptions: Settipy allows you to define default values and descriptions for configuration settings, ensuring that your application always has a fallback value and making it easier for other developers to understand the purpose of each setting.\n\n* Encrypted storage: Settipy provides a secure method for storing sensitive information such as passwords, using a secret splitting technique that divides the data into two separate parts. This method ensures that an attacker would need access to both the process arguments and environment variables to reconstruct the full password, reducing the risk of unauthorized access.\n\n* Flexible parsing: Settipy can be used to parse a wide range of data types, including integers, floats, booleans, and strings. This makes it suitable for various use cases and simplifies the process of working with different types of configuration settings.\n\n* Easy integration: Settipy is designed to be easy to integrate into your existing projects. Simply import the library and start using it to manage your configuration settings without any complex setup.\n\n* Platform independence: Settipy is compatible with both Unix and Windows systems, ensuring that your configuration settings can be managed consistently across different platforms.\n\n\n## Example\nexample of how to use. More can be found in the [example_project](https://github.com/Attumm/settipy/blob/main/example.py)\n```python\nsettipy.set(\"FOO\", \"default value\", \"handy help text\")\n\nsettipy.parse()\n\nprint(\"foo = \", settipy[\"FOO\"])\n```\nThe above go will produce program that can be used as follows.\nget handy help text set in the above example on the same line.\nThis can get very handy when the project grows and is used in different environments\n```python\n$ python example.py --help\nUsage of example.py:\n -FOO string\n handy help text (default \"default value\")\n```\n\nWhen no value is given, default value is used\n```python\n$ python example.py\nfoo = default value\n```\n\nRunning the binary with command line input\n```python\n$ python example.py -FOO bar\nfoo = bar\n```\nRunning the binary with environment variable\n```python\n$ FOO=ok;python example.py\nfoo = ok\n```\n\n## Order of preference\nvariables are set with preference\nvariables on the command line will have highest preference.\nThis because while testing you might want to override environment\nThe priority order is as follows\n1. Command line input\n2. Environment variables\n3. Default values\n\n## Types\nsettipy supports different types. It's possible to use the method \"get\".\nBut to be more clear to the reader of the code you can add the type e.g \"get_bool\".\n```python\n// string\nsettipy.set(\"FOO\", \"default\", \"help text\")\nsettipy[\"FOO\"]\n\n// integer\nsettipy.set_int(\"FOO\", 42, \"help text\")\nsettipy[\"FOO\"]\n\n// boolean\nsettipy.set_bool(\"FOO\", True, \"help text\")\nsettipy[\"FOO\"]\n\n// list\nsettipy.set_list(\"FOO\", [1, 2, 3], \"help text\", sep=\".\")\nsettipy[\"FOO\"]\n\ndic = {\n \"foo\": [\"bar\",],\n \"foo1\": [\"bar1\", \"bar2\"]\n}\nsettipy.set_dict(\"foodict\", dic, \"dict with lists\", item_sep=\";\", key_sep=\";\", sep=\",\")\nsettipy[\"foodict\"]\n```\n\n## Var Should be set\nsettipy supports different types.\n```python\n// string\nsettipy.set(\"foshure\", True, \"handy message\", should=True)\n```\n\n```$ python3 example.py --hamlet_too\nflag: foshure handy message: should be set\n```\n\n## Verbose mode\nRun the variables that are set before your programs runs, this can help with debugging or in production.\nIt's possible to hide variables with setting `password=True`\nEither run the program with `--settipy-verbose` as cli argument or `settipy.parse(verbose=True)`\n\n\n## Install\n```sh\n$ pip install settipy-pure-python\n```\n\n## Future features\n\n* Add Typing\n* Use logging\n* Add to Readme features such as 'should_if', 'options'.\n* Add options that are available to user, when input is not part of options.\n\n## License\n\nMIT\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "settings should be simple, boring and forget-able. With settipy it will be just that. Without dependencies pure python",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/Attumm/settipy_pure_python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dfddabb1889da419c65b75e706093e8896c8012f7266c0811702ada8dd456d75",
"md5": "0d95a08d331ca47a697ba026308e99ef",
"sha256": "a1e597c404f49774fe6099e3af85ff889e2f021900dcb14da1182a8bc2be76e3"
},
"downloads": -1,
"filename": "settipy_pure_python-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0d95a08d331ca47a697ba026308e99ef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5132,
"upload_time": "2023-08-29T10:56:05",
"upload_time_iso_8601": "2023-08-29T10:56:05.620331Z",
"url": "https://files.pythonhosted.org/packages/df/dd/abb1889da419c65b75e706093e8896c8012f7266c0811702ada8dd456d75/settipy_pure_python-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "87a33a81341d2deee251f1e9743407bf22564b141afaf723609abbfa73bf3339",
"md5": "d78946c7f82e7d5fa99ee6686204a2ba",
"sha256": "622a4dea6bf487e7abaf7c7e071cabc502aa9d95d70551a52e2b16cc4bea994e"
},
"downloads": -1,
"filename": "settipy_pure_python-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "d78946c7f82e7d5fa99ee6686204a2ba",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5046,
"upload_time": "2023-08-29T10:56:08",
"upload_time_iso_8601": "2023-08-29T10:56:08.383937Z",
"url": "https://files.pythonhosted.org/packages/87/a3/3a81341d2deee251f1e9743407bf22564b141afaf723609abbfa73bf3339/settipy_pure_python-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-29 10:56:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Attumm",
"github_project": "settipy_pure_python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "settipy-pure-python"
}