ews-core-config


Nameews-core-config JSON
Version 20240416 PyPI version JSON
download
home_pageNone
SummaryA simple TOML configuration for EWS settings
upload_time2024-04-16 09:52:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 EWS Consulting Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords configuration settings ews
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ews-core-config

[![PyPI version](https://img.shields.io/pypi/v/ews-core-config.svg)](https://pypi.python.org/pypi/ews-core-config)
[![PyPI - License](https://img.shields.io/pypi/l/ews-core-config.svg)](https://pypi.python.org/pypi/ews-core-config)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ews-core-config.svg)](https://pypi.python.org/pypi/ews-core-config)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/ews-core-config)

<!-- ![Build](https://github.com/EWS-Consulting-Public/ews-core-config/actions/workflows/python-publish.yml/badge.svg?event=push) -->
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Precommit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com)

## Installation

Install with

```sh
pipx install ews-core-config[cli]
```

## What does it do

It looks for a `~/.config/ews/ews_config.toml` file.

See an example configuration [in this discussion](https://github.com/EWS-Consulting-Public/ews-core-config/discussions/3).

The default config is found in the file [config.py](https://github.com/EWS-Consulting-Public/ews-core-config/blob/main/src/ews_core_config/config.py#L10).

## Usage

Libraries developed by EWS Consulting can require this package as an optional
dependency under the extra `ews`.

This can be done in the `pyproject.toml` file.

```toml

[project.optional-dependencies]
ews = ["ews-core-config"]
```

This installation will be like:

> pip install ews-my-awesome-library[ews]

Then, in the code:

```python
import contextlib
with contextlib.suppress(ImportError):
    from ews_core_config.config import read_settings
    read_settings()
my_password = os.getenv("EWS_SHAREPOINT_USERNAME", "")
```

This will read your config file and set all the environment variables.

For instance, other libraries (like the one used to retrieve files on our SharePoint) will have access to the env. variable `EWS_SHAREPOINT_USERNAME` and `EWS_SHAREPOINT_PASSWORD`.

Alternatively, you can directly retrieve the `settings` from the module.

```python
from ews_core_config.config import read_settings
EWSSettings = read_settings()
username = EWSSettings.sharepoint_username
assert username != "", "Please set your SharePoint user name!"
```

**This is not the preferred way**. Indeed, it might be easier to refractor
libraries to make them independent of our library if they just use environment variables.

## Installation with pipx

```bash
pipx install .[cli] --editable --force
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ews-core-config",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "configuration, settings, EWS",
    "author": null,
    "author_email": "EWS Consulting <github@ews-consulting.com>",
    "download_url": "https://files.pythonhosted.org/packages/9d/15/d65b3de723494d7310fc72ec08a727453fc320e9905ac70caa26347eb0c0/ews_core_config-20240416.tar.gz",
    "platform": null,
    "description": "# ews-core-config\n\n[![PyPI version](https://img.shields.io/pypi/v/ews-core-config.svg)](https://pypi.python.org/pypi/ews-core-config)\n[![PyPI - License](https://img.shields.io/pypi/l/ews-core-config.svg)](https://pypi.python.org/pypi/ews-core-config)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ews-core-config.svg)](https://pypi.python.org/pypi/ews-core-config)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/ews-core-config)\n\n<!-- ![Build](https://github.com/EWS-Consulting-Public/ews-core-config/actions/workflows/python-publish.yml/badge.svg?event=push) -->\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Precommit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com)\n\n## Installation\n\nInstall with\n\n```sh\npipx install ews-core-config[cli]\n```\n\n## What does it do\n\nIt looks for a `~/.config/ews/ews_config.toml` file.\n\nSee an example configuration [in this discussion](https://github.com/EWS-Consulting-Public/ews-core-config/discussions/3).\n\nThe default config is found in the file [config.py](https://github.com/EWS-Consulting-Public/ews-core-config/blob/main/src/ews_core_config/config.py#L10).\n\n## Usage\n\nLibraries developed by EWS Consulting can require this package as an optional\ndependency under the extra `ews`.\n\nThis can be done in the `pyproject.toml` file.\n\n```toml\n\n[project.optional-dependencies]\news = [\"ews-core-config\"]\n```\n\nThis installation will be like:\n\n> pip install ews-my-awesome-library[ews]\n\nThen, in the code:\n\n```python\nimport contextlib\nwith contextlib.suppress(ImportError):\n    from ews_core_config.config import read_settings\n    read_settings()\nmy_password = os.getenv(\"EWS_SHAREPOINT_USERNAME\", \"\")\n```\n\nThis will read your config file and set all the environment variables.\n\nFor instance, other libraries (like the one used to retrieve files on our SharePoint) will have access to the env. variable `EWS_SHAREPOINT_USERNAME` and `EWS_SHAREPOINT_PASSWORD`.\n\nAlternatively, you can directly retrieve the `settings` from the module.\n\n```python\nfrom ews_core_config.config import read_settings\nEWSSettings = read_settings()\nusername = EWSSettings.sharepoint_username\nassert username != \"\", \"Please set your SharePoint user name!\"\n```\n\n**This is not the preferred way**. Indeed, it might be easier to refractor\nlibraries to make them independent of our library if they just use environment variables.\n\n## Installation with pipx\n\n```bash\npipx install .[cli] --editable --force\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 EWS Consulting  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A simple TOML configuration for EWS settings",
    "version": "20240416",
    "project_urls": {
        "Documentation": "https://mb.ews.tools/ews-core-config",
        "Homepage": "https://github.com/EWS-Consulting-Private/ews-core-config",
        "Source": "https://github.com/EWS-Consulting-Private/ews-core-config"
    },
    "split_keywords": [
        "configuration",
        " settings",
        " ews"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab332f021031c6adc3bf841a3ee5e2d4d413576271733b19bde22b32c84d8d42",
                "md5": "ece8ab5130b165ce7573c82a4411a170",
                "sha256": "7823d1c690c9406dfb1c093a07700aa401164bc89386f3ab23449d518c4d3443"
            },
            "downloads": -1,
            "filename": "ews_core_config-20240416-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ece8ab5130b165ce7573c82a4411a170",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9339,
            "upload_time": "2024-04-16T09:52:03",
            "upload_time_iso_8601": "2024-04-16T09:52:03.692756Z",
            "url": "https://files.pythonhosted.org/packages/ab/33/2f021031c6adc3bf841a3ee5e2d4d413576271733b19bde22b32c84d8d42/ews_core_config-20240416-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9d15d65b3de723494d7310fc72ec08a727453fc320e9905ac70caa26347eb0c0",
                "md5": "7892d7c87349bd67f5b2f678b4cd7745",
                "sha256": "9b1e57e5e0788a9e9c2081332c5b29155ce552ed910ae50387fa3a469aa8fb32"
            },
            "downloads": -1,
            "filename": "ews_core_config-20240416.tar.gz",
            "has_sig": false,
            "md5_digest": "7892d7c87349bd67f5b2f678b4cd7745",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 11116,
            "upload_time": "2024-04-16T09:52:04",
            "upload_time_iso_8601": "2024-04-16T09:52:04.693310Z",
            "url": "https://files.pythonhosted.org/packages/9d/15/d65b3de723494d7310fc72ec08a727453fc320e9905ac70caa26347eb0c0/ews_core_config-20240416.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-16 09:52:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "EWS-Consulting-Private",
    "github_project": "ews-core-config",
    "github_not_found": true,
    "lcname": "ews-core-config"
}
        
Elapsed time: 0.22787s