https://github.com/wakatime/repl-python-wakatime
Python REPL plugin for automatic time tracking and metrics generated from your programming activity.
https://github.com/wakatime/repl-python-wakatime
ipython plugin ptpython python wakatime
Last synced: 14 days ago
JSON representation
Python REPL plugin for automatic time tracking and metrics generated from your programming activity.
- Host: GitHub
- URL: https://github.com/wakatime/repl-python-wakatime
- Owner: wakatime
- License: gpl-3.0
- Created: 2023-01-11T19:54:13.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-07T17:30:51.000Z (16 days ago)
- Last Synced: 2025-04-07T18:38:16.813Z (16 days ago)
- Topics: ipython, plugin, ptpython, python, wakatime
- Language: Python
- Homepage: https://repl-python-wakatime.readthedocs.io/
- Size: 96.7 KB
- Stars: 8
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# 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_hookinstall_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_hookdef 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_hookinstall_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_hookinstall_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)