Skip to main content

Similar to the Linux time utility for timing commands. Useful under Windows.

Project description

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...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmdtime-0.0.4.tar.gz (2.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page