{ "info": { "author": "Barry Scott", "author_email": "barry@barrys-emacs.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# config-path\nPython library to work out witch path to use for configuration folders\nand files in an operating system independent way.\n\nEach operating system has particular conventions for where an application is expected\nto stores it configuration. The information provided to ConfigPath is used\nto figure out an appropiate file path or folder path for the application's\nconfiguration data.\n\nSupports Windows, macOS and most unix systems using the 'XDG Base Directory Specification'.\n\n~~~~\nConfigPath( vendor, appname, filetype )\n~~~~\n\nThe `vendor` should be the domain name of the application provider.\nThe `appname` is the name the application is know by.\nThe `filetype` is the use as the suffix for a config file.\nTypical filetypes are .json, .ini, .xml, etc.\n\nFor example the widget application from example.com that uses a JSON\nconfiguration file:\n\n~~~~\nfrom config_path import ConfigPath\nconf_path = ConfigPath( 'example.com', 'widget', '.json' )\n~~~~\n\n## single configuration file\n\n~~~~\npath = conf_path.saveFilePath( mkdir=False )\n~~~~\n\n`saveFilePath` returns the path where the configuation file should be written to.\n\nWhen `mkdir` is True the parent directory of the path will be created if it does not exist.\n\nNote: the path returned from `saveFilePath()` can be different from the\npath returned by `readFilePath()`.\n\n~~~~\npath = conf_path.readFilePath()\nif path is not None:\n # path exists and config can be read\n~~~~\n\n`readFilePath` returns the path to an existing configuration file, otherwise None\nis returned. Typcially an application will use its default configuration if there\nis no existing configuration file.\n\nNote: the path returned from `readFilePath()` can be different from the\npath returned by `saveFilePath()`.\n\nFor example readFilePath may return a system wide default config until the appliaction\nsaves a users specific configuration file.\n\n## multiple configuration files\n\n~~~~\npath = conf_path.saveFolderPath( mkdir=False )\n~~~~\n\n`saveFolderPath` returns the path to the folder that the application should\nsave its configuration files into. The naming of the file is left to the application logic.\n\nThe path is a `pathlib.Path()` object for python 3 and a string for python 2\n\nWhen `mkdir` is True the parent directory of the path will be created\nif it does not exist.\n\nNote: the path returned from `saveFolderPath()` can be different from the\npath returned by `readFolderPath()`.\n\n~~~~\npath = conf_path.readFolderPath( mkdir=False )\n~~~~\n\n`readFolderPath` returns the path to the folder that the application should use\nto read its configuration files.\n\nThe path is a `pathlib.Path()` object for python 3 and a string for python 2\n\nWhen `mkdir` is True the parent directory of the path will be created\nif it does not exist.\n\nNote: the path returned from `readFolderPath()` can be different from the\npath returned by `saveFolderPath()`.\n\n## macOS conventions\n\nOn macOS configuration files are called preferences. They are expected to be stored in the\n~/Library/Preferences folder using a file name that uses a reversed domain name.\n\nFor a file that will be `{reversed-vendor}.{appname}{filetype}` using the above example:\n`com.example.widget.json`.\n\nWhen a folder is required the folder will be `{reversed-vendor}.{appname}`.\nFor example: `com.example.widget`.\n\n## windows conventions\n\nOn Windows configuration files are stored in a folder that is return from a WIN32 API call.\nExactly which folder is used has changed over time between Windows versions and maybe\nlanguage dependent.\n\nconfig_path uses the convention of combining the `appname` and `vendor` to create a\npath that is expected to be unique.\n\nFor a file that will be `{reversed-vendor}.{appname}{filetype}` using the above example:\n`com.example.widget.json`.\n\nWhen a folder is required the folder will be `{reversed-vendor}.{appname}`.\nFor example: `com.example.widget`.\n\n## all others conventions\n\nFor all systems that are not macOS or Windows config-path follows\nthe 'XDG Base Directory Specification' for configuration data.\n\nXDG allows for system configuration and user configuration files.\nThe default user configuration folder is `~/.config`.\nThe default system configuration folder is `/etc/xdg`.\n\nFor a file that will be `{reversed-vendor}.{appname}{filetype}` using the above example:\n`com.example.widget.json`.\n\nWhen a folder is required the folder will be `{reversed-vendor}.{appname}`.\nFor example: `com.example.widget`.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/barry-scott/config-path", "keywords": "development", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "config-path", "package_url": "https://pypi.org/project/config-path/", "platform": "", "project_url": "https://pypi.org/project/config-path/", "project_urls": { "Homepage": "https://github.com/barry-scott/config-path" }, "release_url": "https://pypi.org/project/config-path/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "config-path is a library to work with paths to config folders and files in an OS independent way", "version": "1.0.0" }, "last_serial": 5900070, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "c54773bce8eab63b530a238016ae010d", "sha256": "153a5e61159a7504ca975576a02e4bf825eeb23fd348a180ccd7ddde184db1d6" }, "downloads": -1, "filename": "config_path-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c54773bce8eab63b530a238016ae010d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8782, "upload_time": "2019-09-28T16:55:50", "url": "https://files.pythonhosted.org/packages/79/57/a007c76057a65c5767c99932a050d55f1ccf4b9e9c7b57489fdae2fa85e0/config_path-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50dc5140723d4a9635647c347f0f9193", "sha256": "f0ac63c4ab79ee4c34725ee9a592d2dd098bfa7cd15e412d5e7d2fd1fca2b23e" }, "downloads": -1, "filename": "config-path-1.0.0.tar.gz", "has_sig": false, "md5_digest": "50dc5140723d4a9635647c347f0f9193", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4638, "upload_time": "2019-09-28T16:55:52", "url": "https://files.pythonhosted.org/packages/83/8f/cc375981438b4b362fcd286d9ddbbd7eb4a3c78fa6e04d87076d0376c8be/config-path-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c54773bce8eab63b530a238016ae010d", "sha256": "153a5e61159a7504ca975576a02e4bf825eeb23fd348a180ccd7ddde184db1d6" }, "downloads": -1, "filename": "config_path-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "c54773bce8eab63b530a238016ae010d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8782, "upload_time": "2019-09-28T16:55:50", "url": "https://files.pythonhosted.org/packages/79/57/a007c76057a65c5767c99932a050d55f1ccf4b9e9c7b57489fdae2fa85e0/config_path-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50dc5140723d4a9635647c347f0f9193", "sha256": "f0ac63c4ab79ee4c34725ee9a592d2dd098bfa7cd15e412d5e7d2fd1fca2b23e" }, "downloads": -1, "filename": "config-path-1.0.0.tar.gz", "has_sig": false, "md5_digest": "50dc5140723d4a9635647c347f0f9193", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4638, "upload_time": "2019-09-28T16:55:52", "url": "https://files.pythonhosted.org/packages/83/8f/cc375981438b4b362fcd286d9ddbbd7eb4a3c78fa6e04d87076d0376c8be/config-path-1.0.0.tar.gz" } ] }