cdxcore 0.1.50__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.
- cdxcore-0.1.50/LICENSE +21 -0
- cdxcore-0.1.50/PKG-INFO +152 -0
- cdxcore-0.1.50/README.md +127 -0
- cdxcore-0.1.50/cdxcore/__init__.py +7 -0
- cdxcore-0.1.50/cdxcore/config.py +2300 -0
- cdxcore-0.1.50/cdxcore/deferred.py +1002 -0
- cdxcore-0.1.50/cdxcore/dynalimits.py +238 -0
- cdxcore-0.1.50/cdxcore/dynaplot.py +1740 -0
- cdxcore-0.1.50/cdxcore/err.py +382 -0
- cdxcore-0.1.50/cdxcore/jcpool.py +688 -0
- cdxcore-0.1.50/cdxcore/npio.py +567 -0
- cdxcore-0.1.50/cdxcore/npshm.py +434 -0
- cdxcore-0.1.50/cdxcore/pretty.py +478 -0
- cdxcore-0.1.50/cdxcore/subdir.py +4128 -0
- cdxcore-0.1.50/cdxcore/uniquehash.py +1155 -0
- cdxcore-0.1.50/cdxcore/util.py +1409 -0
- cdxcore-0.1.50/cdxcore/verbose.py +846 -0
- cdxcore-0.1.50/cdxcore/version.py +690 -0
- cdxcore-0.1.50/cdxcore.egg-info/PKG-INFO +152 -0
- cdxcore-0.1.50/cdxcore.egg-info/SOURCES.txt +43 -0
- cdxcore-0.1.50/cdxcore.egg-info/dependency_links.txt +1 -0
- cdxcore-0.1.50/cdxcore.egg-info/requires.txt +11 -0
- cdxcore-0.1.50/cdxcore.egg-info/top_level.txt +7 -0
- cdxcore-0.1.50/docs/source/conf.py +119 -0
- cdxcore-0.1.50/pyproject.toml +27 -0
- cdxcore-0.1.50/setup.cfg +4 -0
- cdxcore-0.1.50/tests/test_config.py +568 -0
- cdxcore-0.1.50/tests/test_deferred.py +355 -0
- cdxcore-0.1.50/tests/test_dynaplot.py +113 -0
- cdxcore-0.1.50/tests/test_err.py +119 -0
- cdxcore-0.1.50/tests/test_jcpool.py +185 -0
- cdxcore-0.1.50/tests/test_npio.py +156 -0
- cdxcore-0.1.50/tests/test_npshm.py +154 -0
- cdxcore-0.1.50/tests/test_pretty.py +394 -0
- cdxcore-0.1.50/tests/test_subdir.py +705 -0
- cdxcore-0.1.50/tests/test_uniquehash.py +495 -0
- cdxcore-0.1.50/tests/test_util.py +613 -0
- cdxcore-0.1.50/tests/test_verbose.py +110 -0
- cdxcore-0.1.50/tests/test_version.py +158 -0
- cdxcore-0.1.50/tmp/filelock.py +514 -0
- cdxcore-0.1.50/tmp/np.py +1098 -0
- cdxcore-0.1.50/tmp/npsh1.py +380 -0
- cdxcore-0.1.50/tmp/sharedarray.py +323 -0
- cdxcore-0.1.50/up/git_message.py +7 -0
- cdxcore-0.1.50/up/pip_modify_setup.py +55 -0
cdxcore-0.1.50/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Hans Buehler
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
cdxcore-0.1.50/PKG-INFO
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cdxcore
|
|
3
|
+
Version: 0.1.50
|
|
4
|
+
Summary: Basic Python Tools; upgraded cdxbasics
|
|
5
|
+
Author-email: Hans Buehler <github@buehler.london>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/hansbuehler/cdxcore
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: numpy
|
|
14
|
+
Requires-Dist: pandas
|
|
15
|
+
Requires-Dist: matplotlib
|
|
16
|
+
Requires-Dist: sortedcontainers
|
|
17
|
+
Requires-Dist: psutil
|
|
18
|
+
Requires-Dist: polars
|
|
19
|
+
Requires-Dist: jsonpickle
|
|
20
|
+
Requires-Dist: numba
|
|
21
|
+
Requires-Dist: joblib
|
|
22
|
+
Requires-Dist: blosc
|
|
23
|
+
Requires-Dist: mkdocstrings[python]>=0.18
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# cdxcore documentation
|
|
27
|
+
|
|
28
|
+
This module contains a number of lightweight tools, developed for managing data analytics and machine learning projects.
|
|
29
|
+
|
|
30
|
+
Install using:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install -U cdxcore
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Documentation can be found here: <https://quantitative-research.de/docs/cdxcore>.
|
|
37
|
+
|
|
38
|
+
## Highlights
|
|
39
|
+
|
|
40
|
+
- **Dynamic plotting**: simple live/animated plots built on Matplotlib.
|
|
41
|
+
- **Config management**: validated, discoverable configurations with automatic help.
|
|
42
|
+
- **Versioning & caching**: code-versioned I/O and reproducible hashing for pipelines.
|
|
43
|
+
- **PrettyObject**: dictionary-like objects that allow attribute access.
|
|
44
|
+
- **Utilities**: formatting helpers, binary I/O, shared-memory arrays, and more.
|
|
45
|
+
|
|
46
|
+
## Main Functionality
|
|
47
|
+
|
|
48
|
+
- [`cdxcore.dynaplot`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.dynaplot.html) is a framework for
|
|
49
|
+
simple **dynamic graphs** with `matplotlib`. It has a simple methodology for
|
|
50
|
+
animated updates for graphs (e.g. during training runs), and allows generation of plot layouts without knowing upfront
|
|
51
|
+
the number of plots (e.g. for plotting a list of features).
|
|
52
|
+
|
|
53
|
+

