{ "info": { "author": "Mike Durso", "author_email": "rbprogrammer@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Operating System :: MacOS", "Operating System :: POSIX", "Operating System :: POSIX :: Linux", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Utilities" ], "description": "# xdg-env-py\n\n`xdgenvpy` is yet another Python utility for the \n[XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).\n\n## How to use\n\n### Python\n\nThere are three main ways to use xdgenvpy as a Python package,\n\n1. Retrieve XDG environment variables, or the specification defaults.\n1. Determine _package_ specific directories based on the XDG spec.\n1. Or pedantically create _package_ specific directories before attempting to\n use the directory.\n\nTo use xdgenvpy as a simple XDG base directory getter, simply create a new \n`xdgenvpy.XDG` object and use the properties it exposes.\n\n```python\nfrom xdgenvpy import XDG\nxdg = XDG()\nprint(xdg.XDG_DATA_HOME) # /home/user/.local/share\nprint(xdg.XDG_CONFIG_HOME) # /home/user/.config\nprint(xdg.XDG_CACHE_HOME) # /home/user/.cache\nprint(xdg.XDG_RUNTIME_DIR) # /run/user/1000\nprint(xdg.XDG_DATA_DIRS) # /home/user/.local/share:/usr/local/share/:/usr/share/\nprint(xdg.XDG_CONFIG_DIRS) # /home/user/.config:/etc/xdg\n```\n\nBut sometimes you want to use package specific directories derived from the XDG\nbase directories. This can be done with the `xdgenvpy.XDGPackage` class.\n\n```python\nfrom xdgenvpy import XDGPackage\nxdg = XDGPackage('mypackage') \nprint(xdg.XDG_DATA_HOME) # /home/user/.local/share/mypackage\nprint(xdg.XDG_CONFIG_HOME) # /home/user/.config/mypackage\nprint(xdg.XDG_CACHE_HOME) # /home/user/.cache/mypackage\nprint(xdg.XDG_RUNTIME_DIR) # /run/user/1000/mypackage\nprint(xdg.XDG_DATA_DIRS) # /home/user/.local/share/mypackage:/usr/local/share/:/usr/share/\nprint(xdg.XDG_CONFIG_DIRS) # /home/user/.config/mypackage:/etc/xdg')\n```\n\nLastly, you could also use `xdgenvpy.XDGPedanticPackage` to ensure each of the \npackage specific directories exist before the calling code attempts to use the\ndirectory. Instances of the `xdgenvpy.XDGPedanticPackage` class will not create\nsystem level directories, only package directories on the DATA, CONFIG, CACHE, \nand RUNTIME variables.\n\n```python\nfrom xdgenvpy import XDGPedanticPackage\nxdg = XDGPedanticPackage('mypackage')\nprint(xdg.XDG_DATA_HOME) # /home/user/.local/share/mypackage\nprint(xdg.XDG_CONFIG_HOME) # /home/user/.config/mypackage\nprint(xdg.XDG_CACHE_HOME) # /home/user/.cache/mypackage\nprint(xdg.XDG_RUNTIME_DIR) # /run/user/1000/mypackage\nprint(xdg.XDG_DATA_DIRS) # /home/user/.local/share/mypackage:/usr/local/share/:/usr/share/\nprint(xdg.XDG_CONFIG_DIRS) # /home/user/.config/mypackage:/etc/xdg\n```\n\n### CLI\n\nxdgenvpy also includes a runnable module, which is easily accessible via the \nscript `xdg-env`. Pip will normally install scripts under something like:\n`~/.local/bin`\n\nThe installed `xdg-env` command essentially takes a list of XDG variables, and\nan optional package name. For each XDG variable specified, `xdg-env` will\nprint its corresponding value based on the specification. It can optionally\ntake the name of a package and include that into the variable's values.\n\nBut can't we just `echo` the XDG variables like so?\n\n```bash\necho ${XDG_DATA_HOME}\necho ${XDG_CONFIG_HOME}\necho ${XDG_CACHE_HOME}\necho ${XDG_RUNTIME_DIR}\necho ${XDG_DATA_DIRS}\necho ${XDG_CONFIG_DIRS}\n```\n\nWell, yes. But there is a problem when the variables are not defined. The \n`xdg-env` command will *always* print a value. If the environment variable does\nnot exist, then the default value will be returned, as defined by the XDG Base\nDirectory specification.\n\nAlthough the Python package supports a _pedantic_ mode, the `xdg-env` command \nwill not change the file system. Even if a package name is supplied and the \ndirectories do not exist, `xdg-env` will not create any files/directories.\n\n## How to install\n\nInstall locally as a normal user:\n```bash\npip3 install --user xdgenvpy\n```\n\nOr install globally as the all powerful root:\n```bash\nsudo pip3 install xdgenvpy\n```\n\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://gitlab.com/rbprogrammer/xdgenvpy", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "xdgenvpy", "package_url": "https://pypi.org/project/xdgenvpy/", "platform": "", "project_url": "https://pypi.org/project/xdgenvpy/", "project_urls": { "Homepage": "https://gitlab.com/rbprogrammer/xdgenvpy" }, "release_url": "https://pypi.org/project/xdgenvpy/1.0.3/", "requires_dist": null, "requires_python": "", "summary": "Another XDG Base Directory Specification utility.", "version": "1.0.3" }, "last_serial": 5508328, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "1791e129a6ada7cf11a9d36fbf5259b0", "sha256": "cb3a513843fa6c285a3cdb565359efb9cf31898c3f867cb7df6e2c96d262037d" }, "downloads": -1, "filename": "xdgenvpy-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "1791e129a6ada7cf11a9d36fbf5259b0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20119, "upload_time": "2019-07-09T09:16:51", "url": "https://files.pythonhosted.org/packages/f4/5c/29b7778bbf74f6ffaf2a3ca7eb30cacdbfe99f5bb61bb3f999ef65c3bea4/xdgenvpy-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "27118e1d60c5ad894412292581835c0d", "sha256": "94ba5b541969601f25c9083be68d29f854a7346f235a22f0f65851be900b3d38" }, "downloads": -1, "filename": "xdgenvpy-1.0.0.tar.gz", "has_sig": false, "md5_digest": "27118e1d60c5ad894412292581835c0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8965, "upload_time": "2019-07-09T09:16:53", "url": "https://files.pythonhosted.org/packages/c1/8a/31fcc2b20f2aa0ad1d580deae7a4cae00fa1df742278d067f13a6de0185f/xdgenvpy-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "85d4589e86c13db892617119497eb2da", "sha256": "c6e74feec1de0af34d06654f034f01b4eac752073d4b05c26a1802c2eb6dc474" }, "downloads": -1, "filename": "xdgenvpy-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "85d4589e86c13db892617119497eb2da", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20119, "upload_time": "2019-07-09T09:35:25", "url": "https://files.pythonhosted.org/packages/b2/01/e8475d6d51395d909608b2f1694e9a80aead48e61e61636262ec1e158f62/xdgenvpy-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a63b171fbac14cf1203051af764378f9", "sha256": "81d187ed3b978e2906b3c2b1b33ebe6164cd568403ec7dd7ab0944c8cb1c4f04" }, "downloads": -1, "filename": "xdgenvpy-1.0.1.tar.gz", "has_sig": false, "md5_digest": "a63b171fbac14cf1203051af764378f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8953, "upload_time": "2019-07-09T09:35:27", "url": "https://files.pythonhosted.org/packages/6b/a0/a0d1fcb5dd5fc3e95ba9fd7e6e963a6e348f42d30b1459c7ad4d5b7ba90e/xdgenvpy-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "50c5d8c28694906b8cfdebdb8fea6554", "sha256": "5cc6a5a53da53a2d65c343ffa1485904d660c2bc7617bebcf0519e3f0d70222c" }, "downloads": -1, "filename": "xdgenvpy-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "50c5d8c28694906b8cfdebdb8fea6554", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20122, "upload_time": "2019-07-09T17:47:46", "url": "https://files.pythonhosted.org/packages/21/d2/8c30e0b905138353c092b770678b64529d4a326adac3a8e7e4051e669c7c/xdgenvpy-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "746642a6774a319b4f71c82663d1d7f8", "sha256": "26324292cab4f29c5916f7753d05996458fb8d62e184b9f30d9c0912a1ba9157" }, "downloads": -1, "filename": "xdgenvpy-1.0.2.tar.gz", "has_sig": false, "md5_digest": "746642a6774a319b4f71c82663d1d7f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8956, "upload_time": "2019-07-09T17:47:48", "url": "https://files.pythonhosted.org/packages/7b/92/aeb936353c953f2ef6131535ce766167dbe35e845f67c443d51bc4b438db/xdgenvpy-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "a1528e8b066fdb452302ae87a1ac3618", "sha256": "fe66daeb59a97fc55fd05e403a20aa4b8d19df979673e2c9e3fae9844b6e8f0b" }, "downloads": -1, "filename": "xdgenvpy-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "a1528e8b066fdb452302ae87a1ac3618", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20112, "upload_time": "2019-07-09T18:03:40", "url": "https://files.pythonhosted.org/packages/d8/65/133847750d5b6031b4d258718ab78055290e800b2b9039271bd4a83d1d8f/xdgenvpy-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "148bf98e23d3f4f7c70be9dffdd840ba", "sha256": "ada486f583fb7cf00f14713dc804be3f0aa659435db292025d7308b893c34d15" }, "downloads": -1, "filename": "xdgenvpy-1.0.3.tar.gz", "has_sig": false, "md5_digest": "148bf98e23d3f4f7c70be9dffdd840ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8958, "upload_time": "2019-07-09T18:03:42", "url": "https://files.pythonhosted.org/packages/1b/9e/003662e8b40c3a0e3e632f44c58bdf13e5934031fc5abbe5d5f437b7613e/xdgenvpy-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a1528e8b066fdb452302ae87a1ac3618", "sha256": "fe66daeb59a97fc55fd05e403a20aa4b8d19df979673e2c9e3fae9844b6e8f0b" }, "downloads": -1, "filename": "xdgenvpy-1.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "a1528e8b066fdb452302ae87a1ac3618", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 20112, "upload_time": "2019-07-09T18:03:40", "url": "https://files.pythonhosted.org/packages/d8/65/133847750d5b6031b4d258718ab78055290e800b2b9039271bd4a83d1d8f/xdgenvpy-1.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "148bf98e23d3f4f7c70be9dffdd840ba", "sha256": "ada486f583fb7cf00f14713dc804be3f0aa659435db292025d7308b893c34d15" }, "downloads": -1, "filename": "xdgenvpy-1.0.3.tar.gz", "has_sig": false, "md5_digest": "148bf98e23d3f4f7c70be9dffdd840ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8958, "upload_time": "2019-07-09T18:03:42", "url": "https://files.pythonhosted.org/packages/1b/9e/003662e8b40c3a0e3e632f44c58bdf13e5934031fc5abbe5d5f437b7613e/xdgenvpy-1.0.3.tar.gz" } ] }