scribble 1.0.0__tar.gz → 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
scribble-1.0.1/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2018 The Python Packaging Authority
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: scribble
3
+ Version: 1.0.1
4
+ Summary: Allows for persistent storage of dictionary data
5
+ Home-page: https://github.com/mikemalinowski/scribble
6
+ Author: Mike Malinowski
7
+ Author-email: mike@twisted.space
8
+ Keywords: scribble dictionary appdata persistent
9
+ Classifier: Programming Language :: Python
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: home-page
20
+ Dynamic: keywords
21
+ Dynamic: license-file
22
+ Dynamic: summary
23
+
24
+ # Overview
25
+ Scibble is a mechanism to store dictionary information to a persistent
26
+ state. This allows the data to be easily retrieved and edited, making it
27
+ a good option when trying to store settings data.
28
+
29
+ Note: Data saved within the ScribbleDictionary must be json serialisable.
30
+
31
+ An example of creating a persisten data block would be:
32
+ ```python
33
+ import os
34
+ import scribble
35
+
36
+
37
+ # -- Instance a scribble dictionary. We can treat this exactly
38
+ # -- as we treat a dictionary
39
+ data = scribble.get('foobar')
40
+
41
+ # -- Set some key/value pairs in the ScribbleDictionary
42
+ data['option_a'] = True
43
+ data['option_b'] = 123
44
+
45
+ # -- Calling .save() will trigger the dictionary
46
+ # -- to store its current state to a persistent state
47
+ data.save()
48
+
49
+ # -- We can see the location the data is saved to, and we can
50
+ # -- see that it does indeed exist
51
+ print(data.location())
52
+ print(os.path.exists(data.location()))
53
+ ```
54
+
55
+
56
+ Equally, we can re-retrieve that data in a completely new instance of python
57
+ using the following code:
58
+ ```python
59
+ # -- Instance a scribble dictionary with the same identifier
60
+ data = scribble.get('foobar')
61
+
62
+ # -- Print the fact that we have retrieved the same
63
+ # -- infromation
64
+ print(data)
65
+ # {'option_a': True, 'option_b': 123}
66
+
67
+ # -- We can then further edit the data
68
+ data['option_a'] = False
69
+
70
+ # -- Calling .save() will trigger the dictionary
71
+ # -- to store its current state to a persistent state
72
+ data.save()
73
+ ```
74
+ By default scribble will store its data in the follow platform specific
75
+ locations:
76
+
77
+ * Windows: %APPDATA%/pyscribble
78
+
79
+ * Linux: %XDG_CONFIG_HOME%/pyscribble if the environment variable exists, otherwise %HOME%/.config/pyscribble
80
+
81
+ * OSX: ËœHOME/Documents/pyscribble
82
+
83
+ However, you can override these paths by setting an environment variable
84
+ PYSCRIBBLE_STORAGE_DIR, if this is set then the path defined by that variable
85
+ will always be used over the default behaviour.
86
+
87
+ ## Compatability
88
+
89
+ This has been tested under Python 2.7.13 and Python 3.6.6 on both Ubuntu and Windows.
90
+
91
+ ## Contribute
92
+
93
+ If you would like to contribute thoughts, ideas, fixes or features please get in touch! mike@twisted.space
@@ -65,3 +65,4 @@ PYSCRIBBLE_STORAGE_DIR, if this is set then the path defined by that variable
65
65
  will always be used over the default behaviour.
