Display elapsed time on Jupyter.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jupyter-autotime-1.1.0.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for jupyter_autotime-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b657f83af43f7f5fb11eefeaf9675c0d1a756c87260f2972f3ea2103bf42a6cd |
|
MD5 | 76c47a8f3974d0b6105e220cc6ccd2b1 |
|
BLAKE2b-256 | 00d4e092493a2326c9c780315f6e3f9e9cfb238386565d3ff919e59567ff93c2 |