Skip to content

Visibility into commands being run? #161

Closed

Description

@lesteve

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.

Did I get this roughly correctly?

Activity

  1. stefanv commented on Jan 31, 2024

    @stefanv
    Member

    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.

  2. lesteve commented on Jan 31, 2024

    @lesteve
    ContributorAuthor

    Thanks for your answer!

    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.

  3. rgommers commented on Jan 31, 2024

    @rgommers
    Contributor

    +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.

  4. stefanv commented on Jan 31, 2024

    @stefanv
    Member

    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.

  5. stefanv commented on Jan 31, 2024

    @stefanv
    Member

    @lesteve We could quite easily implement dry-run support with a decorator for the (common?) case where run is the only call with side-effects.

  6. lesteve commented on Jan 31, 2024

    @lesteve
    ContributorAuthor

    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.

  7. stefanv commented on Jan 31, 2024

    @stefanv
    Member

    Happy to also contribute on a test branch for sklearn, just let me know.

  8. lagru commented on Feb 5, 2024

    @lagru
    Member

    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.

  9. stefanv commented on Feb 5, 2024

    @stefanv
    Member

    Right, spin prints when it sets PYTHONPATH and other variables 👍

  10. lagru commented on Feb 6, 2024

    @lagru
    Member

    Ah, I missed that. Happy with the way it already works, e.g. export PYTHONPATH="[...]/build-install/usr/lib/python3.12/site-packages" 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions