Similar to the Linux time utility for timing commands. Useful under Windows.
- Similar to the Linux
timeutility 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
- Requires Python 3.5+.
- Install from PyPi:
python -m pip install cmdtime
- Time a Python script
cmdtime python whateverscript.py
- Time anything else
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
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.
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/*
Tests are written to support both Windows and Linux, although this utility is not really needed in Linux.
python -m pip install --upgrade pytest
- Local testing:
- 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 (
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...
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size cmdtime-0.0.4.tar.gz (2.9 kB)||File type Source||Python version None||Upload date||Hashes View|