# repl-python-wakatime
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/wakatime/repl-python-wakatime/main.svg)](https://results.pre-commit.ci/latest/github/wakatime/repl-python-wakatime/main)
[![github/workflow](https://github.com/wakatime/repl-python-wakatime/actions/workflows/main.yml/badge.svg)](https://github.com/wakatime/repl-python-wakatime/actions)
[![codecov](https://codecov.io/gh/wakatime/repl-python-wakatime/branch/main/graph/badge.svg)](https://codecov.io/gh/wakatime/repl-python-wakatime)
[![readthedocs](https://shields.io/readthedocs/repl-python-wakatime)](https://repl-python-wakatime.readthedocs.io)
[![github/downloads](https://shields.io/github/downloads/wakatime/repl-python-wakatime/total)](https://github.com/wakatime/repl-python-wakatime/releases)
[![github/downloads/latest](https://shields.io/github/downloads/wakatime/repl-python-wakatime/latest/total)](https://github.com/wakatime/repl-python-wakatime/releases/latest)
[![github/issues](https://shields.io/github/issues/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/issues)
[![github/issues-closed](https://shields.io/github/issues-closed/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/issues?q=is%3Aissue+is%3Aclosed)
[![github/issues-pr](https://shields.io/github/issues-pr/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/pulls)
[![github/issues-pr-closed](https://shields.io/github/issues-pr-closed/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/pulls?q=is%3Apr+is%3Aclosed)
[![github/discussions](https://shields.io/github/discussions/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/discussions)
[![github/milestones](https://shields.io/github/milestones/all/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/milestones)
[![github/forks](https://shields.io/github/forks/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/network/members)
[![github/stars](https://shields.io/github/stars/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/stargazers)
[![github/watchers](https://shields.io/github/watchers/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/watchers)
[![github/contributors](https://shields.io/github/contributors/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/graphs/contributors)
[![github/commit-activity](https://shields.io/github/commit-activity/w/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/graphs/commit-activity)
[![github/last-commit](https://shields.io/github/last-commit/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/commits)
[![github/release-date](https://shields.io/github/release-date/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/releases/latest)
[![github/license](https://shields.io/github/license/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/blob/main/LICENSE)
[![github/languages](https://shields.io/github/languages/count/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)
[![github/languages/top](https://shields.io/github/languages/top/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)
[![github/directory-file-count](https://shields.io/github/directory-file-count/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)
[![github/code-size](https://shields.io/github/languages/code-size/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)
[![github/repo-size](https://shields.io/github/repo-size/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)
[![github/v](https://shields.io/github/v/release/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)
[![pypi/status](https://shields.io/pypi/status/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#description)
[![pypi/v](https://shields.io/pypi/v/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#history)
[![pypi/downloads](https://shields.io/pypi/dd/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#files)
[![pypi/format](https://shields.io/pypi/format/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#files)
[![pypi/implementation](https://shields.io/pypi/implementation/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#files)
[![pypi/pyversions](https://shields.io/pypi/pyversions/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#files)
Python REPL plugin for automatic time tracking and metrics generated from your
programming activity.
![screenshot](https://github.com/wakatime/repl-python-wakatime/assets/32936898/d0ac2fab-f9c2-4213-99e3-4249279b1213)
Supported REPLs:
- [x] [python](https://github.com/python/cpython):
- executes
[`str(sys.ps1)`](https://docs.python.org/3/library/sys.html#sys.ps1) after
every input.
- configure file:
[`$PYTHON_STARTUP`](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSTARTUP).
```python
from repl_python_wakatime.python import install_hook
install_hook()
```
- [x] [ptpython](https://github.com/prompt-toolkit/ptpython):
- executes `get_ptpython().get_output_prompt()` after every output.
- configure file: `.../ptpython/config.py`. `...` depends on OS.
```python
from ptpython.repl import PythonRepl
from repl_python_wakatime.ptpython import install_hook
def configure(repl: PythonRepl) -> None:
install_hook(repl)
```
- [x] [ipython](https://github.com/ipython/ipython):
- executes
`c.TerminalInteractiveShell.prompts_class(shell).out_prompt_tokens()` after
every output.
- configure file: `~/.ipython/profile_default/ipython_config.py`.
```python
from repl_python_wakatime.iptpython import install_hook
install_hook(c)
```
- [x] [ptipython](https://github.com/prompt-toolkit/ptpython): Same as
[ipython](https://github.com/ipython/ipython).
- [ ] [bpython](https://github.com/bpython/bpython)
- [ ] [xonsh](https://github.com/xonsh/xonsh)
- [ ] [mypython](https://github.com/asmeurer/mypython): Won't fix.
- configure file: non-exist.
`install_hook()` must be after the customization of the prompt string and best
at the end of file.
## Configure
```python
from repl_python_wakatime.python import install_hook
install_hook(hook_function, args, kwargs)
```
will execute `hook_function(*args, **kwargs)` after every output/input. Other
REPLs are similar. Currently, `hook_function` can be:
- `repl_python_wakatime.hooks.wakatime.wakatime_hook()`: By default.
- `repl_python_wakatime.hooks.codestats.codestats_hook()`: for [codestats](https://codestats.net/)
- Create your hooks for other similar projects, such as:
- [codetime](https://codetime.dev/)
- [rescuetime](https://www.rescuetime.com/)
- ...
## Related programs
Some programs is written in python or providing a python port.
We can use this project to statistic their time:
- [gdb](https://sourceware.org/gdb): See
[here](https://github.com/Freed-Wu/gdb-prompt)
## Similar projects
- [wakatime plugins for python and many shells](https://wakatime.com/terminal)
- [codestats plugins](https://codestats.net/plugins)
Raw data
{
"_id": null,
"home_page": null,
"name": "repl-python-wakatime",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "wakatime, plugin, python, ipython, ptpython",
"author": null,
"author_email": "Wu Zhenyu <wuzhenyu@ustc.edu>",
"download_url": "https://files.pythonhosted.org/packages/0d/46/267bc5fca0407c7292d4b940179e44d07a5fa5e512c8d9bcaabb4d62360a/repl-python-wakatime-0.0.11.tar.gz",
"platform": null,
"description": "# repl-python-wakatime\n\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/wakatime/repl-python-wakatime/main.svg)](https://results.pre-commit.ci/latest/github/wakatime/repl-python-wakatime/main)\n[![github/workflow](https://github.com/wakatime/repl-python-wakatime/actions/workflows/main.yml/badge.svg)](https://github.com/wakatime/repl-python-wakatime/actions)\n[![codecov](https://codecov.io/gh/wakatime/repl-python-wakatime/branch/main/graph/badge.svg)](https://codecov.io/gh/wakatime/repl-python-wakatime)\n[![readthedocs](https://shields.io/readthedocs/repl-python-wakatime)](https://repl-python-wakatime.readthedocs.io)\n\n[![github/downloads](https://shields.io/github/downloads/wakatime/repl-python-wakatime/total)](https://github.com/wakatime/repl-python-wakatime/releases)\n[![github/downloads/latest](https://shields.io/github/downloads/wakatime/repl-python-wakatime/latest/total)](https://github.com/wakatime/repl-python-wakatime/releases/latest)\n[![github/issues](https://shields.io/github/issues/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/issues)\n[![github/issues-closed](https://shields.io/github/issues-closed/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/issues?q=is%3Aissue+is%3Aclosed)\n[![github/issues-pr](https://shields.io/github/issues-pr/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/pulls)\n[![github/issues-pr-closed](https://shields.io/github/issues-pr-closed/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/pulls?q=is%3Apr+is%3Aclosed)\n[![github/discussions](https://shields.io/github/discussions/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/discussions)\n[![github/milestones](https://shields.io/github/milestones/all/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/milestones)\n[![github/forks](https://shields.io/github/forks/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/network/members)\n[![github/stars](https://shields.io/github/stars/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/stargazers)\n[![github/watchers](https://shields.io/github/watchers/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/watchers)\n[![github/contributors](https://shields.io/github/contributors/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/graphs/contributors)\n[![github/commit-activity](https://shields.io/github/commit-activity/w/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/graphs/commit-activity)\n[![github/last-commit](https://shields.io/github/last-commit/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/commits)\n[![github/release-date](https://shields.io/github/release-date/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/releases/latest)\n\n[![github/license](https://shields.io/github/license/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime/blob/main/LICENSE)\n[![github/languages](https://shields.io/github/languages/count/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)\n[![github/languages/top](https://shields.io/github/languages/top/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)\n[![github/directory-file-count](https://shields.io/github/directory-file-count/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)\n[![github/code-size](https://shields.io/github/languages/code-size/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)\n[![github/repo-size](https://shields.io/github/repo-size/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)\n[![github/v](https://shields.io/github/v/release/wakatime/repl-python-wakatime)](https://github.com/wakatime/repl-python-wakatime)\n\n[![pypi/status](https://shields.io/pypi/status/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#description)\n[![pypi/v](https://shields.io/pypi/v/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#history)\n[![pypi/downloads](https://shields.io/pypi/dd/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#files)\n[![pypi/format](https://shields.io/pypi/format/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#files)\n[![pypi/implementation](https://shields.io/pypi/implementation/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#files)\n[![pypi/pyversions](https://shields.io/pypi/pyversions/repl-python-wakatime)](https://pypi.org/project/repl-python-wakatime/#files)\n\nPython REPL plugin for automatic time tracking and metrics generated from your\nprogramming activity.\n\n![screenshot](https://github.com/wakatime/repl-python-wakatime/assets/32936898/d0ac2fab-f9c2-4213-99e3-4249279b1213)\n\nSupported REPLs:\n\n- [x] [python](https://github.com/python/cpython):\n - executes\n [`str(sys.ps1)`](https://docs.python.org/3/library/sys.html#sys.ps1) after\n every input.\n - configure file:\n [`$PYTHON_STARTUP`](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONSTARTUP).\n\n```python\nfrom repl_python_wakatime.python import install_hook\n\ninstall_hook()\n```\n\n- [x] [ptpython](https://github.com/prompt-toolkit/ptpython):\n - executes `get_ptpython().get_output_prompt()` after every output.\n - configure file: `.../ptpython/config.py`. `...` depends on OS.\n\n```python\nfrom ptpython.repl import PythonRepl\nfrom repl_python_wakatime.ptpython import install_hook\n\n\ndef configure(repl: PythonRepl) -> None:\n install_hook(repl)\n```\n\n- [x] [ipython](https://github.com/ipython/ipython):\n - executes\n `c.TerminalInteractiveShell.prompts_class(shell).out_prompt_tokens()` after\n every output.\n - configure file: `~/.ipython/profile_default/ipython_config.py`.\n\n```python\nfrom repl_python_wakatime.iptpython import install_hook\n\ninstall_hook(c)\n```\n\n- [x] [ptipython](https://github.com/prompt-toolkit/ptpython): Same as\n [ipython](https://github.com/ipython/ipython).\n- [ ] [bpython](https://github.com/bpython/bpython)\n- [ ] [xonsh](https://github.com/xonsh/xonsh)\n- [ ] [mypython](https://github.com/asmeurer/mypython): Won't fix.\n - configure file: non-exist.\n\n`install_hook()` must be after the customization of the prompt string and best\nat the end of file.\n\n## Configure\n\n```python\nfrom repl_python_wakatime.python import install_hook\n\ninstall_hook(hook_function, args, kwargs)\n```\n\nwill execute `hook_function(*args, **kwargs)` after every output/input. Other\nREPLs are similar. Currently, `hook_function` can be:\n\n- `repl_python_wakatime.hooks.wakatime.wakatime_hook()`: By default.\n- `repl_python_wakatime.hooks.codestats.codestats_hook()`: for [codestats](https://codestats.net/)\n- Create your hooks for other similar projects, such as:\n - [codetime](https://codetime.dev/)\n - [rescuetime](https://www.rescuetime.com/)\n - ...\n\n## Related programs\n\nSome programs is written in python or providing a python port.\nWe can use this project to statistic their time:\n\n- [gdb](https://sourceware.org/gdb): See\n [here](https://github.com/Freed-Wu/gdb-prompt)\n\n## Similar projects\n\n- [wakatime plugins for python and many shells](https://wakatime.com/terminal)\n- [codestats plugins](https://codestats.net/plugins)\n",
"bugtrack_url": null,
"license": "GPL v3",
"summary": "Python REPL plugin for automatic time tracking and metrics generated from your programming activity",
"version": "0.0.11",
"project_urls": {
"Bug Report": "https://github.com/wakatime/repl-python-wakatime/issues",
"Download": "https://github.com/wakatime/repl-python-wakatime/releases",
"Homepage": "https://repl-python-wakatime.readthedocs.io",
"Source": "https://github.com/wakatime/repl-python-wakatime"
},
"split_keywords": [
"wakatime",
" plugin",
" python",
" ipython",
" ptpython"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "50898e4ed7a583fc27d8dd596688a034564a5ad75e762a3a1e83bcbbd15eb5df",
"md5": "981730bde344513d5055f7df6e1d7cf8",
"sha256": "ff69598fb8976fff8b9bfb94d796d266ca07db923443a28c9566f04b31ba69f8"
},
"downloads": -1,
"filename": "repl_python_wakatime-0.0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "981730bde344513d5055f7df6e1d7cf8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 23567,
"upload_time": "2024-04-08T17:50:30",
"upload_time_iso_8601": "2024-04-08T17:50:30.743704Z",
"url": "https://files.pythonhosted.org/packages/50/89/8e4ed7a583fc27d8dd596688a034564a5ad75e762a3a1e83bcbbd15eb5df/repl_python_wakatime-0.0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0d46267bc5fca0407c7292d4b940179e44d07a5fa5e512c8d9bcaabb4d62360a",
"md5": "88faef6da2f849f6b1fce3ed784db7a7",
"sha256": "1e809d7a8d372dfde0e578341a003258ebb63ed1aacb7def8396d0adf9043e41"
},
"downloads": -1,
"filename": "repl-python-wakatime-0.0.11.tar.gz",
"has_sig": false,
"md5_digest": "88faef6da2f849f6b1fce3ed784db7a7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 29857,
"upload_time": "2024-04-08T17:50:33",
"upload_time_iso_8601": "2024-04-08T17:50:33.991624Z",
"url": "https://files.pythonhosted.org/packages/0d/46/267bc5fca0407c7292d4b940179e44d07a5fa5e512c8d9bcaabb4d62360a/repl-python-wakatime-0.0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-08 17:50:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "wakatime",
"github_project": "repl-python-wakatime",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "repl-python-wakatime"
}