easy-kit 0.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.
easy_kit-0.0.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Florent Le Gac
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.
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.1
2
+ Name: easy-kit
3
+ Version: 0.0.1
4
+ Summary: Python toolkit
5
+ Author: flegac
6
+ Author-email: flegac <florent.legac@gmail.com>
7
+ Project-URL: Homepage, https://github.com/flegac/small-tools
8
+ Project-URL: Issues, https://github.com/flegac/small-tools/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+
16
+ # easy-kit
17
+
18
+ Collection of tools with no external dependencies.
19
+
20
+ - Benchmark (cpu time usage)
21
+ - Event queue (observe, connect)
22
+
23
+ ## Requirements
24
+
25
+ python >3.7
26
+
27
+ ## Usage
28
+
29
+ Cf. [tests](./tests) directory
@@ -0,0 +1,14 @@
1
+ # easy-kit
2
+
3
+ Collection of tools with no external dependencies.
4
+
5
+ - Benchmark (cpu time usage)
6
+ - Event queue (observe, connect)
7
+
8
+ ## Requirements
9
+
10
+ python >3.7
11
+
12
+ ## Usage
13
+
14
+ Cf. [tests](./tests) directory
@@ -0,0 +1,29 @@
1
+ Metadata-Version: 2.1
2
+ Name: easy-kit
3
+ Version: 0.0.1
4
+ Summary: Python toolkit
5
+ Author: flegac
6
+ Author-email: flegac <florent.legac@gmail.com>
7
+ Project-URL: Homepage, https://github.com/flegac/small-tools
8
+ Project-URL: Issues, https://github.com/flegac/small-tools/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.7
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+
16
+ # easy-kit
17
+
18
+ Collection of tools with no external dependencies.
19
+
20
+ - Benchmark (cpu time usage)
21
+ - Event queue (observe, connect)
22
+
23
+ ## Requirements
24
+
25
+ python >3.7
26
+
27
+ ## Usage
28
+
29
+ Cf. [tests](./tests) directory
@@ -0,0 +1,10 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ easy_kit.egg-info/PKG-INFO
6
+ easy_kit.egg-info/SOURCES.txt
7
+ easy_kit.egg-info/dependency_links.txt
8
+ easy_kit.egg-info/top_level.txt
9
+ tests/test_event.py
10
+ tests/test_timing.py
@@ -0,0 +1,22 @@
1
+ [project]
2
+ name = "easy-kit"
3
+ version = "0.0.1"
4
+ authors = [
5
+ { name="flegac", email="florent.legac@gmail.com" },
6
+ ]
7
+ description = "Python toolkit"
8
+ readme = "README.md"
9
+ requires-python = ">=3.8"
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "License :: OSI Approved :: MIT License",
13
+ "Operating System :: OS Independent",
14
+ ]
15
+
16
+ [project.urls]
17
+ Homepage = "https://github.com/flegac/small-tools"
18
+ Issues = "https://github.com/flegac/small-tools/issues"
19
+
20
+ [build-system]
21
+ requires = ["setuptools>=61.0"]
22
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,26 @@
1
+ from pathlib import Path
2
+
3
+ from setuptools import setup, find_packages
4
+
5
+ with open("README.md", "r", encoding="utf-8") as fh:
6
+ long_description = fh.read()
7
+
8
+ REQUIREMENTS_PATH = Path.cwd() / 'requirements.txt'
9
+
10
+ setup(
11
+ name="easy-kit",
12
+ author='flegac',
13
+ description='Python toolkit',
14
+
15
+ long_description=long_description,
16
+ long_description_content_type="text/markdown",
17
+ classifiers=[
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ ],
22
+ packages=find_packages(),
23
+ # install_requires=[line for line in REQUIREMENTS_PATH.open()],
24
+ python_requires=">=3.7",
25
+ include_package_data=True
26
+ )
@@ -0,0 +1,23 @@
1
+ from unittest import TestCase
2
+
3
+ from mini_tools.event import Event
4
+
5
+
6
+ class TestEvent(TestCase):
7
+ def test_event(self):
8
+ # allow to register new observers (if not enabled, the lib is disabled and has no performance impact)
9
+ Event.enable()
10
+
11
+ # create an event queue
12
+ toto = Event(name='Toto')
13
+
14
+ @toto.observe
15
+ def send_hello(data: str):
16
+ return f'hello {data}'
17
+
18
+ @toto.connect
19
+ def handler(data: str):
20
+ print(f'echo: {data}')
21
+
22
+ toto.emit('coucou')
23
+ send_hello('toto')
@@ -0,0 +1,25 @@
1
+ import time
2
+ from pprint import pprint
3
+
4
+ from mini_tools.timing import TimingTestCase, timing, _TIMING
5
+
6
+
7
+ class TestTiming(TimingTestCase):
8
+ def test_timing(self):
9
+ with timing('test1'):
10
+ time.sleep(.3)
11
+
12
+ for i in range(10):
13
+ with timing('test2'):
14
+ time.sleep(.02)
15
+
16
+ def test_structure(self):
17
+ with timing('aaa.test1'):
18
+ time.sleep(.3)
19
+ with timing('aaa.test2'):
20
+ time.sleep(.02)
21
+ with timing('xxx.yyy'):
22
+ time.sleep(.01)
23
+ with timing('xxx.test2'):
24
+ time.sleep(.01)
25
+ pprint(_TIMING.tree_structure())