Skip to content

Commit

Permalink
Rename module due to pypi name conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
CITGuru committed Jun 15, 2018
1 parent fc52f83 commit 6af5915
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ current_version = 1.0.0

[bumpversion:file:setup.py]

[bumpversion:file:pyconfig/__init__.py]
[bumpversion:file:pyconfigstore/__init__.py]

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ A Python module for handling config files. It helps handles persist config files

> Easily load and persist config without having to think about where and how
It's built base on nodejs [configstore](https:#github.com/yeoman/configstore)
It's built base on nodejs [configstore](https://github.com/yeoman/configstore)

Config is stored in a JSON file located in `$XDG_CONFIG_HOME` or `~/.localconfig`.<br>
Example: `~/.localconfig/configstore/name.json`

## Installation

```bash
pip install pyconfig
pip install pyconfigstore
```

## Usage

```python
from pyconfig import ConfigStore
from pyconfigstore import ConfigStore

# create a Configstore instance with a unique name e.g. gnit
# Package name and optionally some default values
Expand Down
57 changes: 37 additions & 20 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,57 +12,59 @@ Example: `~/.localconfig/configstore/name.json`
## Installation

```bash
pip install pyconfig
pip install pyconfigstore
```

## Usage

```python
from pyconfig import ConfigStore
from pyconfigstore import ConfigStore

// create a Configstore instance with a unique name e.g. gnit
// Package name and optionally some default values
# create a Configstore instance with a unique name e.g. gnit
# Package name and optionally some default values
conf = ConfigStore("Gnit", {"foo": 'bar'});

print(conf.get('foo'));
//>>> 'bar'
#>>> 'bar'

conf.set('awesome', True);
print(conf.get('awesome'));
//>>> True
#>>> True

// Use dot-notation to set nested properties
# Use dot-notation to set nested properties
conf.set('bar.baz', True);
print(conf.get('bar'));
//>>> {"baz": True}
#>>> {"baz": True}

# escape dot-notation to set nested properties
conf.set('bar.baz\\.bag', True);
print(conf.get('bar'));
#>>> {"baz.bag": True}

conf.delete('awesome');
print(conf.get('awesome'));
//>>>
#>>>
```


## API

### Configstore(packageName, [defaults], [options])
### Configstore(packageName, [defaults], globalConfigPath)

Returns a new instance.

#### packageName

Type: `string`
Type: `str`

Name of your package.

#### defaults

Type: `Object`
Type: `dicts`

Default config.

#### options

##### globalConfigPath
#### globalConfigPath

Type: `bool`<br>
Default: `False`
Expand All @@ -77,7 +79,7 @@ You can use dot-notation to set, get, update and delete nested dict properties

Set an item.

### .set(object)
### .set(dict)

Set multiple items at once.

Expand All @@ -97,9 +99,9 @@ Delete an item.

Delete all items.

### .all
### .all()

Get all the config as an object or replace the current config with an object:
Get all the config as a dict or replace the current config with an object:

```python
conf.all({
Expand All @@ -115,8 +117,23 @@ Get the item count.

Get the path to the config file. Can be used to show the user where the config file is located or even better open it for them.

## Contribute

Yes, you can contribute. Just dm on twitter:[@OyetokeT](http://twitter.com/@OyetokeT)

## TODO

There are couple of things I still need to add

1. Dot-notation: Currently, you can only set configs using this feature. (get, delete)

2. Stream: I planned to add a param that'll indicate that you want it to hit the file for every operation. Well that's how it works currently though. But to make it smarter, we don't need to hit the file for (size, get, has, all) operation. We are going to call the `.all()` once to get the configs in dicts and do the operation just using dict properties.

and more...

## License
Copyright - 2018
Oyetoke Toby <twitter:@OyetokeT>

Oyetoke Toby twitter:[@OyetokeT](http://twitter.com/@OyetokeT)

MIT LICENSE
2 changes: 1 addition & 1 deletion example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pyconfig import ConfigStore
from pyconfigstore import ConfigStore

conf = ConfigStore("vestub", {"url":"http://vestub.com"}, True)
print(conf.get("url"))
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def read(filename):
long_description = read('README.md')

setup(
name='pyconfig',
name='pyconfigstore',
version='1.0.0',
description=(
'A Python module for handling config files. It helps handles persist config files and also giving the ability to set, get, update and delete config settings'
Expand Down

0 comments on commit 6af5915

Please sign in to comment.