|
|
54
|
+
|
|
55
|
+
- [`cdxcore.config`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.config.html) allows **robust management of configurations**. It automates help, validation checking,
|
|
56
|
+
and detects misspelled configuration arguments.
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from cdxcore.config import Config, Int, Float
|
|
60
|
+
|
|
61
|
+
class Network(object):
|
|
62
|
+
def __init__( self, config ):
|
|
63
|
+
self.depth = config("depth", 1, Int>0, "Depth of the network")
|
|
64
|
+
self.width = config("width", 1, Int>0, "Width of the network")
|
|
65
|
+
self.activation = config("activation", "selu", str, "Activation function")
|
|
66
|
+
config.done() # see below
|
|
67
|
+
|
|
68
|
+
config = Config()
|
|
69
|
+
config.network.depth = 10
|
|
70
|
+
config.network.width = 100
|
|
71
|
+
config.network.activation = 'relu'
|
|
72
|
+
|
|
73
|
+
network = Network(config.network)
|
|
74
|
+
config.done()
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- [`cdxcore.subdir`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.subdir.html) wraps various file and directory functions into convenient objects. Useful if files have
|
|
78
|
+
common extensions.
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from cdxcore.subdir import SubDir
|
|
82
|
+
import numpy as np
|
|
83
|
+
root = SubDir("!") # current temp directory
|
|
84
|
+
subdir = root("test") # sub-directory 'test'
|
|
85
|
+
subdir.write("data", np.zeros((10,2)))
|
|
86
|
+
data = subdir.read("data")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- **Caching:** ``SubDir`` supports code-versioned file i/o which is used by [`@cdxcore.subdir.SubDir.cache`](file:///C:/Users/hans/OneDrive/Python3/packages/cdxcore/docs/build/html/api/generated/cdxcore.subdir.html#cdxcore.subdir.SubDir.cache)
|
|
90
|
+
for an efficient code-versioned caching protocol for functions and objects:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from cdxcore.subdir import SubDir
|
|
94
|
+
cache = SubDir("!/.cache;*.bin")
|
|
95
|
+
|
|
96
|
+
@cache.cache("0.1")
|
|
97
|
+
def f(x,y):
|
|
98
|
+
return x*y
|
|
99
|
+
|
|
100
|
+
_ = f(1,2) # function gets computed and the result cached
|
|
101
|
+
_ = f(1,2) # restore result from cache
|
|
102
|
+
_ = f(2,2) # different parameters: compute and store result
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- **Code versioning** is implemented in [`cdxcore.version`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.version.html):
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from cdxbasics.version import version
|
|
109
|
+
|
|
110
|
+
@version("0.0.1")
|
|
111
|
+
def f(x):
|
|
112
|
+
return x
|
|
113
|
+
|
|
114
|
+
print( f.version.full ) # -> 0.0.1
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
- **Hashing** (which is used for caching above) is implemented in [`cdxcore.uniquehash`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.uniquehash.html):
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
class A(object):
|
|
121
|
+
def __init__(self, x):
|
|
122
|
+
self.x = x
|
|
123
|
+
self._y = x*2 # protected member will not be hashed by default
|
|
124
|
+
|
|
125
|
+
from cdxcore.uniquehash import UniqueHash
|
|
126
|
+
uniqueHash = UniqueHash(length=12)
|
|
127
|
+
a = A(2)
|
|
128
|
+
print( uniqueHash(a) ) # --> "2d1dc3767730"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
- [`cdxcore.pretty`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.pretty.html) provides a ``PrettyObject`` class whose objects operate like dictionaries.
|
|
132
|
+
This is for users who prefer attribute ``.`` notation over item access when building structured output.
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from cdxbasics.prettydict import PrettyObject
|
|
136
|
+
pdct = PrettyObject(z=1)
|
|
137
|
+
|
|
138
|
+
pdct.num_samples = 1000
|
|
139
|
+
pdct.num_batches = 100
|
|
140
|
+
pdct.method = "signature"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## General purpose utilities
|
|
144
|
+
|
|
145
|
+
- [`cdxcore.verbose`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.verbose.html) provides user-controllable context output for providing progress updates to users.
|
|
146
|
+
|
|
147
|
+
- [`cdxcore.util`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.util.html) offers a number of utility functions such as standard formatting for dates, big numbers, lists,
|
|
148
|
+
dictionaries etc.
|
|
149
|
+
|
|
150
|
+
- [`cdxcore.npio`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.npio.html) provides a low level binary i/o interface for numpy files.
|
|
151
|
+
|
|
152
|
+
- [`cdxcore.npshm`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.npshm.html) provides shared memory numpy arrays.
|
cdxcore-0.1.50/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# cdxcore documentation
|
|
2
|
+
|
|
3
|
+
This module contains a number of lightweight tools, developed for managing data analytics and machine learning projects.
|
|
4
|
+
|
|
5
|
+
Install using:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install -U cdxcore
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Documentation can be found here: <https://quantitative-research.de/docs/cdxcore>.
|
|
12
|
+
|
|
13
|
+
## Highlights
|
|
14
|
+
|
|
15
|
+
- **Dynamic plotting**: simple live/animated plots built on Matplotlib.
|
|
16
|
+
- **Config management**: validated, discoverable configurations with automatic help.
|
|
17
|
+
- **Versioning & caching**: code-versioned I/O and reproducible hashing for pipelines.
|
|
18
|
+
- **PrettyObject**: dictionary-like objects that allow attribute access.
|
|
19
|
+
- **Utilities**: formatting helpers, binary I/O, shared-memory arrays, and more.
|
|
20
|
+
|
|
21
|
+
## Main Functionality
|
|
22
|
+
|
|
23
|
+
- [`cdxcore.dynaplot`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.dynaplot.html) is a framework for
|
|
24
|
+
simple **dynamic graphs** with `matplotlib`. It has a simple methodology for
|
|
25
|
+
animated updates for graphs (e.g. during training runs), and allows generation of plot layouts without knowing upfront
|
|
26
|
+
the number of plots (e.g. for plotting a list of features).
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
- [`cdxcore.config`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.config.html) allows **robust management of configurations**. It automates help, validation checking,
|
|
31
|
+
and detects misspelled configuration arguments.
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from cdxcore.config import Config, Int, Float
|
|
35
|
+
|
|
36
|
+
class Network(object):
|
|
37
|
+
def __init__( self, config ):
|
|
38
|
+
self.depth = config("depth", 1, Int>0, "Depth of the network")
|
|
39
|
+
self.width = config("width", 1, Int>0, "Width of the network")
|
|
40
|
+
self.activation = config("activation", "selu", str, "Activation function")
|
|
41
|
+
config.done() # see below
|
|
42
|
+
|
|
43
|
+
config = Config()
|
|
44
|
+
config.network.depth = 10
|
|
45
|
+
config.network.width = 100
|
|
46
|
+
config.network.activation = 'relu'
|
|
47
|
+
|
|
48
|
+
network = Network(config.network)
|
|
49
|
+
config.done()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- [`cdxcore.subdir`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.subdir.html) wraps various file and directory functions into convenient objects. Useful if files have
|
|
53
|
+
common extensions.
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from cdxcore.subdir import SubDir
|
|
57
|
+
import numpy as np
|
|
58
|
+
root = SubDir("!") # current temp directory
|
|
59
|
+
subdir = root("test") # sub-directory 'test'
|
|
60
|
+
subdir.write("data", np.zeros((10,2)))
|
|
61
|
+
data = subdir.read("data")
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- **Caching:** ``SubDir`` supports code-versioned file i/o which is used by [`@cdxcore.subdir.SubDir.cache`](file:///C:/Users/hans/OneDrive/Python3/packages/cdxcore/docs/build/html/api/generated/cdxcore.subdir.html#cdxcore.subdir.SubDir.cache)
|
|
65
|
+
for an efficient code-versioned caching protocol for functions and objects:
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from cdxcore.subdir import SubDir
|
|
69
|
+
cache = SubDir("!/.cache;*.bin")
|
|
70
|
+
|
|
71
|
+
@cache.cache("0.1")
|
|
72
|
+
def f(x,y):
|
|
73
|
+
return x*y
|
|
74
|
+
|
|
75
|
+
_ = f(1,2) # function gets computed and the result cached
|
|
76
|
+
_ = f(1,2) # restore result from cache
|
|
77
|
+
_ = f(2,2) # different parameters: compute and store result
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
- **Code versioning** is implemented in [`cdxcore.version`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.version.html):
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from cdxbasics.version import version
|
|
84
|
+
|
|
85
|
+
@version("0.0.1")
|
|
86
|
+
def f(x):
|
|
87
|
+
return x
|
|
88
|
+
|
|
89
|
+
print( f.version.full ) # -> 0.0.1
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- **Hashing** (which is used for caching above) is implemented in [`cdxcore.uniquehash`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.uniquehash.html):
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
class A(object):
|
|
96
|
+
def __init__(self, x):
|
|
97
|
+
self.x = x
|
|
98
|
+
self._y = x*2 # protected member will not be hashed by default
|
|
99
|
+
|
|
100
|
+
from cdxcore.uniquehash import UniqueHash
|
|
101
|
+
uniqueHash = UniqueHash(length=12)
|
|
102
|
+
a = A(2)
|
|
103
|
+
print( uniqueHash(a) ) # --> "2d1dc3767730"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
- [`cdxcore.pretty`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.pretty.html) provides a ``PrettyObject`` class whose objects operate like dictionaries.
|
|
107
|
+
This is for users who prefer attribute ``.`` notation over item access when building structured output.
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from cdxbasics.prettydict import PrettyObject
|
|
111
|
+
pdct = PrettyObject(z=1)
|
|
112
|
+
|
|
113
|
+
pdct.num_samples = 1000
|
|
114
|
+
pdct.num_batches = 100
|
|
115
|
+
pdct.method = "signature"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## General purpose utilities
|
|
119
|
+
|
|
120
|
+
- [`cdxcore.verbose`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.verbose.html) provides user-controllable context output for providing progress updates to users.
|
|
121
|
+
|
|
122
|
+
- [`cdxcore.util`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.util.html) offers a number of utility functions such as standard formatting for dates, big numbers, lists,
|
|
123
|
+
dictionaries etc.
|
|
124
|
+
|
|
125
|
+
- [`cdxcore.npio`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.npio.html) provides a low level binary i/o interface for numpy files.
|
|
126
|
+
|
|
127
|
+
- [`cdxcore.npshm`](https://quantitative-research.de/docs/cdxcore/api/generated/cdxcore.npshm.html) provides shared memory numpy arrays.
|