Skip to content

Would a py_interactive rule be useful to include? #3090

Open
@jpwoodbu

Description

@jpwoodbu

🚀 feature request

This is a request to get thoughts on contributing https://github.com/jpwoodbu/rules_python_interactive to rules_python.

Relevant Rules

Perhaps py_binary and py_library?

Description

I have made https://github.com/jpwoodbu/rules_python_interactive, which adds a py_interactive macro, and I wonder if it's worth including within rules_python itself. I see there's a relatively new REPL feature that does nearly the same thing. But there are some important ergonomic differences.

  1. py_interactive targets are set up within BUILD.bazel files just like a py_binary.
  2. py_interactive shells have tab completion.
  3. py_interactive has an optional pushes argument for initial setup (e.g. importing a module).

Having the setup within the BUILD.bazel file is really the key difference. If you often need to debug inside an interactive shell, it's nice to have the configuration in place and just a simple bazel run :my_library_interactive away. The setup is also very easy to understand. In most cases, it's identical to setting up a py_binary.

Describe the solution you'd like

My preferred solution would be to add py_interactive from https://github.com/jpwoodbu/rules_python_interactive to rules_python, should it makes sense to do so. This is not a proposal to remove the REPL feature. It could be worth having both: one that requires setup but is easier to use and one that only requires the right command line.

Describe alternatives you've considered

I had considered having a virtual rule for py_library where you could run a py_library target, perhaps with a .i suffix to get an interactive shell. But I suspect there would be many efficiency downsides for Bazel itself. And it lacks the configurability of a whole new rule/macro (e.g. adding a specific collection of deps unlike any existing py_library targets).

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy