xdg-base-dirs


Namexdg-base-dirs JSON
Version 6.0.1 PyPI version JSON
download
home_pagehttps://github.com/srstevenson/xdg-base-dirs
SummaryVariables defined by the XDG Base Directory Specification
upload_time2023-09-20 22:09:16
maintainer
docs_urlNone
authorScott Stevenson
requires_python>=3.10,<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-base-dirs

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

`xdg-base-dirs` is a Python module that 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.

:warning: _`xdg-base-dirs` was previously named `xdg`, and was renamed due to an
import collision with [`PyXDG`](https://pypi.org/project/pyxdg/). If you used
`xdg` prior to the rename, update by changing the dependency name from `xdg` to
`xdg-base-dirs` and the import from `xdg` to `xdg_base_dirs`._

## Installation

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

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

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

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

## Usage

```python
from xdg_base_dirs 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 an absolute path.

## Copyright

Copyright © [Scott Stevenson].

`xdg-base-dirs` is distributed under the terms of the [ISC license].

[isc license]: https://opensource.org/licenses/ISC
[path]: https://docs.python.org/3/library/pathlib.html#pathlib.Path
[pdm]: https://pdm.fming.dev/
[pip]: https://pip.pypa.io/en/stable/
[poetry]: https://python-poetry.org/
[pypi]: https://pypi.org/project/xdg-base-dirs/
[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-base-dirs",
    "name": "xdg-base-dirs",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "xdg,base,directory,specification",
    "author": "Scott Stevenson",
    "author_email": "scott@stevenson.io",
    "download_url": "https://files.pythonhosted.org/packages/98/58/bf6650c4eba25375f923703b645f8b245ecee75c722ded29189d8b515167/xdg_base_dirs-6.0.1.tar.gz",
    "platform": null,
    "description": "# xdg-base-dirs\n\n[![License](https://img.shields.io/github/license/srstevenson/xdg-base-dirs?label=License&color=blue)](https://github.com/srstevenson/xdg-base-dirs/blob/main/LICENSE)\n[![GitHub release](https://img.shields.io/github/v/release/srstevenson/xdg-base-dirs?label=GitHub)](https://github.com/srstevenson/xdg-base-dirs)\n[![PyPI version](https://img.shields.io/pypi/v/xdg-base-dirs?label=PyPI)](https://pypi.org/project/xdg-base-dirs/)\n[![Python versions](https://img.shields.io/pypi/pyversions/xdg-base-dirs?label=Python)](https://pypi.org/project/xdg-base-dirs/)\n[![CI status](https://github.com/srstevenson/xdg-base-dirs/workflows/CI/badge.svg)](https://github.com/srstevenson/xdg-base-dirs/actions)\n[![Coverage](https://img.shields.io/codecov/c/gh/srstevenson/xdg-base-dirs?label=Coverage)](https://app.codecov.io/gh/srstevenson/xdg-base-dirs)\n\n`xdg-base-dirs` is a Python module that provides functions to return paths to\nthe directories defined by the [XDG Base Directory Specification][spec], to save\nyou from 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:warning: _`xdg-base-dirs` was previously named `xdg`, and was renamed due to an\nimport collision with [`PyXDG`](https://pypi.org/project/pyxdg/). If you used\n`xdg` prior to the rename, update by changing the dependency name from `xdg` to\n`xdg-base-dirs` and the import from `xdg` to `xdg_base_dirs`._\n\n## Installation\n\nTo install the latest release from [PyPI], use [pip]:\n\n```bash\npython3 -m pip install xdg-base-dirs\n```\n\nThe latest release of `xdg-base-dirs` currently implements version 0.8 of the\nspecification, released on 8th May 2021.\n\nIn Python projects using [Poetry] or [PDM] for dependency management, add\n`xdg-base-dirs` as a dependency with `poetry add xdg-base-dirs` or\n`pdm add xdg-base-dirs`. Alternatively, since `xdg-base-dirs` is only a single\nfile you may prefer to just copy `src/xdg_base_dirs/__init__.py` from the source\ndistribution into your project.\n\n## Usage\n\n```python\nfrom xdg_base_dirs 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 an absolute path.\n\n## Copyright\n\nCopyright \u00a9 [Scott Stevenson].\n\n`xdg-base-dirs` is distributed under the terms of the [ISC license].\n\n[isc license]: https://opensource.org/licenses/ISC\n[path]: https://docs.python.org/3/library/pathlib.html#pathlib.Path\n[pdm]: https://pdm.fming.dev/\n[pip]: https://pip.pypa.io/en/stable/\n[poetry]: https://python-poetry.org/\n[pypi]: https://pypi.org/project/xdg-base-dirs/\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": "6.0.1",
    "project_urls": {
        "Homepage": "https://github.com/srstevenson/xdg-base-dirs",
        "Repository": "https://github.com/srstevenson/xdg-base-dirs"
    },
    "split_keywords": [
        "xdg",
        "base",
        "directory",
        "specification"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "94e08c5ae4c8fc31492de9db4c6013f28811c0ad3fbfad57b4220fe75a312243",
                "md5": "fbf019eeb3c27d2d5edc4142c78ceace",
                "sha256": "63f6ebc1721ced2e86c340856e004ef829501a30a37e17079c52cfaf0e1741b9"
            },
            "downloads": -1,
            "filename": "xdg_base_dirs-6.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fbf019eeb3c27d2d5edc4142c78ceace",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 5027,
            "upload_time": "2023-09-20T22:09:14",
            "upload_time_iso_8601": "2023-09-20T22:09:14.432087Z",
            "url": "https://files.pythonhosted.org/packages/94/e0/8c5ae4c8fc31492de9db4c6013f28811c0ad3fbfad57b4220fe75a312243/xdg_base_dirs-6.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9858bf6650c4eba25375f923703b645f8b245ecee75c722ded29189d8b515167",
                "md5": "e9b48a222ec378b54948708255b207c8",
                "sha256": "b4c8f4ba72d1286018b25eea374ec6fbf4fddda3d4137edf50de95de53e195a6"
            },
            "downloads": -1,
            "filename": "xdg_base_dirs-6.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e9b48a222ec378b54948708255b207c8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 4318,
            "upload_time": "2023-09-20T22:09:16",
            "upload_time_iso_8601": "2023-09-20T22:09:16.040889Z",
            "url": "https://files.pythonhosted.org/packages/98/58/bf6650c4eba25375f923703b645f8b245ecee75c722ded29189d8b515167/xdg_base_dirs-6.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-20 22:09:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "srstevenson",
    "github_project": "xdg-base-dirs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "xdg-base-dirs"
}
        
Elapsed time: 0.11659s