Skip to content

feat: add cli tool for generating a deprecation docstring #656

Closed

Description

@cadenmyers13

Problem

We are about to begin the process of deprecating old function names. In that process, we want to generate a consistent docstring across deprecated function.

Proposed solution

Add a cli tool that will print the docstring. Call it package print or something? See discussion here for some more info diffpy/diffpy.utils#377

Activity

  1. added this to the 0.3.0 release milestone on Feb 4, 2026
  2. cadenmyers13 commented on Feb 4, 2026

    @cadenmyers13
    CollaboratorAuthor

    cli code from brainstorming

    def main():
        parser = argparse.ArgumentParser(
            description="""\
    Print a docstring for copy-pasting into a deprecated function.
    
    Example usage
    -------------
        python -m diffpy.utils._deprecator load_data 4.0.0 -n diffpy.utils.parsers
    """,
            formatter_class=argparse.RawTextHelpFormatter,
        )
        parser.add_argument("new_name", help="Name of the new function.")
        parser.add_argument(
            "removal_version",
            help="Version when the deprecated item will be removed.",
        )
        parser.add_argument(
            "-n", "--new-base", default=None, help="New import base."
        )
    
        args = parser.parse_args()
    
        generate_deprecation_docstring(
            new_name=args.new_name,
            removal_version=args.removal_version,
            new_base=args.new_base,
        )
    
    
    if __name__ == "__main__":
        main()
    
    
  3. self-assigned this
    on Feb 4, 2026
  4. sbillinge commented on Feb 4, 2026

    @sbillinge
    Collaborator

    This is good. In the docs, let's put a few words explaining the importance, which is that this docstring will appear in the API docs and so is super-useful to people using the program.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions