Tuesday, 2022-11-22

*** tkajinam is now known as Guest216202:04
*** tkajinam is now known as Guest217403:28
*** tkajinam is now known as Guest217905:36
funginoonedeadpunk: thinking through your options, probably the most reliable and future-proof solution would be to use https://pypi.org/project/build to build a throwaway sdist and grab the resulting metadata from it. doesn't need the osa package installed unlike pip list or pbr freeze17:14
noonedeadpunkwe still want to install osa package for weird reasons, but atm it's like that17:14
noonedeadpunkfrom what I can recall it's needed only for dynamic_inventory that we might want to convert to inventory plugin and ship in collection...17:15
noonedeadpunkwe need to review actually what are we installing and why...17:17
noonedeadpunkit's more matter that pip can're really return info in any script-readable manner17:18
noonedeadpunkso for pip list you need to grep, then awk or cut, ugh17:19
noonedeadpunkand that why we ran setup.py as a script17:22
noonedeadpunkas it returns jsut version and nothing more - same as importlib.metadata.version actually17:23
noonedeadpunkSo I've proposed to replace with importlib.metadata. The only thing I can't recall - what python version CentOS 8 Stream has out of the box....17:24
noonedeadpunkI think we still force 3.8 for that env, so importlib.metadata should be already there17:24
funginoonedeadpunk: pip list --disable-pip-version-check --format=freeze --no-color17:25
fungiif you want versions of everything installed in that environment17:26
fungibut pip list doesn't give you additional pbr metadata, if you're looking for git commit info17:27
fungiinstalling pbr and then running pbr freeze would though17:28
fungibasically with the pip list command above you'll get entries like this:17:29
fungifoo==0.5.2.dev617:30
fungibut with pbr freeze you get this if it's a pbr-using project installed from git:17:30
fungifoo==0.5.2.dev6  # git sha b96d6f717:30
noonedeadpunkfungi: yeah, but again with grep/cut, as I need _only_ version. 17:30
noonedeadpunkso pip list needs also grep | awk....17:31
fungiright, and also you want version info for only one specific project, not all installed projects?17:31
noonedeadpunkyup17:31
noonedeadpunkpython -c "from importlib.metadata import version; print(version('openstack-ansible'))" does exactly what I need17:31
fungifwiw, setup.py --version doesn't return the additional git info from pbr either17:31
noonedeadpunkso did `python setup.py --version` 17:32
fungiand without the project installed, it returns 0.0.0 for me17:32
noonedeadpunkyup, but project is already installed, so it's good17:33
noonedeadpunk(for now)17:33
noonedeadpunkso thanks)17:33
noonedeadpunkbasically what setup.py --version now returns - https://paste.openstack.org/show/bpAgLDKpkVnrVcfeH5P9/17:34
noonedeadpunkwhich is unfortunate17:34
noonedeadpunkanyway importlib.metadata should just work for us even given backport to Yoga. Thankfully, setuptools are constrained on Xena...17:36
fungipython3 -c 'import importlib.metadata;print(importlib.metadata.distribution("openstack-ansible").version)'17:37
funginoonedeadpunk: ^ that seems to work on 3.8 for me as long as openstack-ansible is installed17:37
noonedeadpunk`python -c "from importlib.metadata import version; print(version('openstack-ansible'))"` worked for me on 3.8 and 3.1017:38
noonedeadpunkso yeah17:39
noonedeadpunkI'm not sure what's the difference between these 217:39
noonedeadpunkAs result seems the same....17:40
fungiyeah, both ways seem to work for me all the way up to python 3.12.0a217:41
noonedeadpunkbut yeah, I've already has stolen enough of your time and this solution is good enough and already proposed https://review.opendev.org/c/openstack/openstack-ansible/+/86516617:41
fungistarting from 3.8 of course (not on 3.7)17:41
fungicool. happy to have helped!17:41
noonedeadpunkI don't think 3.7 is in PTI for Yoga.... But indeed backporting that to X is not an option...17:41
noonedeadpunkThankully it's not needed as setuptools is in u-c so...17:42
noonedeadpunkX not affected17:42

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!