Skip to main content

Build Status

cmdtime

  • Similar to the Linux time utility for measuring how long a command takes to run
  • Useful for the Windows Command Prompt
  • Uses pure Python
  • No point using this under Linux
  • No need to install Cygwin

Installation

  • Requires Python 3.5+.
  • Install from PyPi:
python -m pip install cmdtime

Usage Examples

  • Time a Python script
cmdtime python whateverscript.py
  • Time anything else
cmdtime dir

Notes

For some machine learning projects, I use the Windows command prompt to execute scripts. I use Windows so that Tensorflow can access my PC's NVIDIA GPU. (Unfortunately, using Linux under VirtualBox can't access GPUs.)

In addition, there is no built-in equivalent of the Linux time utility in the Windows 10 command prompt. Yes, there are other options such as those discussed here and here. But they either require installing old binaries that I'd rather avoid, or involve more cumbersome approaches. I wanted something where I can just prefix the command I want to run similar to the Linux time utility.

Hence the creation of this really trivial but useful Linux time-like utility which I'm calling cmdtime. And it's pure Python.

Probably someone else has already created such a utility under PyPi, but I couldn't find it.

Developer Notes

python setup.py sdist
python -m pip install --editable .
  • Push to TestPyPI
python -m twine upload --repository testpypi dist/*
  • Push to PyPI
python -m twine upload dist/*

Testing Notes

Tests are written to support both Windows and Linux, although this utility is not really needed in Linux.

  • Install pytest:
python -m pip install --upgrade pytest
  • Local testing:
pytest -v
  • Travis CI:
    • Right now, Travis CI doesn't support Python on Windows, so this can only be tested on Linux.
    • The tests only work on Python 3.7 or later as the subprocess.run() had significant changes in parameters (capture_output, text) not available in earlier versions. While it's possible to create version-specific test code to be compatible with earlier versions, it's not worth the effort...

Metadata

Release files for cmdtime 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmdtime 0.0.4
File Size Uploaded
cmdtime-0.0.4.tar.gz 2.9 kB Details

Release files / cmdtime-0.0.4.tar.gz

Download URL cmdtime-0.0.4.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
dc6ac174f7b4ce0ed49ba1470cd512ba3042ab5152acbaa1aa8e5f2e21cad93a
BLAKE2b-256 checksum
How to use checksums
def5059c36e983caf8b5a0f1625ec4d2e56abbb8d2b498a5634ce2155b582597
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.4 This release

1 release file

0.0.3

1 release file

0.0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page