*** tkajinam is now known as Guest2162 | 02:04 | |
*** tkajinam is now known as Guest2174 | 03:28 | |
*** tkajinam is now known as Guest2179 | 05:36 | |
fungi | noonedeadpunk: 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 freeze | 17:14 |
---|---|---|
noonedeadpunk | we still want to install osa package for weird reasons, but atm it's like that | 17:14 |
noonedeadpunk | from 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 |
noonedeadpunk | we need to review actually what are we installing and why... | 17:17 |
noonedeadpunk | it's more matter that pip can're really return info in any script-readable manner | 17:18 |
noonedeadpunk | so for pip list you need to grep, then awk or cut, ugh | 17:19 |
noonedeadpunk | and that why we ran setup.py as a script | 17:22 |
noonedeadpunk | as it returns jsut version and nothing more - same as importlib.metadata.version actually | 17:23 |
noonedeadpunk | So 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 |
noonedeadpunk | I think we still force 3.8 for that env, so importlib.metadata should be already there | 17:24 |
fungi | noonedeadpunk: pip list --disable-pip-version-check --format=freeze --no-color | 17:25 |
fungi | if you want versions of everything installed in that environment | 17:26 |
fungi | but pip list doesn't give you additional pbr metadata, if you're looking for git commit info | 17:27 |
fungi | installing pbr and then running pbr freeze would though | 17:28 |
fungi | basically with the pip list command above you'll get entries like this: | 17:29 |
fungi | foo==0.5.2.dev6 | 17:30 |
fungi | but with pbr freeze you get this if it's a pbr-using project installed from git: | 17:30 |
fungi | foo==0.5.2.dev6 # git sha b96d6f7 | 17:30 |
noonedeadpunk | fungi: yeah, but again with grep/cut, as I need _only_ version. | 17:30 |
noonedeadpunk | so pip list needs also grep | awk.... | 17:31 |
fungi | right, and also you want version info for only one specific project, not all installed projects? | 17:31 |
noonedeadpunk | yup | 17:31 |
noonedeadpunk | python -c "from importlib.metadata import version; print(version('openstack-ansible'))" does exactly what I need | 17:31 |
fungi | fwiw, setup.py --version doesn't return the additional git info from pbr either | 17:31 |
noonedeadpunk | so did `python setup.py --version` | 17:32 |
fungi | and without the project installed, it returns 0.0.0 for me | 17:32 |
noonedeadpunk | yup, but project is already installed, so it's good | 17:33 |
noonedeadpunk | (for now) | 17:33 |
noonedeadpunk | so thanks) | 17:33 |
noonedeadpunk | basically what setup.py --version now returns - https://paste.openstack.org/show/bpAgLDKpkVnrVcfeH5P9/ | 17:34 |
noonedeadpunk | which is unfortunate | 17:34 |
noonedeadpunk | anyway importlib.metadata should just work for us even given backport to Yoga. Thankfully, setuptools are constrained on Xena... | 17:36 |
fungi | python3 -c 'import importlib.metadata;print(importlib.metadata.distribution("openstack-ansible").version)' | 17:37 |
fungi | noonedeadpunk: ^ that seems to work on 3.8 for me as long as openstack-ansible is installed | 17:37 |
noonedeadpunk | `python -c "from importlib.metadata import version; print(version('openstack-ansible'))"` worked for me on 3.8 and 3.10 | 17:38 |
noonedeadpunk | so yeah | 17:39 |
noonedeadpunk | I'm not sure what's the difference between these 2 | 17:39 |
noonedeadpunk | As result seems the same.... | 17:40 |
fungi | yeah, both ways seem to work for me all the way up to python 3.12.0a2 | 17:41 |
noonedeadpunk | but 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/+/865166 | 17:41 |
fungi | starting from 3.8 of course (not on 3.7) | 17:41 |
fungi | cool. happy to have helped! | 17:41 |
noonedeadpunk | I don't think 3.7 is in PTI for Yoga.... But indeed backporting that to X is not an option... | 17:41 |
noonedeadpunk | Thankully it's not needed as setuptools is in u-c so... | 17:42 |
noonedeadpunk | X not affected | 17:42 |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!