Skip to content

Move or remove useless/irrelevant command line interface (CLI) on stdlib modules #110076

Closed
@vstinner

Description

@vstinner

In issue gh-109435, I documented stdlib modules provinding an useful or interesting CLI: https://docs.python.org/dev/library/cmdline.html

Some stdlib modules include self-tests in their main() function. I dislike that and I would suggest to remove it and at least move it to their test suite.

  • ctypes.util: self-test
  • curses.has_key: self-test?
  • getopt: self-test
  • heapq: self-test
  • imaplib: self-test, "test the IMAP4_stream class"
  • modulefinder: self-test
  • symtable: self-test. parse itself (symtable.py)
  • textwrap: self-test
  • tkinter: self-test
  • wsgiref.simple_server: self-test, run a server, open itself in a browser, stop the server.
  • xml.sax.xmlreader: self-test.

Maybe demos should be moved as examples in the documentation instead?

  • ctypes.textpad: demo
  • shlex: print tokens. Is it really useful?
  • dbm.__init__: get the DB type... but this CLI is not easy discoverable, it's in the init module!
  • netrc: just parse ~/.netrc if available, and then display nothing... not very useful
  • smtplib: "Test the sendmail method", try to send an email to localhost SMTP server.
  • xmlrpc.client + xmlrpc.server: simple demo.

The random module includes a benchmark. I don't think that it's useful to regular users, it should be moved somewhere else:

  • random: benchmark

I'm fine with keeping easter eggs:

  • turtle: it's a demo. Looks more like an easter egg or advanced example than "an useful CLI".
  • xml.sax.expatreader: Sheakspear easter egg.

See also issue gh-93096 "Decide the fate of undocumented script behavior of some modules".

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions