xdg


Namexdg JSON
Version 5.1.1 PyPI version JSON
download
home_pagehttps://github.com/srstevenson/xdg
SummaryVariables defined by the XDG Base Directory Specification
upload_time2021-07-24 16:51:12
maintainer
docs_urlNone
authorScott Stevenson
requires_python>=3.6,<4.0
licenseISC
keywords xdg base directory specification
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # xdg

[![Licence](https://img.shields.io/github/license/srstevenson/xdg?label=Licence&color=blue)](https://github.com/srstevenson/xdg/blob/main/LICENCE)
[![GitHub release](https://img.shields.io/github/v/release/srstevenson/xdg?label=GitHub)](https://github.com/srstevenson/xdg)
[![PyPI version](https://img.shields.io/pypi/v/xdg?label=PyPI)](https://pypi.org/project/xdg/)
[![Python versions](https://img.shields.io/pypi/pyversions/xdg?label=Python)](https://pypi.org/project/xdg/)
[![CI status](https://github.com/srstevenson/xdg/workflows/CI/badge.svg)](https://github.com/srstevenson/xdg/actions)
[![Coverage](https://img.shields.io/codecov/c/gh/srstevenson/xdg?label=Coverage)](https://codecov.io/gh/srstevenson/xdg)

`xdg` is a Python module which provides functions to return paths to the
directories defined by the [XDG Base Directory Specification][spec], to save you
from duplicating the same snippet of logic in every Python utility you write
that deals with user cache, configuration, or data files. It has no external
dependencies.

## Installation

To install the latest release from [PyPI], use [pip]:

```bash
python3 -m pip install xdg
```

The latest release of `xdg` currently implements version 0.8 of the
specification, released on 8th May 2021.

In Python projects using [Poetry] or [Pipenv] for dependency management, add
`xdg` as a dependency with `poetry add xdg` or `pipenv install xdg`.
Alternatively, since `xdg` is only a single file you may prefer to just copy
`src/xdg/__init__.py` from the source distribution into your project.

## Usage

```python
from xdg import (
    xdg_cache_home,
    xdg_config_dirs,
    xdg_config_home,
    xdg_data_dirs,
    xdg_data_home,
    xdg_runtime_dir,
    xdg_state_home,
)
```

`xdg_cache_home()`, `xdg_config_home()`, `xdg_data_home()`, and
`xdg_state_home()` return [`pathlib.Path` objects][path] containing the value of
the environment variable named `XDG_CACHE_HOME`, `XDG_CONFIG_HOME`,
`XDG_DATA_HOME`, and `XDG_STATE_HOME` respectively, or the default defined in
the specification if the environment variable is unset, empty, or contains a
relative path rather than absolute path.

`xdg_config_dirs()` and `xdg_data_dirs()` return a list of `pathlib.Path`
objects containing the value, split on colons, of the environment variable named
`XDG_CONFIG_DIRS` and `XDG_DATA_DIRS` respectively, or the default defined in
the specification if the environment variable is unset or empty. Relative paths
are ignored, as per the specification.

`xdg_runtime_dir()` returns a `pathlib.Path` object containing the value of the
`XDG_RUNTIME_DIR` environment variable, or `None` if the environment variable is
not set, or contains a relative path rather than absolute path.

## Copyright

Copyright © 2016-2021 [Scott Stevenson].

`xdg` is distributed under the terms of the [ISC licence].

[isc licence]: https://opensource.org/licenses/ISC
[path]: https://docs.python.org/3/library/pathlib.html#pathlib.Path
[pip]: https://pip.pypa.io/en/stable/
[pipenv]: https://docs.pipenv.org/
[poetry]: https://python-poetry.org/
[pypi]: https://pypi.org/project/xdg/
[scott stevenson]: https://scott.stevenson.io
[spec]:
  https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/srstevenson/xdg",
    "name": "xdg",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "xdg,base,directory,specification",
    "author": "Scott Stevenson",
    "author_email": "scott@stevenson.io",
    "download_url": "https://files.pythonhosted.org/packages/33/fe/67bc1f8ee2782bca3cdc63558a64f843bb9f88e15793475350809fbd8e01/xdg-5.1.1.tar.gz",
    "platform": "",
    "description": "# xdg\n\n[![Licence](https://img.shields.io/github/license/srstevenson/xdg?label=Licence&color=blue)](https://github.com/srstevenson/xdg/blob/main/LICENCE)\n[![GitHub release](https://img.shields.io/github/v/release/srstevenson/xdg?label=GitHub)](https://github.com/srstevenson/xdg)\n[![PyPI version](https://img.shields.io/pypi/v/xdg?label=PyPI)](https://pypi.org/project/xdg/)\n[![Python versions](https://img.shields.io/pypi/pyversions/xdg?label=Python)](https://pypi.org/project/xdg/)\n[![CI status](https://github.com/srstevenson/xdg/workflows/CI/badge.svg)](https://github.com/srstevenson/xdg/actions)\n[![Coverage](https://img.shields.io/codecov/c/gh/srstevenson/xdg?label=Coverage)](https://codecov.io/gh/srstevenson/xdg)\n\n`xdg` is a Python module which provides functions to return paths to the\ndirectories defined by the [XDG Base Directory Specification][spec], to save you\nfrom duplicating the same snippet of logic in every Python utility you write\nthat deals with user cache, configuration, or data files. It has no external\ndependencies.\n\n## Installation\n\nTo install the latest release from [PyPI], use [pip]:\n\n```bash\npython3 -m pip install xdg\n```\n\nThe latest release of `xdg` currently implements version 0.8 of the\nspecification, released on 8th May 2021.\n\nIn Python projects using [Poetry] or [Pipenv] for dependency management, add\n`xdg` as a dependency with `poetry add xdg` or `pipenv install xdg`.\nAlternatively, since `xdg` is only a single file you may prefer to just copy\n`src/xdg/__init__.py` from the source distribution into your project.\n\n## Usage\n\n```python\nfrom xdg import (\n    xdg_cache_home,\n    xdg_config_dirs,\n    xdg_config_home,\n    xdg_data_dirs,\n    xdg_data_home,\n    xdg_runtime_dir,\n    xdg_state_home,\n)\n```\n\n`xdg_cache_home()`, `xdg_config_home()`, `xdg_data_home()`, and\n`xdg_state_home()` return [`pathlib.Path` objects][path] containing the value of\nthe environment variable named `XDG_CACHE_HOME`, `XDG_CONFIG_HOME`,\n`XDG_DATA_HOME`, and `XDG_STATE_HOME` respectively, or the default defined in\nthe specification if the environment variable is unset, empty, or contains a\nrelative path rather than absolute path.\n\n`xdg_config_dirs()` and `xdg_data_dirs()` return a list of `pathlib.Path`\nobjects containing the value, split on colons, of the environment variable named\n`XDG_CONFIG_DIRS` and `XDG_DATA_DIRS` respectively, or the default defined in\nthe specification if the environment variable is unset or empty. Relative paths\nare ignored, as per the specification.\n\n`xdg_runtime_dir()` returns a `pathlib.Path` object containing the value of the\n`XDG_RUNTIME_DIR` environment variable, or `None` if the environment variable is\nnot set, or contains a relative path rather than absolute path.\n\n## Copyright\n\nCopyright \u00a9 2016-2021 [Scott Stevenson].\n\n`xdg` is distributed under the terms of the [ISC licence].\n\n[isc licence]: https://opensource.org/licenses/ISC\n[path]: https://docs.python.org/3/library/pathlib.html#pathlib.Path\n[pip]: https://pip.pypa.io/en/stable/\n[pipenv]: https://docs.pipenv.org/\n[poetry]: https://python-poetry.org/\n[pypi]: https://pypi.org/project/xdg/\n[scott stevenson]: https://scott.stevenson.io\n[spec]:\n  https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\n",
    "bugtrack_url": null,
    "license": "ISC",
    "summary": "Variables defined by the XDG Base Directory Specification",
    "version": "5.1.1",
    "split_keywords": [
        "xdg",
        "base",
        "directory",
        "specification"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "10d1e5704e5d7ceb6b70cbfa61c9aec1",
                "sha256": "865a7b56ed1d4cd2fce2ead1eddf97360843619757f473cd90b75f1817ca541d"
            },
            "downloads": -1,
            "filename": "xdg-5.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "10d1e5704e5d7ceb6b70cbfa61c9aec1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 4954,
            "upload_time": "2021-07-24T16:51:10",
            "upload_time_iso_8601": "2021-07-24T16:51:10.579635Z",
            "url": "https://files.pythonhosted.org/packages/ea/09/4a0f30aada49e142b94bbb232c023abcbc6ced7e2a9776533fb14977e9db/xdg-5.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "506c4f123a373ccf1a54e1ac328fd7b3",
                "sha256": "aa619f26ccec6088b2a6018721d4ee86e602099b24644a90a8d3308a25acd06c"
            },
            "downloads": -1,
            "filename": "xdg-5.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "506c4f123a373ccf1a54e1ac328fd7b3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 4658,
            "upload_time": "2021-07-24T16:51:12",
            "upload_time_iso_8601": "2021-07-24T16:51:12.272434Z",
            "url": "https://files.pythonhosted.org/packages/33/fe/67bc1f8ee2782bca3cdc63558a64f843bb9f88e15793475350809fbd8e01/xdg-5.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-07-24 16:51:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "srstevenson",
    "github_project": "xdg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "xdg"
}
        
Elapsed time: 0.01915s