Thanks for all the responses on this. In short - yes this does the job. I should really write it in Guile: guix refresh –list-transitive my-pkg | cut -d':' -f2 | tr ' ' '\n' | grep python | sort
I have a guix package that had originally been deployed with a python requirements file to create a venv. I was curious to see that, if I matched the versions in the requirements file, in my guix package what the full set of dependent python packages would be (i.e. those returned by pip freeze). Obviously there are some mismatched because pip often only gives requirements as a lower bound, where any given version of guix will typically only contain a single current version of a package. The specific weirdness I was looking at was my guix setup seemed to have installed both tornado5 and tornado6 python packages packages - a situation that can't happen in pip! I was toying with writing a pkg2reqs.scm which would produce a python requirements file from a Guix package. I found it particularly useful to create this manually when trying to decide if my move to Guix had issues due to a slight version mismatch between PyPi and Guix, or something else.