{"id":15837716,"url":"https://github.com/muhammad-fiaz/dotsetup","last_synced_at":"2025-09-20T08:32:43.192Z","repository":{"id":210072382,"uuid":"725596045","full_name":"muhammad-fiaz/dotsetup","owner":"muhammad-fiaz","description":"DotSetup is a versatile Python package designed for streamlined management of multiple configurations. It simplifies the storage and retrieval of settings from .env and .json files, offering a seamless solution for your project's setup needs.","archived":false,"fork":false,"pushed_at":"2023-12-01T12:04:03.000Z","size":36,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T11:44:02.407Z","etag":null,"topics":["config","configuration","configuration-files","configuration-management","dot-en","dotenv","dotsetup","dotsetups","env","environment-variables","ini","ini-parser","json","open-source","opensource","project-setup","settings","settings-management","setup","setuptools"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/dotsetup/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muhammad-fiaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":["muhammad-fiaz"],"patreon":"muhammad_fiaz","ko_fi":"muhammadfiaz","open_collective":"muhammadfiaz"}},"created_at":"2023-11-30T13:31:02.000Z","updated_at":"2024-04-27T17:40:41.000Z","dependencies_parsed_at":"2023-12-10T20:48:52.724Z","dependency_job_id":null,"html_url":"https://github.com/muhammad-fiaz/dotsetup","commit_stats":{"total_commits":26,"total_committers":3,"mean_commits":8.666666666666666,"dds":0.1923076923076923,"last_synced_commit":"8a597c9639c15d8df03a4cc9d70f485f3d234f64"},"previous_names":["muhammad-fiaz/dotsetup"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fdotsetup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fdotsetup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fdotsetup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fdotsetup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muhammad-fiaz","download_url":"https://codeload.github.com/muhammad-fiaz/dotsetup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233648519,"owners_count":18708222,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","configuration","configuration-files","configuration-management","dot-en","dotenv","dotsetup","dotsetups","env","environment-variables","ini","ini-parser","json","open-source","opensource","project-setup","settings","settings-management","setup","setuptools"],"created_at":"2024-10-05T15:41:34.490Z","updated_at":"2025-09-20T08:32:37.883Z","avatar_url":"https://github.com/muhammad-fiaz.png","language":"Python","funding_links":["https://github.com/sponsors/muhammad-fiaz","https://patreon.com/muhammad_fiaz","https://ko-fi.com/muhammadfiaz","https://opencollective.com/muhammadfiaz","https://buymeacoffee.com/muhammadfiaz","https://patreon.com/muhammadfiaz"],"categories":[],"sub_categories":[],"readme":"# DotSetup\n[![PyPI Version](https://img.shields.io/pypi/v/dotsetup)](https://pypi.org/project/dotsetup/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/dotsetup)](https://pypi.org/project/dotsetup/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![Downloads](https://img.shields.io/pypi/dm/dotsetup)](https://pypi.org/project/dotsetup/)\n[![Last Commit](https://img.shields.io/github/last-commit/muhammad-fiaz/dotsetup)](https://github.com/muhammad-fiaz/dotsetup)\n[![GitHub Issues](https://img.shields.io/github/issues/muhammad-fiaz/dotsetup)](https://github.com/muhammad-fiaz/dotsetup/issues)\n[![GitHub Stars](https://img.shields.io/github/stars/muhammad-fiaz/dotsetup)](https://github.com/muhammad-fiaz/dotsetup/stargazers)\n[![GitHub Forks](https://img.shields.io/github/forks/muhammad-fiaz/dotsetup)](https://github.com/muhammad-fiaz/dotsetup/network)\n\n**DotSetup** is a Python package designed for flexible configuration management, supporting `.ini`, `.json`, `.env`, and custom file types. Simplify the storage and retrieval of settings in your projects effortlessly.\n\n## Table of Contents\n1. [DotSetup](#dotsetup)\n2. [Features](#features)\n3. [Installation](#installation)\n4. [Getting Started](#getting-started)\n    - [Simple Example](#simple-example)\n    - [Breaking down Example](#breaking-down-example)\n    - [Custom Path for File Types](#custom-path-for-file-types)\n    - [Nested Configurations](#nested-configurations)\n5. [Custom File Syntax](#custom-file-syntax)\n6. [Contributing](#contributing)\n7. [Code of Conduct](#code-of-conduct)\n8. [License](#license)\n9. [Support the Project](#support-the-project)\n\n\n## Features\n\n- **Multi-format Support:** Seamlessly handle configurations from files like `.ini`, `.json`, `.env`, and custom file types.\n- **Intuitive API:** Easy-to-use methods for 🔄 loading, accessing, and saving configurations.\n- **File Type Extension:** Customize DotSetup to support additional file types beyond the included formats.\n- **Nested Configurations:** Load nested configurations from files like `.ini` and `.json` files.\n- **Custom File Syntax:** Define your own syntax for custom file types.\n- **Custom File Path:** Load configurations from a custom path for different file types.\n- **Error Handling:** Handle errors that may occur when loading configurations.\n- **Lightweight:** DotSetup is a lightweight package with no external dependencies.\n- **Cross-Platform:** DotSetup is compatible with Windows, macOS, and Linux.\n- **Open-Source:** DotSetup is an open-source project licensed under the MIT License.\n\n\n## Installation\n\n```bash\npip install dotsetup\n```\n\n## Getting Started\nTo get started with DotSetup, follow these steps:\n\nImport the DotSetup class in your Python script or project to get started.\n\n## **Simple Example**:\n```python\nfrom dotsetup import DotSetup\n\n# Initialize DotSetup\nds = DotSetup()\n\n# Load from env file\nvalue_env = ds.load('version', file_type='env')\nprint(f\"Value from JSON File: {value_env}\")\n    \n```\nthe above example loads the value of the variable `version` from the `.env` file in the root folder of the project.\n\n## **Breaking down Example:**\n```python\nfrom dotsetup import DotSetup, DotSetupException, FileNotFoundError, VariableNotFoundError, JSONDecodeError\n\ndef main():\n    # Initialize DotSetup\n    ds = DotSetup()\n\n    try:\n        # Load from JSON file\n        value_json = ds.load('database', file_type='json')\n        print(f\"Value from JSON File: {value_json}\")\n    except (FileNotFoundError, VariableNotFoundError, JSONDecodeError) as e:\n        print(f\"Error: {e}\")\n\n    try:\n        # Load from ENV file with default path\n        value_env = ds.load('DATABASE_URL', file_type='env')\n        print(f\"Value from ENV (default path): {value_env}\")\n    except (FileNotFoundError, VariableNotFoundError) as e:\n        print(f\"Error: {e}\")\n\n    try:\n        # Load from custom file\n        value_custom = ds.load('num2', file_type='custom', file_path='config.con')\n        print(f\"Value from Custom File: {value_custom}\")\n    except (FileNotFoundError, VariableNotFoundError, JSONDecodeError) as e:\n        print(f\"Error: {e}\")\n\n    try:\n        # Load from INI file\n        value_ini = ds.load('section1.option1', file_type='ini')\n        print(f\"Value from INI File: {value_ini}\")\n    except (FileNotFoundError, VariableNotFoundError) as e:\n        print(f\"Error: {e}\")\n\nif __name__ == \"__main__\":\n    main()\n```\nhere you can also see how to handle errors that may occur when loading configurations.\n## Custom Path for File Types\nTo load configurations from a custom path for different file types:\n    \n```python  \nfrom dotsetup import DotSetup\nds = DotSetup()\n\n# Load configuration from the specified custom path\nvalue = ds.load('key_name', file_type='type', file_path='path/to/config.con')\n\n```\nThe default path for the env file is `.env` in the root folder. The default path for the ini file is `config.ini` in the root folder, and the default path for the json file is `config.json` in the root folder. For the custom file, the default path is `config.con` in the root folder. Alternatively, you can specify your own path using the file_path parameter\n\n## Nested Configurations\nyou can also load the nested configuration from the json and ini files by using the dot notation for example\n\n**json Example:**\n```json\n{\n  \"database\": {\n    \"host\": \"localhost\",\n    \"port\": 5432,\n    \"username\": \"user\",\n    \"password\": \"password\"\n  },\n  \"api_key\": \"your_api_key\"\n}\n\n```\n```python\nfrom dotsetup import DotSetup\nds = DotSetup()\n# Load value from nested JSON file\nvalue_json = ds.load('database.host', file_type='json', file_path='config.json')\nprint(f\"Value from JSON File: {value_json}\")\n```\n\n## Custom File Syntax\nDotSetup supports custom file types. To use a custom file type, you must define a custom file syntax. The custom file syntax is a dictionary that maps variable names to their values. \n\n```\nUSERNAME=\"johndoe\"\nPASSWORD=\"mysecretpassword\"\nAPI_KEY=\"abc123\"\nNUMBER=1\nNumbers={1,2,3,4,5}\nnum2=(1,2)\nnum3=[1,2,3]\nnum4=1.2\nstr=\"Hello World\"\nstr2=(\"Hello World\",\"Hello World\")\nstr3=[\"Hello World\",\"Hello World\"]\nLINKS=[\"https://www.google.com\",\"https://www.facebook.com\",\"https://www.twitter.com\"]\nLINKS2={\"KEY\":\"https://www.google.com\",\"KEY2\":\"https://www.facebook.com\"}\n```\nIn this example, variables and values are defined using the format key=value. You can define your own syntax for custom files with custom file extension(**filename.custom_extension**) based on your project's requirements. Make sure to follow this syntax when defining your custom file syntax.\n\n## Contributing\nContributions are welcome! Before contributing, please read our Contributing Guidelines to ensure a smooth and collaborative development process.\n\n## Code of Conduct\n\nPlease review our Code of Conduct to understand the standards of behavior we expect from contributors and users of this project.\n\n## License\nThis project is licensed under the [MIT License](). See [LICENSE](LICENSE) for more details.\n\n## Support the Project\n\u003cbr\u003e\n\u003cdiv align=\"center\"\u003e\n\n  \u003ch5\u003e \u003cstrong\u003e 💰 You can help me improve more by a little support \u003c/strong\u003e\u003c/h5\u003e\n  \n\n[![BuyMeACoffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge\u0026logo=buy-me-a-coffee\u0026logoColor=black)](https://buymeacoffee.com/muhammadfiaz) [![Patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge\u0026logo=patreon\u0026logoColor=white)](https://patreon.com/muhammadfiaz) [![Ko-Fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge\u0026logo=ko-fi\u0026logoColor=white)](https://ko-fi.com/muhammadfiaz)\n[![Sponsor muhammad-fiaz](https://img.shields.io/badge/Sponsor-%231EAEDB.svg?\u0026style=for-the-badge\u0026logo=GitHub-Sponsors\u0026logoColor=white)](https://github.com/sponsors/muhammad-fiaz)\n\u003c/div\u003e\n\n\n## Happy Coding ❤️\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fdotsetup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhammad-fiaz%2Fdotsetup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fdotsetup/lists"}