version_string() and semantic_version() etc is slow
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PBR |
New
|
Undecided
|
Unassigned |
Bug Description
Problem
^^^^^^^
If a particular package is *not* installed (with pip) just cloned, the version_string() (and similar methods) are really slow.
Reproduce:
^^^^^^^^^^
Choose an arbitrary python package, which uses pbr. I tested with scrapd and wexpect.
Type following commands into Windows' cmd:
```console
mkdir slow_pbr
cd slow_pbr
python -m virtualenv slow_pbr_virtualenv
slow_pbr_
git clone https:/
cd scrapd
python -m pip install -r requirements.txt
python
# The following commands are python commands:
import scrapd
from pbr.version import VersionInfo
a = VersionInfo(
a.version_string() # <--- This command is really slow. It takes several secs.
```
Here is my full transcript:
```console
Microsoft Windows [Version 10.0.18363.657]
(c) 2019 Microsoft Corporation. All rights reserved.
C:\Users\usr>mkdir slow_pbr
C:\Users\usr>cd slow_pbr
C:\Users\
Using base prefix 'C:\\Program Files\\Python37'
New python executable in C:\Users\
Installing setuptools, pip, wheel...
done.
C:\Users\
(slow_pbr_
Cloning into 'scrapd'...
remote: Enumerating objects: 190, done.
remote: Counting objects: 100% (190/190), done.
remote: Compressing objects: 100% (89/89), done.
remote: Total 1927 (delta 119), reused 139 (delta 95), pack-reused 1737
Receiving objects: 100% (1927/1927), 905.79 KiB | 2.58 MiB/s, done.
Resolving deltas: 100% (1278/1278), done.
(slow_pbr_
Collecting aiohttp==3.6.1
Downloading aiohttp-
|█
Collecting beautifulsoup4=
Downloading beautifulsoup4-
|█
Collecting click==7.0
Using cached Click-7.
Collecting dateparser==0.7.2
Downloading dateparser-
|█
Collecting loguru==0.3.2
Downloading loguru-
|█
Collecting pbr>=5.2.0
Using cached pbr-5.4.
Collecting pydantic==0.32.2
Downloading pydantic-
|█
Collecting tenacity==5.1.1
Downloading tenacity-
Collecting async-timeout<
Downloading async_timeout-
Collecting yarl<2.0,>=1.0
Downloading yarl-1.
|█
Collecting attrs>=17.3.0
Downloading attrs-19.
Collecting chardet<4.0,>=2.0
Using cached chardet-
Collecting multidict<5.0,>=4.5
Downloading multidict-
|█
Collecting soupsieve>=1.2
Downloading soupsieve-
Collecting regex
Downloading regex-2020.
|█
Collecting tzlocal
Downloading tzlocal-
Collecting python-dateutil
Downloading python_
|█
Collecting pytz
Using cached pytz-2019.
Collecting colorama>=0.3.4; sys_platform == "win32"
Using cached colorama-
Collecting win32-setctime>
Downloading win32_setctime-
Collecting six>=1.9.0
Using cached six-1.14.
Collecting idna>=2.0
Downloading idna-2.
|█
Installing collected packages: async-timeout, idna, multidict, yarl, attrs, chardet, aiohttp, soupsieve, beautifulsoup4, click, regex, pytz, tzlocal, six, python-dateutil, dateparser, colorama, win32-setctime, loguru, pbr, pydantic, tenacity
Successfully installed aiohttp-3.6.1 async-timeout-3.0.1 attrs-19.3.0 beautifulsoup4-
(slow_pbr_
(slow_pbr_
Python 3.7.5 (tags/v3.
Type "help", "copyright", "credits" or "license" for more information.
>>> import scarpd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundE
>>> import scrapd
>>> from pbr.version import VersionInfo
>>> a =VersionInfo(
>>> a.version_string()
'3.0.5'
```
I use:
^^^^^^
- Win 10.0.18363 Build 18363
- Python 3.7.5
- pbr 5.4.4