Skip to content

Support entrypoint references in -m #145495

@alicederyn

Description

@alicederyn

Feature or enhancement

Proposal:

I'd like to adopt entry-points more at my company (we currently have top-level .py files that are often simple redirects to entry-point-style functions), but concern has been raised that there's no simple way for devs to mimic an entry-point invocation without installing their module, which is a hurdle to training. I'd like to extend -m to support entry-point syntax, i.e.

python -m importable.module:entrypoint_function [args...]

This should be roughly equivalent to adding this as a console_scripts entry-point, installing the module, and calling the entry-point from the bin dir:

  • the function will be expected to look at sys.argv to see what's been passed in
  • the first three elements in argv will be replaced with a single entry, so [args...] will be in argv[1:]

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions