Metadata-Version: 2.1
Name: DevTool
Version: 0.0.0
Summary: a small tool for python development
Home-page: https://github.com/guchengxi1994/dev-tool-for-python
Author: Chengxi GU
Author-email: guchengxi1994@qq.com
License: MIT License
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.6
Description-Content-Type: text/markdown
Requires-Dist: setuptools (==41.0.1)
Requires-Dist: termcolor (==1.1.0)
Requires-Dist: concurrent-log-handler (==0.9.16)

<!--
 * @lanhuage: markdown
 * @Descripttion: 
 * @version: beta
 * @Author: xiaoshuyui
 * @Date: 2021-01-06 08:24:38
 * @LastEditors: xiaoshuyui
 * @LastEditTime: 2021-01-11 17:21:05
-->
# dev-tool-for-python
 a small tool for python development

[![Build Status](https://www.travis-ci.com/guchengxi1994/dev-tool-for-python.svg?branch=dev)](https://www.travis-ci.com/guchengxi1994/dev-tool-for-python.svg?branch=dev)


# Introduction

### Recently, I have wrote a lot of python codes but always like this.

![devtool-example](./static/devtool_example.gif)

![wtf](./static/wtf.jpg)

#### I think i am a bad programmer. o(￣ヘ￣o＃)

#### I will forget where can i find the proper function or method even with a doc-string.(But i seldom write doc-string when coding alone.)

## So i want to develop a tool to record informations when coding by using python decorators.

# HOW TO USE.

## 1. Download this repo. run

    pip install -r requestments.txt

## 2. Copy the "devtool" folder into your project.

## 3. Details.

### 3.1 For logs filter.

    from devtool.devTool import DevTool
    DevTool.logFilter(*kwds, **params)

kws are the keywords to be searched,params include path,since and until under this version.

To record log file easily,try this.

    from devtool import logit

    @logit()
    def test4():
        x = 1 / 0

    test4()

then DevLog/devlog.log will be created and log information will be added.

    2021-01-09 09:49:00,143 - DevTool - ERROR - __main__.test4 Traceback (most recent call last):
    File "D:\dev-tool-for-python\devtool\__init__.py", line 112, in execute
        func(*args, **kwargs)
    File ".\testWrap.py", line 35, in test4
        x = 1 / 0
    ZeroDivisionError: division by zero

@logit can add three params: save,load,ignore

@save ,to record the function ,params and result to DevLog/devCache.dump

@load, load result from DevLog/devCache.dump if the function costs much time. if the params are same to the stored params, then return the result. Otherwise, excute again.

@ignore, force to execute the function 

    @logit(save=True,load=True,ignore=False)
    def test8(a=1,b=2):
        import time
        rs = 'aaaaab'
        t1 = time.time()
        time.sleep(5)
        print(time.time()-t1)
        return rs

    if __name__ == "__main__":
        a = test8(a=3,b=4)
        print(a)


first time:

    (base) PS D:\dev-tool-for-python> python .\testWrap.py
    5.01481556892395
    aaaaab

second time:

    (base) PS D:\dev-tool-for-python> python .\testWrap.py
    aaaaab


![linux](./static/devtool_linux.gif)



