jupyter-autotime
Display elapsed time on Jupyter.
Getting start
-
Install
-
On shell.
pip install jupyter-autotime
-
On Jupyter.
!pip install jupyter-autotime
-
-
Enable autotime
%load_ext autotime
Other usage
# Reload.
%reload_ext autotime
# Disable.
%unload_ext autotime
Customization
-
First, import the module to hack
autotime.import autotime
-
Customize timespan format.
def my_format_timepan(timespan: float) -> str): """My custom timespan format.""" # e.g. '12 sec' return '{} sec'.format(int(timespan)) autotime.format_timespan = my_format_timepan
-
Customize time format.
# e.g. '2020/12/10 16:15:11' autotime.TIME_FORMAT = '%Y/%m/%d %H:%M:%S'
-
Customize output format.
# e.g. '[RUNNING] 3.09 s (2020-12-10T15:58:35)' autotime.RUNNING_FORMAT = '[RUNNING] {timespan} ({start})' # e.g. '[FINISH] 4.02 s (2020-12-10T15:59:54~2020-12-10T15:59:58)' autotime.FINISHED_FORMAT = '[FINISH] {timespan} ({start}~{end})'
-
Customize units.
# e.g. 5 分 7 秒 autotime.set_units(sec='秒', min='分', hr='時間', d='日')
-
Customize output with method.
def my_format_output(timespan: float, start_time: time.struct_time, end_time: float = None, is_finished: bool = False): """My Custom output format.""" if is_finished: # e.g. 'Finished. 2.0160000000032596' return 'Finished. {}'.format(timespan) else: # e.g. 'Running... 1.0159999999887077' return 'Running... {}'.format(timespan) autotime.format_output = my_format_output
- You can access below objects on custom
format_output.autotime.UNITS (dict)autotime.format_time (method)autotime.TIME_FORMAT (str)autotime.RUNNING_FORMAT (str)autotime.FINISHED_FORMAT (str)
- You can access below objects on custom
Development
- Requirements: poetry, pyenv
poetry install
poetry publish
pip install --no-cache-dir --upgrade jupyter-autotime
Metadata
Release files for jupyter-autotime 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jupyter-autotime-1.1.0.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jupyter_autotime-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / jupyter-autotime-1.1.0.tar.gz
| Download URL | jupyter-autotime-1.1.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cfdccf0419fe6b9a374f8a4ae03f1479e6f8f9145a56da0e3fc083ec9c1f21d
|
|
BLAKE2b-256 checksum How to use checksums |
444d62dbd00f1080d357a032f9f39b6a689090a33db739e306cff39f47fbc3d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.6.8 Windows/10
|
Release files / jupyter_autotime-1.1.0-py3-none-any.whl
| Download URL | jupyter_autotime-1.1.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b657f83af43f7f5fb11eefeaf9675c0d1a756c87260f2972f3ea2103bf42a6cd
|
|
BLAKE2b-256 checksum How to use checksums |
00d4e092493a2326c9c780315f6e3f9e9cfb238386565d3ff919e59567ff93c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.10 CPython/3.6.8 Windows/10
|