# repl-python-wakatime
[](https://results.pre-commit.ci/latest/github/wakatime/repl-python-wakatime/main)
[](https://github.com/wakatime/repl-python-wakatime/actions)
[](https://codecov.io/gh/wakatime/repl-python-wakatime)
[](https://repl-python-wakatime.readthedocs.io)
[](https://github.com/wakatime/repl-python-wakatime/releases)
[](https://github.com/wakatime/repl-python-wakatime/releases/latest)
[](https://github.com/wakatime/repl-python-wakatime/issues)
[](https://github.com/wakatime/repl-python-wakatime/issues?q=is%3Aissue+is%3Aclosed)
[](https://github.com/wakatime/repl-python-wakatime/pulls)
[](https://github.com/wakatime/repl-python-wakatime/pulls?q=is%3Apr+is%3Aclosed)
[](https://github.com/wakatime/repl-python-wakatime/discussions)
[](https://github.com/wakatime/repl-python-wakatime/milestones)
[](https://github.com/wakatime/repl-python-wakatime/network/members)
[](https://github.com/wakatime/repl-python-wakatime/stargazers)
[](https://github.com/wakatime/repl-python-wakatime/watchers)
[](https://github.com/wakatime/repl-python-wakatime/graphs/contributors)
[](https://github.com/wakatime/repl-python-wakatime/graphs/commit-activity)
[](https://github.com/wakatime/repl-python-wakatime/commits)
[](https://github.com/wakatime/repl-python-wakatime/releases/latest)
[](https://github.com/wakatime/repl-python-wakatime/blob/main/LICENSE)
[](https://github.com/wakatime/repl-python-wakatime)
[](https://github.com/wakatime/repl-python-wakatime)
[](https://github.com/wakatime/repl-python-wakatime)
[](https://github.com/wakatime/repl-python-wakatime)
[](https://github.com/wakatime/repl-python-wakatime)
[](https://github.com/wakatime/repl-python-wakatime)
[](https://pypi.org/project/repl-python-wakatime/#description)
[](https://pypi.org/project/repl-python-wakatime/#history)
[](https://pypi.org/project/repl-python-wakatime/#files)
[](https://pypi.org/project/repl-python-wakatime/#files)
[](https://pypi.org/project/repl-python-wakatime/#files)
[](https://pypi.org/project/repl-python-wakatime/#files)
Python REPL plugin for automatic time tracking and metrics generated from your
programming activity.

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[](https://results.pre-commit.ci/latest/github/wakatime/repl-python-wakatime/main)\n[](https://github.com/wakatime/repl-python-wakatime/actions)\n[](https://codecov.io/gh/wakatime/repl-python-wakatime)\n[](https://repl-python-wakatime.readthedocs.io)\n\n[](https://github.com/wakatime/repl-python-wakatime/releases)\n[](https://github.com/wakatime/repl-python-wakatime/releases/latest)\n[](https://github.com/wakatime/repl-python-wakatime/issues)\n[](https://github.com/wakatime/repl-python-wakatime/issues?q=is%3Aissue+is%3Aclosed)\n[](https://github.com/wakatime/repl-python-wakatime/pulls)\n[](https://github.com/wakatime/repl-python-wakatime/pulls?q=is%3Apr+is%3Aclosed)\n[](https://github.com/wakatime/repl-python-wakatime/discussions)\n[](https://github.com/wakatime/repl-python-wakatime/milestones)\n[](https://github.com/wakatime/repl-python-wakatime/network/members)\n[](https://github.com/wakatime/repl-python-wakatime/stargazers)\n[](https://github.com/wakatime/repl-python-wakatime/watchers)\n[](https://github.com/wakatime/repl-python-wakatime/graphs/contributors)\n[](https://github.com/wakatime/repl-python-wakatime/graphs/commit-activity)\n[](https://github.com/wakatime/repl-python-wakatime/commits)\n[](https://github.com/wakatime/repl-python-wakatime/releases/latest)\n\n[](https://github.com/wakatime/repl-python-wakatime/blob/main/LICENSE)\n[](https://github.com/wakatime/repl-python-wakatime)\n[](https://github.com/wakatime/repl-python-wakatime)\n[](https://github.com/wakatime/repl-python-wakatime)\n[](https://github.com/wakatime/repl-python-wakatime)\n[](https://github.com/wakatime/repl-python-wakatime)\n[](https://github.com/wakatime/repl-python-wakatime)\n\n[](https://pypi.org/project/repl-python-wakatime/#description)\n[](https://pypi.org/project/repl-python-wakatime/#history)\n[](https://pypi.org/project/repl-python-wakatime/#files)\n[](https://pypi.org/project/repl-python-wakatime/#files)\n[](https://pypi.org/project/repl-python-wakatime/#files)\n[](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\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"
}