homebase


Namehomebase JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/dwavesystems/homebase
SummaryA platform independent API for paths in which applications can write data.
upload_time2018-07-30 22:48:52
maintainer
docs_urlNone
authorD-Wave Systems Inc.
requires_python
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements enum34
Travis-CI
coveralls test coverage No coveralls.
            [![Coverage Status](https://coveralls.io/repos/github/dwavesystems/homebase/badge.svg?branch=master)](https://coveralls.io/github/dwavesystems/homebase?branch=master)
[![Build Status](https://travis-ci.org/dwavesystems/homebase.svg?branch=master)](https://travis-ci.org/dwavesystems/homebase)
[![Documentation Status](https://readthedocs.org/projects/homebase/badge/?version=latest)](http://homebase.readthedocs.io/en/latest/?badge=latest)
# homebase


A place for your app to call home.

*homebase* provides a platform independent API for querying paths in which applications can write caches, data, configs, and
other information.


## rationale 

Since each operating system expects applications to write their data to OS dependant paths, managing cache writing
on portable applications can become difficult.

For example, on macOS:

    ~/Library/Application Support/app_name

while on Linux it may be:

    ~/.local/share/app_name

and on Windows:

    c:\users\<user_name>\AppData\Local/app_name

and the problem gets worse if you are running inside of a [virtualenv](https://virtualenv.pypa.io/en/stable/)

A similar issue happens for other forms of data, like caches, logs, configuration files, or application state.

## Installation

```bash
python setup.py install
```


## Usage

```python
import homebase

app_name = "my_app"
app_author = "nakatomi-corp"
user_data_dir = homebase.user_data_dir(app_name=app_name, app_author=app_author)
user_cache_dir = homebase.user_cache_dir(app_name=app_name, app_author=app_author)
user_logs_dir = homebase.user_logs_dir(app_name=app_name, app_author=app_author)
user_config_dir = homebase.user_config_dir(app_name=app_name, app_author=app_author)
user_state_dir = homebase.user_state_dir(app_name=app_name, app_author=app_author)

# site specific directories, e.g. /usr/share
site_data_dir = homebase.site_data_dir(app_name=app_name, app_author=app_author)
site_config_dir = homebase.site_config_dir(app_name=app_name, app_author=app_author)
```

If you are running inside of a virtualenv, *homebase* will return paths that are relative to that environment.
If you still want the user path, pass `use_virtualenv=False` in the call.

For example, suppose you have set up a virtual environment in `/home/username/env` on linux

```python
import homebase

app_name = "my_app"
app_author = "nakatomi-corp"
user_data_dir = homebase.user_data_dir(app_name=app_name, app_author=app_author)
# /home/username/env/data/my_app
user_data_dir = homebase.user_data_dir(app_name=app_name, app_author=app_author, use_virtualenv=False)
# /home/username/.local/share/my_app.
```

See the [documentation](# TODO) for more details and examples.

## License

See [LICENSE.txt](LICENSE.txt)


## Acknowledgement

This project is inspired by and is derived from [appdirs](https://github.com/ActiveState/appdirs)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dwavesystems/homebase",
    "name": "homebase",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "D-Wave Systems Inc.",
    "author_email": "oshklarsky@dwavesys.com",
    "download_url": "https://files.pythonhosted.org/packages/a5/fa/55afcae0026285dc51792e5959b3667a246fd5cb82e97211f2267d52b3ac/homebase-1.0.1.tar.gz",
    "platform": "",
    "description": "[![Coverage Status](https://coveralls.io/repos/github/dwavesystems/homebase/badge.svg?branch=master)](https://coveralls.io/github/dwavesystems/homebase?branch=master)\n[![Build Status](https://travis-ci.org/dwavesystems/homebase.svg?branch=master)](https://travis-ci.org/dwavesystems/homebase)\n[![Documentation Status](https://readthedocs.org/projects/homebase/badge/?version=latest)](http://homebase.readthedocs.io/en/latest/?badge=latest)\n# homebase\n\n\nA place for your app to call home.\n\n*homebase* provides a platform independent API for querying paths in which applications can write caches, data, configs, and\nother information.\n\n\n## rationale \n\nSince each operating system expects applications to write their data to OS dependant paths, managing cache writing\non portable applications can become difficult.\n\nFor example, on macOS:\n\n    ~/Library/Application Support/app_name\n\nwhile on Linux it may be:\n\n    ~/.local/share/app_name\n\nand on Windows:\n\n    c:\\users\\<user_name>\\AppData\\Local/app_name\n\nand the problem gets worse if you are running inside of a [virtualenv](https://virtualenv.pypa.io/en/stable/)\n\nA similar issue happens for other forms of data, like caches, logs, configuration files, or application state.\n\n## Installation\n\n```bash\npython setup.py install\n```\n\n\n## Usage\n\n```python\nimport homebase\n\napp_name = \"my_app\"\napp_author = \"nakatomi-corp\"\nuser_data_dir = homebase.user_data_dir(app_name=app_name, app_author=app_author)\nuser_cache_dir = homebase.user_cache_dir(app_name=app_name, app_author=app_author)\nuser_logs_dir = homebase.user_logs_dir(app_name=app_name, app_author=app_author)\nuser_config_dir = homebase.user_config_dir(app_name=app_name, app_author=app_author)\nuser_state_dir = homebase.user_state_dir(app_name=app_name, app_author=app_author)\n\n# site specific directories, e.g. /usr/share\nsite_data_dir = homebase.site_data_dir(app_name=app_name, app_author=app_author)\nsite_config_dir = homebase.site_config_dir(app_name=app_name, app_author=app_author)\n```\n\nIf you are running inside of a virtualenv, *homebase* will return paths that are relative to that environment.\nIf you still want the user path, pass `use_virtualenv=False` in the call.\n\nFor example, suppose you have set up a virtual environment in `/home/username/env` on linux\n\n```python\nimport homebase\n\napp_name = \"my_app\"\napp_author = \"nakatomi-corp\"\nuser_data_dir = homebase.user_data_dir(app_name=app_name, app_author=app_author)\n# /home/username/env/data/my_app\nuser_data_dir = homebase.user_data_dir(app_name=app_name, app_author=app_author, use_virtualenv=False)\n# /home/username/.local/share/my_app.\n```\n\nSee the [documentation](# TODO) for more details and examples.\n\n## License\n\nSee [LICENSE.txt](LICENSE.txt)\n\n\n## Acknowledgement\n\nThis project is inspired by and is derived from [appdirs](https://github.com/ActiveState/appdirs)\n\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "A platform independent API for paths in which applications can write data.",
    "version": "1.0.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "7fb400940c089564c1c6e88ab32575a8",
                "sha256": "d64c97f60a8ddd94ce8702bac65ed5d1996aca01a17d1e53e6ad5149e2f8b5b5"
            },
            "downloads": -1,
            "filename": "homebase-1.0.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7fb400940c089564c1c6e88ab32575a8",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 11307,
            "upload_time": "2018-07-30T22:48:51",
            "upload_time_iso_8601": "2018-07-30T22:48:51.551591Z",
            "url": "https://files.pythonhosted.org/packages/50/ad/e0080c35bd177682d5118a95bc2e7c1ac0541394b4ffce5e9554b6a077f9/homebase-1.0.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "8e8f8913aecb93ee4e12ccc180fae6d2",
                "sha256": "9ee008df4298b420852d815e6df488822229c4bd8d571bcd0a454e04232c635e"
            },
            "downloads": -1,
            "filename": "homebase-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8e8f8913aecb93ee4e12ccc180fae6d2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11848,
            "upload_time": "2018-07-30T22:48:52",
            "upload_time_iso_8601": "2018-07-30T22:48:52.764545Z",
            "url": "https://files.pythonhosted.org/packages/a5/fa/55afcae0026285dc51792e5959b3667a246fd5cb82e97211f2267d52b3ac/homebase-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2018-07-30 22:48:52",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "dwavesystems",
    "github_project": "homebase",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "enum34",
            "specs": [
                [
                    "<",
                    "2.0.0"
                ],
                [
                    ">=",
                    "1.1.6"
                ]
            ]
        }
    ],
    "lcname": "homebase"
}
        
Elapsed time: 0.02609s