66
66
  """
67
67
  from .core import get
68
+ from .core import STORAGE_DIRECTORY
@@ -15,44 +15,45 @@ STORAGE_DIRECTORY = os.environ.get(ENVIRONMENT_VARIABLE, None)
15
15
  # -- If we have not been provided with a specific storage location
16
16
  # -- then we need to resolve to a default location, but this is platform
17
17
  # -- dependent
18
- if sys.platform == 'linux' or sys.platform == 'linux2':
19
- if 'XDG_CONFIG_HOME' in os.environ:
18
+ if not STORAGE_DIRECTORY:
19
+ if sys.platform == 'linux' or sys.platform == 'linux2':
20
+ if 'XDG_CONFIG_HOME' in os.environ:
21
+ STORAGE_DIRECTORY = os.path.join(
22
+ os.environ['XDG_CONFIG_HOME'],
23
+ 'pyscribble',
24
+ )
25
+
26
+ else:
27
+ STORAGE_DIRECTORY = os.path.join(
28
+ os.environ['HOME'],
29
+ '.config',
30
+ 'pyscribble',
31
+ )
32
+
33
+ elif sys.platform == 'win32':
20
34
  STORAGE_DIRECTORY = os.path.join(
21
- os.environ['XDG_CONFIG_HOME'],
35
+ os.environ.get('APPDATA'),
22
36
  'pyscribble',
23
37
  )
24
38
 
25
- else:
39
+ elif sys.platform == 'darwin':
26
40
  STORAGE_DIRECTORY = os.path.join(
27
41
  os.environ['HOME'],
28
- '.config',
42
+ 'Documents',
29
43
  'pyscribble',
30
44
  )
31
45
 
32
- elif sys.platform == 'win32':
33
- STORAGE_DIRECTORY = os.path.join(
34
- os.environ.get('APPDATA'),
35
- 'pyscribble',
36
- )
37
-
38
- elif sys.platform == 'darwin':
39
- STORAGE_DIRECTORY = os.path.join(
40
- os.environ['HOME'],
41
- 'Documents',
42
- 'pyscribble',
43
- )
44
-
45
- else:
46
- raise Exception(
47
- (
48
- '%s is not supported by default. In order to utilise this module '
49
- 'you must define an environment variable (%s) specifying the '
50
- 'storage path'
51
- ) % (
52
- sys.platform,
53
- ENVIRONMENT_VARIABLE,
46
+ else:
47
+ raise Exception(
48
+ (
49
+ '%s is not supported by default. In order to utilise this module '
50
+ 'you must define an environment variable (%s) specifying the '
51
+ 'storage path'
52
+ ) % (
53
+ sys.platform,
54
+ ENVIRONMENT_VARIABLE,
55
+ )
54
56
  )
55
- )
56
57
 
57
58
 
58
59
  # ------------------------------------------------------------------------------
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: scribble
3
+ Version: 1.0.1
4
+ Summary: Allows for persistent storage of dictionary data
5
+ Home-page: https://github.com/mikemalinowski/scribble
6
+ Author: Mike Malinowski
7
+ Author-email: mike@twisted.space
8
+ Keywords: scribble dictionary appdata persistent
9
+ Classifier: Programming Language :: Python
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: author
15
+ Dynamic: author-email
16
+ Dynamic: classifier
17
+ Dynamic: description
18
+ Dynamic: description-content-type
19
+ Dynamic: home-page
20
+ Dynamic: keywords
21
+ Dynamic: license-file
22
+ Dynamic: summary
23
+
24
+ # Overview
25
+ Scibble is a mechanism to store dictionary information to a persistent
26
+ state. This allows the data to be easily retrieved and edited, making it
27
+ a good option when trying to store settings data.
28
+
29
+ Note: Data saved within the ScribbleDictionary must be json serialisable.
30
+
31
+ An example of creating a persisten data block would be:
32
+ ```python
33
+ import os
34
+ import scribble
35
+
36
+
37
+ # -- Instance a scribble dictionary. We can treat this exactly
38
+ # -- as we treat a dictionary
39
+ data = scribble.get('foobar')
40
+
41
+ # -- Set some key/value pairs in the ScribbleDictionary
42
+ data['option_a'] = True
43
+ data['option_b'] = 123
44
+
45
+ # -- Calling .save() will trigger the dictionary
46
+ # -- to store its current state to a persistent state
47
+ data.save()
48
+
49
+ # -- We can see the location the data is saved to, and we can
50
+ # -- see that it does indeed exist
51
+ print(data.location())
52
+ print(os.path.exists(data.location()))
53
+ ```
54
+
55
+
56
+ Equally, we can re-retrieve that data in a completely new instance of python
57
+ using the following code:
58
+ ```python
59
+ # -- Instance a scribble dictionary with the same identifier
60
+ data = scribble.get('foobar')
61
+
62
+ # -- Print the fact that we have retrieved the same
63
+ # -- infromation
64
+ print(data)
65
+ # {'option_a': True, 'option_b': 123}
66
+
67
+ # -- We can then further edit the data
68
+ data['option_a'] = False
69
+
70
+ # -- Calling .save() will trigger the dictionary
71
+ # -- to store its current state to a persistent state
72
+ data.save()
73
+ ```
74
+ By default scribble will store its data in the follow platform specific
75
+ locations:
76
+
77
+ * Windows: %APPDATA%/pyscribble
78
+
79
+ * Linux: %XDG_CONFIG_HOME%/pyscribble if the environment variable exists, otherwise %HOME%/.config/pyscribble
80
+
81
+ * OSX: ËœHOME/Documents/pyscribble
82
+
83
+ However, you can override these paths by setting an environment variable
84
+ PYSCRIBBLE_STORAGE_DIR, if this is set then the path defined by that variable
85
+ will always be used over the default behaviour.
86
+
87
+ ## Compatability
88
+
89
+ This has been tested under Python 2.7.13 and Python 3.6.6 on both Ubuntu and Windows.
90
+
91
+ ## Contribute
92
+
93
+ If you would like to contribute thoughts, ideas, fixes or features please get in touch! mike@twisted.space
@@ -1,3 +1,4 @@
1
+ LICENSE
1
2
  README.md
2
3
  setup.py
3
4
  scribble/__init__.py
@@ -5,7 +5,7 @@ with open('README.md', 'r') as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name='scribble',
8
- version='1.0.0',
8
+ version='1.0.1',
9
9
  author='Mike Malinowski',
10
10
  author_email='mike@twisted.space',
11
11
  description='Allows for persistent storage of dictionary data',
scribble-1.0.0/PKG-INFO DELETED
@@ -1,85 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: scribble
3
- Version: 1.0.0
4
- Summary: Allows for persistent storage of dictionary data
5
- Home-page: https://github.com/mikemalinowski/scribble
6
- Author: Mike Malinowski
7
- Author-email: mike@twisted.space
8
- License: UNKNOWN
9
- Description: # Overview
10
- Scibble is a mechanism to store dictionary information to a persistent
11
- state. This allows the data to be easily retrieved and edited, making it
12
- a good option when trying to store settings data.
13
-
14
- Note: Data saved within the ScribbleDictionary must be json serialisable.
15
-
16
- An example of creating a persisten data block would be:
17
- ```python
18
- import os
19
- import scribble
20
-
21
-
22
- # -- Instance a scribble dictionary. We can treat this exactly
23
- # -- as we treat a dictionary
24
- data = scribble.get('foobar')
25
-
26
- # -- Set some key/value pairs in the ScribbleDictionary
27
- data['option_a'] = True
28
- data['option_b'] = 123
29
-
30
- # -- Calling .save() will trigger the dictionary
31
- # -- to store its current state to a persistent state
32
- data.save()
33
-
34
- # -- We can see the location the data is saved to, and we can
35
- # -- see that it does indeed exist
36
- print(data.location())
37
- print(os.path.exists(data.location()))
38
- ```
39
-
40
-
41
- Equally, we can re-retrieve that data in a completely new instance of python
42
- using the following code:
43
- ```python
44
- # -- Instance a scribble dictionary with the same identifier
45
- data = scribble.get('foobar')
46
-
47
- # -- Print the fact that we have retrieved the same
48
- # -- infromation
49
- print(data)
50
- # {'option_a': True, 'option_b': 123}
51
-
52
- # -- We can then further edit the data
53
- data['option_a'] = False
54
-
55
- # -- Calling .save() will trigger the dictionary
56
- # -- to store its current state to a persistent state
57
- data.save()
58
- ```
59
- By default scribble will store its data in the follow platform specific
60
- locations:
61
-
62
- * Windows: %APPDATA%/pyscribble
63
-
64
- * Linux: %XDG_CONFIG_HOME%/pyscribble if the environment variable exists, otherwise %HOME%/.config/pyscribble
65
-
66
- * OSX: ËœHOME/Documents/pyscribble
67
-
68
- However, you can override these paths by setting an environment variable
69
- PYSCRIBBLE_STORAGE_DIR, if this is set then the path defined by that variable
70
- will always be used over the default behaviour.
71
-
72
- ## Compatability
73
-
74
- This has been tested under Python 2.7.13 and Python 3.6.6 on both Ubuntu and Windows.
75
-
76
- ## Contribute
77
-
78
- If you would like to contribute thoughts, ideas, fixes or features please get in touch! mike@twisted.space
79
-
80
- Keywords: scribble dictionary appdata persistent
81
- Platform: UNKNOWN
82
- Classifier: Programming Language :: Python
83
- Classifier: License :: OSI Approved :: MIT License
84
- Classifier: Operating System :: OS Independent
85
- Description-Content-Type: text/markdown
@@ -1,85 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: scribble
3
- Version: 1.0.0
4
- Summary: Allows for persistent storage of dictionary data
5
- Home-page: https://github.com/mikemalinowski/scribble
6
- Author: Mike Malinowski
7
- Author-email: mike@twisted.space
8
- License: UNKNOWN
9
- Description: # Overview
10
- Scibble is a mechanism to store dictionary information to a persistent
11
- state. This allows the data to be easily retrieved and edited, making it
12
- a good option when trying to store settings data.
13
-
14
- Note: Data saved within the ScribbleDictionary must be json serialisable.
15
-
16
- An example of creating a persisten data block would be:
17
- ```python
18
- import os
19
- import scribble
20
-
21
-
22
- # -- Instance a scribble dictionary. We can treat this exactly
23
- # -- as we treat a dictionary
24
- data = scribble.get('foobar')
25
-
26
- # -- Set some key/value pairs in the ScribbleDictionary
27
- data['option_a'] = True
28
- data['option_b'] = 123
29
-
30
- # -- Calling .save() will trigger the dictionary
31
- # -- to store its current state to a persistent state
32
- data.save()
33
-
34
- # -- We can see the location the data is saved to, and we can
35
- # -- see that it does indeed exist
36
- print(data.location())
37
- print(os.path.exists(data.location()))
38
- ```
39
-
40
-
41
- Equally, we can re-retrieve that data in a completely new instance of python
42
- using the following code:
43
- ```python
44
- # -- Instance a scribble dictionary with the same identifier
45
- data = scribble.get('foobar')
46
-
47
- # -- Print the fact that we have retrieved the same
48
- # -- infromation
49
- print(data)
50
- # {'option_a': True, 'option_b': 123}
51
-
52
- # -- We can then further edit the data
53
- data['option_a'] = False
54
-
55
- # -- Calling .save() will trigger the dictionary
56
- # -- to store its current state to a persistent state
57
- data.save()
58
- ```
59
- By default scribble will store its data in the follow platform specific
60
- locations:
61
-
62
- * Windows: %APPDATA%/pyscribble
63
-
64
- * Linux: %XDG_CONFIG_HOME%/pyscribble if the environment variable exists, otherwise %HOME%/.config/pyscribble
65
-
66
- * OSX: ËœHOME/Documents/pyscribble
67
-
68
- However, you can override these paths by setting an environment variable
69
- PYSCRIBBLE_STORAGE_DIR, if this is set then the path defined by that variable
70
- will always be used over the default behaviour.
71
-
72
- ## Compatability
73
-
74
- This has been tested under Python 2.7.13 and Python 3.6.6 on both Ubuntu and Windows.
75
-
76
- ## Contribute
77
-
78
- If you would like to contribute thoughts, ideas, fixes or features please get in touch! mike@twisted.space
79
-
80
- Keywords: scribble dictionary appdata persistent
81
- Platform: UNKNOWN
82
- Classifier: Programming Language :: Python
83
- Classifier: License :: OSI Approved :: MIT License
84
- Classifier: Operating System :: OS Independent
85
- Description-Content-Type: text/markdown
File without changes
File without changes