Thursday, 2023-11-09

opendevreviewmelanie witt proposed openstack/devstack master: DNM testing  https://review.opendev.org/c/openstack/devstack/+/90026200:50
stephenfinclarkb: fungi: Giving  the increasing cadence of packaging related changes in the Python ecosystem, at what point do we think about migrating OpenStack to one of the other installers that has widespread adoption?10:36
fricklerstephenfin: given that the current situation seems to still be broken, IMO "now" would be a sensible answer11:07
opendevreviewLuigi Dino Tamagnone proposed openstack/tempest master: Adding a new config option in tempest.conf as the prefix for the random name resources  https://review.opendev.org/c/openstack/tempest/+/89723111:33
fungistephenfin: frickler: i'm not sure what you mean by installer, the installer with the widest adoption is pip, then probably conda, followed by distribution package managers13:46
fungiif you mean build backend, the build backend with the widest adoption is still setuptools, by far13:47
fungiif you mean migrating to a new build backend that lots of people talk about even if it's not as widely used, i don't know that any of them solve wsgi scripts in editable mode, that would require some vetting and someone putting together a poc i think13:49
sean-k-mooneyfungi: the installation of the package scripts is doen by pip not the backend14:35
sean-k-mooneyfungi: what i was chatting to stephenfin about this morning is just goign to setuptools_scm and removing our use of the wsgi_scripts extenion by adding console_scripts and wsigi files in each repo14:36
sean-k-mooneyfungi: effectivly limiting oursele to the funcitonlity purly form setuptools14:37
sean-k-mooneywe could looke at alreternives too14:37
sean-k-mooneybut at this point this is much larger then "just make centos work in a venv"14:38
fungisean-k-mooney: yes, that's why i said stephenfin's question was confusing, we already use the most popular installer (pip). keep in mind that pbr currently does more than just version number calculation, so we would either need to find alternative plugins for those other features too (or stop relying on them)14:43
stephenfinYup, my question was poorly put. A better question would be should we investigate using alternative build backends and migrating OpenStack away from pbr14:44
fungialso erplacing pbr would have non-negligible impact on downstream consumers of our projects, particularly distribution package maintainers, who may be relying on pbr-specific means of performing version injection and the like14:44
fungii'm not opposed to it, just wary that it may be more work than people realize14:45
stephenfinwhich would involve figuring out what pbr does and what the equivalent functionality, in any, is in other build backends14:45
sean-k-mooneyfungi: the problem is without doign somithign like have installer invoke "pbr install_scripts" or similar14:48
fungithe main ones i'm aware we rely on are authors and changelog file generation. also the last time i looked, setuptools-scm doesn't version things the same way pbr does, lacks support for the semver hinting some projects put in their commit messages, and doesn't separately embed commit id metadata14:48
sean-k-mooneyim not sure how we can reconsile editbale installes with pyproject.toml and everything that impleis14:48
sean-k-mooneyfungi: ya so that si also partly why stephenfin was suggestign if we stayed with pbr for all that goodness14:49
fungion a more philosophical level, i consider "editable" installation to be a terrible idea, and it's unfortunate that we rely so heavily on it14:49
sean-k-mooneywe might need to implemnte our own suprrrot for pep 66014:49
sean-k-mooneyfungi: without it i dont see how devstack could continue to be useful14:50
sean-k-mooneyfundementaly to me editabel installs are what make that tool useful14:50
fungidevstack would just need a "commit phase" where edits are reinstalled into its venvs (also devstack should be using venvs)14:50
sean-k-mooneywell it is using venvs now14:50
fungioh, that got implemented finally?14:51
sean-k-mooneyand no i mean as a use fo devstack if i need to do more then just restart the systemd service 14:51
sean-k-mooneythat is a deal breakre for me14:51
sean-k-mooneyfungi: yep for debian based distors14:51
sean-k-mooneyfungi: that what started this it does not work for centos9stream/rhel and presumable fedora14:51
fungiwhat if the service restart reran pip install? pip caches just about everything so that shouldn't be all that slow14:52
sean-k-mooneyfungi: that woudl be less discrtive to the workflow so we added a prestart service entry to do pip install then sure14:52
fungianyway, i haven't caught up on e-mail yet this morning, so i suspect i'm missing context on why the pep 660 support isn't working14:53
sean-k-mooneyto me the public interface for "get new code to work" is systemctl restart devstack@*14:53
fungiguess i'll switch to catching up on e-mail14:53
sean-k-mooneyfungi: simple answer is pep 660 support is working but pep-660 is for pure libs and explcit does not cover datafiles or scripts14:53
sean-k-mooneyfungi: they did nto provide a standardise way to support scrtips other then console_scripts or gui_scripts14:54
fungioh, well sure, python packaging isn't "supposed" to cover any of that, according to the people writing the specifications14:54
sean-k-mooneyfungi: so this is why its not a problem with the build system14:54
fungiagain, i don't think replacing pbr will solve that, the standards authors have intentionally said it's out of scope14:54
sean-k-mooneyits a probelm with the installer i.e. pip14:54
sean-k-mooneythe changed the interface form "setup.py devleop" to importing setup tools and invokeing moduels14:55
sean-k-mooneywithout provideing any hookpoint we can overload14:55
fungithe official answer from the python packaging community is that if you need to install anything that isn't a basic library, use a different packaging solution. wheels/sdists pyproject.yaml and pip target library use cases. application use cases are poorly served by them14:56
sean-k-mooneyyep thats the crux of the issue14:57
sean-k-mooneyopenstack is a set of applciations and libs14:57
fungithey basically don't want to have anything to do with files that need to be installed outside the module path14:57
sean-k-mooneyso we can solve the wsgi_script issue by ebeding the wsgi_script in the lib and just installing it as a console_script14:57
fricklermaybe devstack could place the pip install into the systemd service definition if doing that separately is what bothers you?14:58
fungiso from that perspective, yes we could for example switch to conda which does support installing more than just libraries14:58
sean-k-mooneyfrickler: it would have to yes14:58
sean-k-mooneyfrickler: editabel installs are a fundemental part of how devstack works14:58
sean-k-mooneyprovided we can keep the edit and continue workflow workign without reqiuring you to run pip install -c </path/to/constriats> <my repo>14:59
sean-k-mooneythat woudl be ok15:00
fricklersean-k-mooney: well ... yes and no, you still need to know which service to restart ... and if you know to do that, one could also argue you know which pip install to run15:00
fricklerand 99% of devstack is running in CI, where that does not matter15:00
sean-k-mooneyfrickler: supporting editbale installs for this usecase was one of the requirement for proceeding with global_venv15:01
fricklerbut if it turns out that they are infeasible, maybe some alternative approach can be found15:01
sean-k-mooneythe alternitive would be to revert the global_env i supprot for most peopel15:02
fricklerlike create an update.sh script that finds changed repos, does pip reinstalls and service restarts15:02
sean-k-mooneyno because you dont nessiarly want to restart all services15:02
sean-k-mooneyi would be fine with just doing the pip install in a pre_start action in the systemd unit15:03
sean-k-mooneythen we can use non editbael installs and keep the gloabl_venv15:03
sean-k-mooneyif peopel didn not hate that idea i could try creating a patch for that15:03
sean-k-mooneyif we do that we dont need to do any of the pyproject.toml stuff either although we still can15:04
fricklerI thought that that was still needed for future compatibility?15:06
fungikeep in mind that pep 660 was sort of created under duress, the python packaging community mostly considers editable installs an ugly hack and an unfortunate misfeature that they're now stuck figuring out how to support going forward15:06
fungias such, relying on editable installs is likely to become increasingly painful regardless of what solution we do or don't adopt15:07
stephenfinDo we know for sure that wsgi scripts will continue to work for non-editable installs also?15:12
stephenfinI mean, we're hitting it with editable installs but that's likely because we're going down wholly new codepaths where distutils is not a thing. Won't the non-editable codepaths also change before long, given distutils is gone in 3.12?15:12
fungiwell, distutils isn't gone, it has moved into setuptools15:15
fungiot15:15
fungiit's just no longer in the stdlib15:15
stephenfinNot yet, fwict. I don't see distutils vendored into the main branch, though I do see a feature/distutils-sync branch15:17
fungipretty sure it's been in there for a while. there's even been a switch to tell setuptools not to use its embedded version of distutils15:17
fungiwhich we had to turn on at one point, if memory serves15:18
stephenfinAh, indeed. It's 'setuptools/_distutils'. Apologies15:18
stephenfinAre you aware whether the setuptools maintainers have indicated when, if ever, they'll remove support for the 'install' command?15:19
fungii haven't seen any discussion of timelines for that, no15:20
stephenfinack15:21
fungistephenfin: pfmoore replied to your d.p.o post asking why we'd changed our minds about just overloading console_scripts and pointing wsgi to those. did we run into a fundamental problem trying that approach?15:31
clarkbfwiw you could also have uwsgi invoke scripts out of the library path and not do anything special right?15:48
clarkbconsole_scripts are special because we want things to end up in users' PATH entries15:48
sean-k-mooneythe scripts are not generated now15:49
clarkbbut uwsgi doesn't really care about that we feed it a file path15:49
sean-k-mooneyclarkb: the issue is we dont have scripts for wsgi in nova15:49
sean-k-mooneywe use pbr to generate it15:49
sean-k-mooneyso in the ediabel case there is nothing in the lib path to execute15:50
clarkbright so whether or not you write out those files instead of generating them is a bit orthogonal to PBR15:50
clarkbjust add the file to nova, then it ends up in the nova install path and uwsgi loads that directly15:50
clarkbthat is independent of the build backend15:50
sean-k-mooneyyep we could15:50
sean-k-mooneythats why we were wondieinf if we shoudl stop using wsgi_scripts and do that15:50
sean-k-mooneythen that leed to the question what else do we need pbr to do15:51
sean-k-mooneyadn is it doing it properly now15:51
clarkbI think fungi listed those. Mostly the versioning stuff15:52
sean-k-mooneyyep15:53
sean-k-mooneyso i think we have a few paths forward15:53
sean-k-mooneyfirst we can propse moving the wsgi script to files in teh repos15:53
sean-k-mooneysecond we can make devestack to pip install on start of the sytemd service15:54
sean-k-mooneythid we can proceed with pyproject.toml using pbr15:54
kopecmartindoes anyone know if there is a way how to get/generate OpenAPI/swagger definition of the Openstack API? I found only this abandoned patch: https://review.opendev.org/c/openstack/api-site/+/28665917:04
kopecmartingmann maybe? ^ 17:04
clarkbkopecmartin: gtema has emails about it on the openstack-discuss list17:05
* kopecmartin is gonna check17:05
kopecmartinthanks clarkb17:05
stephenfinclarkb: the console scripts stuff generates a files with an if __name__ == '__main__' block, inside which you've a call to whatever callable you pointed at from you build config file17:37
stephenfinWe need a file that has an 'application' callable inside it, not wrapped in '__main__'17:37
clarkbstephenfin: yes and then writes that into the bin/ dir associated with teh current environment iirc17:37
stephenfinyup17:37
clarkbthe idea being you can isntall python commands easily17:37
stephenfinindeed17:37
clarkb(and in PBRs case it overrides the default implementation becuse the default is slow)17:38
clarkbI guess I was trying to say for an application callable you don't need it in your PATH or a bin/ dir17:38
clarkbso you can just have the file install like any other file into the library path and have uwsgi call into that17:38
stephenfinright, but it appears at some point we will no longer have the mechanism to place arbitrary files into the library path from setuptools17:39
stephenfinand that this is already the case if using the pep-660 editable wheel stuff17:39
clarkbonyl if you are autogenerating them at package build time17:39
clarkbif they already exist on disk (autogenerated and committed to git for example) then that should be reliable over time17:40
clarkbotherwise setuptools would stop installing anything17:40
clarkbanother option would be to supply it externally. I just checked our django mailman3 setup and that is what they do17:40
clarkbthat seems far more error prone for users though17:41
stephenfinYou sure? What's the mechanism for that? If we had e.g. an bin/nova-api-wsgi script in nova, how does one indicate that in setup.cfg / pyproject.toml 17:41
stephenfinHistorically you could use the distutils 'scripts' option but that's not supported by PEP-62117:42
clarkbstephenfin: pbr (and setuptools_scm) install all the things checked into git by default. I don't know what the end result path would be for that specific bin prefiex17:42
clarkbbut it doesn't have to be a script it could be nova/wsgi/wsgi.py then your wsgi application would be in venv/lib/python3.10/site_packages/nova/wsgi/wsgi.py or whatever the end result is17:42
stephenfinare we talking about separate things? I suspect you're talking about libraries installed into /lib rather than executables installed in /bin17:43
stephenfin?17:43
clarkbcorrect becuase you don't need the wsgi application glue code to be in bin/17:43
stephenfinat the moment we (and most deployment tooling) is expecting an executable17:43
stephenfinabsolutely, but all our deployment tooling is using that17:43
stephenfinat least based on a codesearch.o.o. search for nova-api-wsgi17:44
clarkbright it would require the deployment tooling to update their uwsgi.ini to point at the new location17:44
clarkbI'm not saying it is a drop in replacement. I'm saying its a replacement that would be viable with changes to setuptools over time17:44
stephenfinright, we're on the same page now17:44
stephenfinso what we're saying is it's likely that pbr will need to lose this functionality17:45
stephenfinunless we fancy reimplementing swathes of pbr-specific code to support this17:45
clarkbif we treat editable installs as a top tier feature I guess (goes back to fungi indicating that seems to be where a lot of the upstream contention is)17:45
stephenfinrepeating what I said to fungi earlier17:46
stephenfinDo we know for sure that wsgi scripts will continue to work for non-editable installs also?17:46
stephenfinI mean, we're hitting it with editable installs but that's likely because we're going down wholly new codepaths where distutils is not a thing. Won't the non-editable codepaths also change before long, given distutils is gone in 3.12?17:46
clarkbI haven't tested it myself, but supposedly those hooks still exist?17:46
stephenfinfungi corrected me that distutils is being vendored by setuptools now 17:46
clarkbthe specific problem here is they redid how editable installs work and this is fallout from that17:47
clarkbI guess setuptools could stop vendoring distutils17:47
stephenfinbut given the deprecation warnings on the install command stuff, I suspect that will disappear from setuptools before too long also17:47
stephenfinit seems clear they want to simplify it and make it easier to maintain, which is understandable (though obviously a pain for us)17:47
clarkbin theory you can use pyproject.toml to pin setuptools until you end up on a python interpreter that can't run that code. Which seeing how things have gone would probably be 3.13 :)17:49
clarkbas far as porting to setuptools_scm goes I think it could be made to work. Its not straightforward even for trivial problems (ssbarnea converted some project and it took like 3 releases to get it working right)17:50
clarkbs/problems/projects/17:50
clarkbThe main thing would be acceptance of lost functionality and acceptance of following the upstream direction (whcih we already largely have to do)17:51
fungiclarkb: stephenfin: wheels can still contain non-python files, for example i use pbr as a pep-517 build backend and put sample configuration for test fixtures in the wheel so that running tests from a wheeled installation still works17:51
clarkbanother approach would be to use peotry17:51
clarkbI think poetry has its own builder with a lot of rich functionality that pypa intentionally avoids17:51
stephenfinfungi: where does it place those files?17:54
stephenfinonce installed in a venv, for example17:54
clarkbunfortunately I suspect whichever path we take we'll find something changes direction and forces us to go through a similar process again. Thats kinda how we ended up with pbr in the first place because distutils2 got killed and then setuptools implemented big chunks of it that made it into PBR later after telling us that PBR was a mistake but they made sure to do it17:55
clarkbdifferntly...17:55
fungistephenfin: relative to the path in the wheel itself. wheels just get unpacked in-place17:57
fungimyvenv/lib/pythonX.Y/site-packages/mypackage/tests/fixtures/testconfig.yaml17:58
stephenfinGotcha. Per above discussion with clarkb though, /lib is not /bin and all installers are currently expecting WSGI scripts placed /bin18:04
stephenfin*placed in /bin18:04
*** tosky_ is now known as tosky18:43
sean-k-mooneyim finisinsh not but just to recap i cna confirm that for non editiabel installs the weehsl end up with the wsgi script in a scripts folder at teh root of the wheel19:21
sean-k-mooney adding 'nova-28.1.0.dev39.data/scripts/nova-api-wsgi'19:24
sean-k-mooneythose cscipt get put in /bin in the venv19:26
sean-k-mooneyit is only in thge bin dir19:27
sean-k-mooney[19:25:19]??? find .venv-test/ -name nova-metadata-wsgi19:28
sean-k-mooney.venv-test/bin/nova-metadata-wsgi19:28
sean-k-mooneywhat we likely could try to do19:28
sean-k-mooneyis put the generated script in the editabel wheel in the same way19:28
sean-k-mooneyi.e try to explicty wrihte to  nova-28.1.0.dev39.data/scripts/19:29
sean-k-mooneyform the build_editiable hook19:29
sean-k-mooneyin pbr19:29
sean-k-mooneyspecifically here https://github.com/openstack/pbr/blob/master/pbr/build.py#L82-L9219:30
sean-k-mooneyi am on pto tomorrow but  i might try hacking this to at least see if that works.19:33
sean-k-mooneythis is using https://peps.python.org/pep-0491/#the-data-directory19:46
sean-k-mooneybased on https://peps.python.org/pep-0491/#recommended-installer-features19:48
sean-k-mooneyinstallers shoudl also implemnnt #!python rewrites for any script in {distribution}-{version}.data/scripts/19:49
sean-k-mooneymenaing pip shoudl rewrite the #! line to the correct one for the venv for us19:49
sean-k-mooneythese sepcific feature were aslo suported in wheel format 1.0 https://peps.python.org/pep-0427/19:51
sean-k-mooneyclarkb: fungi  frickler  is we just modify the editable wheel and append the wsgi_scripts into it like that and follow the wheel spec i think that will support our current usecases 19:53
fungisounds worth a try, thanks for lookig into it (again)!19:54
sean-k-mooneyat the very least i want to see fi we cna ease the transition path20:03
sean-k-mooneyregardelss fo what we end up doing20:03

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