Skip to content

Replace Deprecated optparse with argparse for Command-Line Parsing #142

Closed

Description

@yy214123

The current implementation of pyfiglet utilizes the optparse module for parsing command-line arguments.
However, optparse has been deprecated since Python 3.2 in favor of the more powerful and flexible argparse module.

Proposed Changes:
Switch to argparse: Replace all instances of optparse with argparse to handle command-line arguments.

Activity

  1. pwaller commented on Dec 30, 2024

    @pwaller
    Owner

    If someone wants to contribute this, pull requests are welcome.

  2. yy214123 commented on Dec 30, 2024

    @yy214123
    Author

    Thank you for the positive response!
    I will proceed to create a Pull Request to replace optparse with argparse.

  3. pwaller commented on Dec 30, 2024

    @pwaller
    Owner

    Thanks; bear in mind I may be slow to respond since I'll have a lot going on. If it turns out to be non-trivial to review the requests it may take some time. Please feel free to ping the thread every so often if I go silent.

  4. stefanor commented on Dec 30, 2024

    @stefanor
    Collaborator

    FYI, optparse got undeprecated: python/cpython#126227

  5. yy214123 commented on Dec 30, 2024

    @yy214123
    Author

    FYI, optparse got undeprecated: python/cpython#126227

    Thank you for sharing the information. I didn't notice this news.

  6. pwaller commented on Aug 15, 2025

    @pwaller
    Owner

    As optparse is no longer deprecated I'll close this, but thanks anyway for the suggestion.

    If anyone does come up with a good reason to migrate option parsers in the future I would only seriously consider it if it left the option parsing compatible with older versions (i.e. supporting flags as they are used with older versions). I would be reluctant to accidentally change the behaviour of existing scripts.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions