A platform independent API for paths in which applications can write data.
Project description
[](https://coveralls.io/github/dwavesystems/homebase?branch=master)
[](https://travis-ci.org/dwavesystems/homebase)
[](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)
[](https://travis-ci.org/dwavesystems/homebase)
[](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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
homebase-1.0.1.tar.gz
(11.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file homebase-1.0.1.tar.gz.
File metadata
- Download URL: homebase-1.0.1.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ee008df4298b420852d815e6df488822229c4bd8d571bcd0a454e04232c635e
|
|
| MD5 |
8e8f8913aecb93ee4e12ccc180fae6d2
|
|
| BLAKE2b-256 |
a5fa55afcae0026285dc51792e5959b3667a246fd5cb82e97211f2267d52b3ac
|
File details
Details for the file homebase-1.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: homebase-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d64c97f60a8ddd94ce8702bac65ed5d1996aca01a17d1e53e6ad5149e2f8b5b5
|
|
| MD5 |
7fb400940c089564c1c6e88ab32575a8
|
|
| BLAKE2b-256 |
50ade0080c35bd177682d5118a95bc2e7c1ac0541394b4ffce5e9554b6a077f9
|