diff --git a/CHANGELOG.md b/CHANGELOG.md index be70c1d..a028290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +Version 2.9.7 +================ +- requirements.txt for `psutil`, now supports `pip install pyprind -r requirements.txt` + + Version 2.9.5 ================ - new `update_interval` parameter to control the update frequency in seconds diff --git a/MANIFEST.in b/MANIFEST.in index 8475759..c5d2188 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,5 @@ include LICENSE include README.md include CONTRIBUTING.md include CHANGELOG.md +include requirements.txt include tests/* diff --git a/pyprind/__init__.py b/pyprind/__init__.py index 992a530..7970fcb 100644 --- a/pyprind/__init__.py +++ b/pyprind/__init__.py @@ -17,4 +17,4 @@ from .generator_factory import prog_bar -__version__ = '2.9.5' +__version__ = '2.9.7' diff --git a/pyprind/prog_class.py b/pyprind/prog_class.py index 3f00650..f2a023e 100644 --- a/pyprind/prog_class.py +++ b/pyprind/prog_class.py @@ -124,13 +124,13 @@ def _get_time(self, _time): if (_time < 86400): return time.strftime("%H:%M:%S", time.gmtime(_time)) else: - s = (str(int(_time//3600)) + ':' + + s = (str(int(_time // 3600)) + ':' + time.strftime("%M:%S", time.gmtime(_time))) return s def _finish(self): """ Determines if maximum number of iterations (seed) is reached. """ - if self.cnt == self.max_iter: + if self.cnt >= self.max_iter: self.total_time = self._elapsed() self.end = time.time() self.last_progress -= 1 # to force a refreshed _print() @@ -168,9 +168,10 @@ def __repr__(self): time_info = 'Title: {}\n'\ ' Started: {}\n'\ ' Finished: {}\n'\ - ' Total time elapsed: '.format( - self.title, str_start, - str_end) + self._get_time(self.total_time) + ' Total time elapsed: '.format(self.title, + str_start, + str_end)\ + + self._get_time(self.total_time) if self.monitor: try: cpu_total = self.process.cpu_percent() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ed9e437 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +psutil>=3.2.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 9ffe238..ebdee00 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,7 @@ packages=find_packages(), package_data={'': ['LICENSE', 'README.md', + 'requirements.txt', 'CHANGELOG.md', 'CONTRIBUTING.md'], 'tests': ['tests/test_percentage_indicator.py',