You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I mentioned I was interested to look at spin in the last scikit-learn developer meeting. One feed-back I got was the worry that it adds another layer of tooling. There is some concern to end-up in a situation where there are too many layers. For example, spin that calls make that calls a shell script, that calls a Python script, etc ...
I looked a bit to see whether there was some built-in spin functionality that would somehow give some visibility into which commands gets run (kind of make --dry-run for example). This would allow to understand a bit more what gets run behind the scenes and potentially do it without spin if needed e.g. to put together a reproducer.
For now what I found is that you can add a verbose flag by command and it is the responsability of the command implementation to put whatever makes sense behind this verbose flag (or even without this verbose flag by the way). The meson commands seems to be quite verbose by default (which is a good thing in this case) and show which commands gets run. If we implement custom commands we will have to do it.
At least for the built-in commands in Meson, we always print what we do behind the scenes, unless it is problematic for the command. E.g., the run command cannot always print to stdout, because you may want to do OUTPUT=$(spin run ...). But otherwise you should see $ shell command each time we execute something.
The purpose is exactly to address your concern: that there is no extra layer of complexity, simply a layer of convenience. You should be able to always just cut and paste commands from the output to do the same job.
If all other forms of understanding what a command does fails, at least the commands are written as pure Python functions, which all our developers can read with ease.
Please let me know if this addresses your concern, or if we can make spin better address it. We want to work with the Scientific Python community to ensure the tool serves their needs.
At least for the built-in commands in Meson, we always print what we do behind the scenes
I noticed the meson output was indeed very helpful.
that there is no extra layer of complexity, simply a layer of convenience.
Sounds a very nice aim indeed!
In this issue, I mostly wanted to make sure that if I implement a custom command, it was my responsibility to implement this kind of helpful logging and that there was not some built-in spin functionality I had missed (like make --dry-run).
I am closing this issue since I think my question has been answered.
+1 to this resolution. For NumPy I think we've not completely implemented the "command echoing" for all the custom commands, but when it's present it is very helpful for discovering all dev functionality and teaching newer contributors.
I should also mention that the spin.util.run command, which we use to implement commands and which we hope custom commands will use too, explicitly echoes by default.
Thanks for the tip about spin.util.run this seems very useful!
About the dry-run thing, this could be useful, but maybe spin.util.run is good enough, and I don't want to ask you to do any work before I look into it more.
I would like to add that the same arguments for making commands transparent likely applies to environment variables that spin sets. Correct me if I'm wrong but I think spin adds to PYTHONPATH to run stuff in build-install. I realize that this might lead to more verbose commands, but I think it's equally important as command line options to understanding what's being run.
Activity
stefanv commentedon Jan 31, 2024
At least for the built-in commands in Meson, we always print what we do behind the scenes, unless it is problematic for the command. E.g., the
runcommand cannot always print to stdout, because you may want to doOUTPUT=$(spin run ...). But otherwise you should see$ shell commandeach time we execute something.The purpose is exactly to address your concern: that there is no extra layer of complexity, simply a layer of convenience. You should be able to always just cut and paste commands from the output to do the same job.
If all other forms of understanding what a command does fails, at least the commands are written as pure Python functions, which all our developers can read with ease.
Please let me know if this addresses your concern, or if we can make spin better address it. We want to work with the Scientific Python community to ensure the tool serves their needs.
lesteve commentedon Jan 31, 2024
Thanks for your answer!
I noticed the meson output was indeed very helpful.
Sounds a very nice aim indeed!
In this issue, I mostly wanted to make sure that if I implement a custom command, it was my responsibility to implement this kind of helpful logging and that there was not some built-in spin functionality I had missed (like
make --dry-run).I am closing this issue since I think my question has been answered.
rgommers commentedon Jan 31, 2024
+1 to this resolution. For NumPy I think we've not completely implemented the "command echoing" for all the custom commands, but when it's present it is very helpful for discovering all dev functionality and teaching newer contributors.
stefanv commentedon Jan 31, 2024
I should also mention that the
spin.util.runcommand, which we use to implement commands and which we hope custom commands will use too, explicitly echoes by default.stefanv commentedon Jan 31, 2024
@lesteve We could quite easily implement dry-run support with a decorator for the (common?) case where
runis the only call with side-effects.lesteve commentedon Jan 31, 2024
Thanks for the tip about
spin.util.runthis seems very useful!About the dry-run thing, this could be useful, but maybe
spin.util.runis good enough, and I don't want to ask you to do any work before I look into it more.stefanv commentedon Jan 31, 2024
Happy to also contribute on a test branch for sklearn, just let me know.
lagru commentedon Feb 5, 2024
I would like to add that the same arguments for making commands transparent likely applies to environment variables that spin sets. Correct me if I'm wrong but I think spin adds to
PYTHONPATHto run stuff inbuild-install. I realize that this might lead to more verbose commands, but I think it's equally important as command line options to understanding what's being run.stefanv commentedon Feb 5, 2024
Right,
spinprints when it sets PYTHONPATH and other variables 👍lagru commentedon Feb 6, 2024
Ah, I missed that. Happy with the way it already works, e.g.
export PYTHONPATH="[...]/build-install/usr/lib/python3.12/site-packages"👍