TAMPPA-pra-dan


NameTAMPPA-pra-dan JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/pra-dan/TAMPPA
SummaryTime And Memory Profile Parser
upload_time2020-08-01 12:48:54
maintainer
docs_urlNone
authorPrashant Dandriyal
requires_python>=3.6
licenseMPL
keywords memory parsing parser timing timer profiling profiler line_profiler
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TAMPPA: Time And Memory Profile PArser

---
> As a maiden attampt, I hope to make it super useful for the community. Please report bugs and make pull requests to improve it.
---

## Introduction:

TAMPPA is a supporting package for the popular profilers
* [line_profiler and kernprof](https://github.com/pyutils/line_profiler/blob/master/README.rst), and
* [memory_profiler](https://github.com/pythonprofilers/memory_profiler)

Both the packages do an excellent job by providing profiling results on the terminal.

```python3
Total time: 0.181071 s
File: main.py
Function: linearRegressionfit at line 35

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
    35                                           @profile
    36                                           def linearRegressionfit(Xt,Yt,Xts,Yts):
    37         1         52.0     52.0      0.1      lr=LinearRegression()
    38         1      28942.0  28942.0     75.2      model=lr.fit(Xt,Yt)
    39         1       1347.0   1347.0      3.5      predict=lr.predict(Xts)
    40                                           
    41         1       4924.0   4924.0     12.8      print("train Accuracy",lr.score(Xt,Yt))
    42         1       3242.0   3242.0      8.4      print("test Accuracy",lr.score(Xts,Yts))
```

But, there seems to be no method to get these stats in a exportable file that can be used with flexibility. 

On dumping the logs to a `.txt` file still requires an individual to parse data from the text by self and then convert the content into a `.csv` file; which is a common format for sharing statistical data and plotting using MATPLOTLIB. 

This is exactly what **TAMPPA** does ! It outputs one `.csv` file per function and another text file `func_names.txt` and `again_func_names.txt` for accessing these files easily.

## Pre-requisites:
**Note: Both the parsers need a .txt file to parse results from**

* Run both the profilers or the profiler whose results you need as a `csv`, and save the logs on the console to a `.txt` file. For e.g saving the memory profiling results of the python application `mainm.py` and saving the results to `mem_res_1.txt`

```python3
$ python -m memory_profiler mainm.py > mem_res_1.txt
```

*   Avoid printing anything on the console. Try it with `python main.py` and nothing should be printed to the console. So, comment out all the print and log statements.

## Installation
Any particular release can be installed using `pip`:
```python3
$ pip install tamppa
```

To enter development mode,
```python3
$ git clone https://github.com/pra-dan/TAMPPA.git
```
## Usage
Refer to the following once the Installation is over.

### Time Profile Parser
Initially, if we have only the `.txt` file.
```python3
.
└── tim_prof_results.txt
0 directories, 1 file
```

Run `tim_parse` or time parser, in a Python environment (`$ python`)
```python3
>>> from tamppa import tim_parse
>>> tim_parse("tim_prof_results.txt")
```

On successful execution, the lonely directory is populated as
```python3
.
├── again_func_names.txt
├── import_data_tim_.csv
├── linearRegressionfit_tim_.csv
├── parse_data_tim_.csv
├── randForestRegressorfit_tim_.csv
└── tim_prof_results.txt

0 directories, 6 files
```

Additionally, a plot is also generated as
![mem_res](https://github.com/pra-dan/TAMPPA/blob/master/resources/tim_res.png)

### Memory Profile Parser
Similarly, if we have only the `.txt` file for the `memory_profiler`.
```python3
.
└── mem_res_1.txt

0 directories, 1 file
```

Run `mem_parse` or time parser, in a Python environment (`$ python`)
```python3
>>> from tamppa import mem_parse
>>> mem_parse("mem_res_1.txt")
```

On successful execution, the lonely directory is populated as
```python3
.
├── func_names.txt
├── function_wise_time_results.csv
├── import_data_mem_.csv
├── linearRegressionfit_mem_.csv
├── mem_res_1.txt
├── parse_data_mem_.csv
└── randForestRegressorfit_mem_.csv

0 directories, 7 files
```

Additionally, a plot is also generated as
![mem_res](https://github.com/pra-dan/TAMPPA/blob/master/resources/mem_res.png)

## TODOs:
- [ ] (Provide the entire package a executable-like interface; such that the parsers can be called simply as `$ mem_parse file.txt -plot true`)

- [ ] (Add flags to toggle plots for both parsers)


## References:

* [Packaging Python Projects](https://packaging.python.org/tutorials/packaging-projects/)

* [Jacob Tomlinson's Blogs](https://www.jacobtomlinson.co.uk/series/creating-an-open-source-python-project-from-scratch/)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pra-dan/TAMPPA",
    "name": "TAMPPA-pra-dan",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "memory,parsing,parser,timing,timer,profiling,profiler,line_profiler",
    "author": "Prashant Dandriyal",
    "author_email": "prashantdandriyal7@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/88/d5/d5994688dbb38c06fb4d4c5c9f93ee396eaa3b570be193333993aba6dad5/TAMPPA-pra-dan-0.0.1.tar.gz",
    "platform": "",
    "description": "# TAMPPA: Time And Memory Profile PArser\n\n---\n> As a maiden attampt, I hope to make it super useful for the community. Please report bugs and make pull requests to improve it.\n---\n\n## Introduction:\n\nTAMPPA is a supporting package for the popular profilers\n* [line_profiler and kernprof](https://github.com/pyutils/line_profiler/blob/master/README.rst), and\n* [memory_profiler](https://github.com/pythonprofilers/memory_profiler)\n\nBoth the packages do an excellent job by providing profiling results on the terminal.\n\n```python3\nTotal time: 0.181071 s\nFile: main.py\nFunction: linearRegressionfit at line 35\n\nLine #      Hits         Time  Per Hit   % Time  Line Contents\n==============================================================\n    35                                           @profile\n    36                                           def linearRegressionfit(Xt,Yt,Xts,Yts):\n    37         1         52.0     52.0      0.1      lr=LinearRegression()\n    38         1      28942.0  28942.0     75.2      model=lr.fit(Xt,Yt)\n    39         1       1347.0   1347.0      3.5      predict=lr.predict(Xts)\n    40                                           \n    41         1       4924.0   4924.0     12.8      print(\"train Accuracy\",lr.score(Xt,Yt))\n    42         1       3242.0   3242.0      8.4      print(\"test Accuracy\",lr.score(Xts,Yts))\n```\n\nBut, there seems to be no method to get these stats in a exportable file that can be used with flexibility. \n\nOn dumping the logs to a `.txt` file still requires an individual to parse data from the text by self and then convert the content into a `.csv` file; which is a common format for sharing statistical data and plotting using MATPLOTLIB. \n\nThis is exactly what **TAMPPA** does ! It outputs one `.csv` file per function and another text file `func_names.txt` and `again_func_names.txt` for accessing these files easily.\n\n## Pre-requisites:\n**Note: Both the parsers need a .txt file to parse results from**\n\n* Run both the profilers or the profiler whose results you need as a `csv`, and save the logs on the console to a `.txt` file. For e.g saving the memory profiling results of the python application `mainm.py` and saving the results to `mem_res_1.txt`\n\n```python3\n$ python -m memory_profiler mainm.py > mem_res_1.txt\n```\n\n*   Avoid printing anything on the console. Try it with `python main.py` and nothing should be printed to the console. So, comment out all the print and log statements.\n\n## Installation\nAny particular release can be installed using `pip`:\n```python3\n$ pip install tamppa\n```\n\nTo enter development mode,\n```python3\n$ git clone https://github.com/pra-dan/TAMPPA.git\n```\n## Usage\nRefer to the following once the Installation is over.\n\n### Time Profile Parser\nInitially, if we have only the `.txt` file.\n```python3\n.\n\u2514\u2500\u2500 tim_prof_results.txt\n0 directories, 1 file\n```\n\nRun `tim_parse` or time parser, in a Python environment (`$ python`)\n```python3\n>>> from tamppa import tim_parse\n>>> tim_parse(\"tim_prof_results.txt\")\n```\n\nOn successful execution, the lonely directory is populated as\n```python3\n.\n\u251c\u2500\u2500 again_func_names.txt\n\u251c\u2500\u2500 import_data_tim_.csv\n\u251c\u2500\u2500 linearRegressionfit_tim_.csv\n\u251c\u2500\u2500 parse_data_tim_.csv\n\u251c\u2500\u2500 randForestRegressorfit_tim_.csv\n\u2514\u2500\u2500 tim_prof_results.txt\n\n0 directories, 6 files\n```\n\nAdditionally, a plot is also generated as\n![mem_res](https://github.com/pra-dan/TAMPPA/blob/master/resources/tim_res.png)\n\n### Memory Profile Parser\nSimilarly, if we have only the `.txt` file for the `memory_profiler`.\n```python3\n.\n\u2514\u2500\u2500 mem_res_1.txt\n\n0 directories, 1 file\n```\n\nRun `mem_parse` or time parser, in a Python environment (`$ python`)\n```python3\n>>> from tamppa import mem_parse\n>>> mem_parse(\"mem_res_1.txt\")\n```\n\nOn successful execution, the lonely directory is populated as\n```python3\n.\n\u251c\u2500\u2500 func_names.txt\n\u251c\u2500\u2500 function_wise_time_results.csv\n\u251c\u2500\u2500 import_data_mem_.csv\n\u251c\u2500\u2500 linearRegressionfit_mem_.csv\n\u251c\u2500\u2500 mem_res_1.txt\n\u251c\u2500\u2500 parse_data_mem_.csv\n\u2514\u2500\u2500 randForestRegressorfit_mem_.csv\n\n0 directories, 7 files\n```\n\nAdditionally, a plot is also generated as\n![mem_res](https://github.com/pra-dan/TAMPPA/blob/master/resources/mem_res.png)\n\n## TODOs:\n- [ ] (Provide the entire package a executable-like interface; such that the parsers can be called simply as `$ mem_parse file.txt -plot true`)\n\n- [ ] (Add flags to toggle plots for both parsers)\n\n\n## References:\n\n* [Packaging Python Projects](https://packaging.python.org/tutorials/packaging-projects/)\n\n* [Jacob Tomlinson's Blogs](https://www.jacobtomlinson.co.uk/series/creating-an-open-source-python-project-from-scratch/)\n\n\n",
    "bugtrack_url": null,
    "license": "MPL",
    "summary": "Time And Memory Profile Parser",
    "version": "0.0.1",
    "split_keywords": [
        "memory",
        "parsing",
        "parser",
        "timing",
        "timer",
        "profiling",
        "profiler",
        "line_profiler"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "6c7f28a0b5aac65a092d5a2cfa5e4afb",
                "sha256": "34744ef3d095176ae895374d9da55b2b4430c061b0e766e1ca51c1611eadfc97"
            },
            "downloads": -1,
            "filename": "TAMPPA_pra_dan-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6c7f28a0b5aac65a092d5a2cfa5e4afb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 15525,
            "upload_time": "2020-08-01T12:48:41",
            "upload_time_iso_8601": "2020-08-01T12:48:41.658414Z",
            "url": "https://files.pythonhosted.org/packages/97/9d/dd0d613557400bb7ed9ba131eee636b9d5b87a455d931692f3d89519776a/TAMPPA_pra_dan-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "8dad4b6f128a8fc3f4596a34bea32889",
                "sha256": "e2eeafb2278b87bf57abbf64c79ba88e4d319141a376d3967a0fa0638ced4da3"
            },
            "downloads": -1,
            "filename": "TAMPPA-pra-dan-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8dad4b6f128a8fc3f4596a34bea32889",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 31715,
            "upload_time": "2020-08-01T12:48:54",
            "upload_time_iso_8601": "2020-08-01T12:48:54.016410Z",
            "url": "https://files.pythonhosted.org/packages/88/d5/d5994688dbb38c06fb4d4c5c9f93ee396eaa3b570be193333993aba6dad5/TAMPPA-pra-dan-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-08-01 12:48:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "pra-dan",
    "error": "Could not fetch GitHub repository",
    "lcname": "tamppa-pra-dan"
}
        
Elapsed time: 0.12723s