GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactor Argument Clinic support code into libclinic · Issue #113299 · python/cpython

Refactor Argument Clinic support code into libclinic #113299

New issue
Copy link
New issue
Copy link
Closed
Closed
Refactor Argument Clinic support code into libclinic#113299
Copy link
Labels
topic-argument-clinictype-featureA feature request or enhancementA feature request or enhancement

Description

@vstinner
vstinner
opened on Dec 20, 2023
Issue body actions

Argument Clinic was added 10 years ago. The script clinic.py grown from around 2500 lines to around 6700 lines.

I propose to split this large file into sub-files to ease the maintenance of Argument Clinic.

Linked PRs

  • [DRAFT] gh-113299: Split clinic.py into sub-files #113300
  • gh-113299: Create libclinic package #113309
  • gh-113299: Move cpp.py into libclinic #113526
  • gh-113299: Move Argument Clinic CLI into libclinic #115542
Reacted by Erlend E. Aasland

Activity

  1. vstinner
    added a commit that references this issue on Dec 20, 2023

    pythongh-113299: Split clinic.py into sub-files

    c2b47ce
  2. AlexWaygood
    added
    topic-argument-clinic
    on Dec 20, 2023
  3. erlend-aasland commented on Dec 20, 2023

    @erlend-aasland
    erlend-aasland
    on Dec 20, 2023
    Contributor
    More actions

    This has also been discussed before. See #104683 (comment).

  4. erlend-aasland commented on Dec 20, 2023

    @erlend-aasland
    erlend-aasland
    on Dec 20, 2023
    Contributor
    More actions

    I think it is a really good idea to split clinic.py into multiple files. The C preprocessor stuff is already separated out (cpp.py). We should do this in iterations; not everything in one big PR. Perhaps it is easiest to start with the converters; it's a large chunk of clinic.py, and I think it would be pretty easy to separate it from the rest. Separating out the application is also a good start.

    Moreover, doing this work in chunks/iterations, instead of everything in one go, will minimise the impact on ongoing Argument Clinic work.

    Reacted by Alex Waygood and Donghee Na
  5. AlexWaygood commented on Dec 20, 2023

    @AlexWaygood
    AlexWaygood
    on Dec 20, 2023
    Member
    More actions

    +1 to splitting clinic.py up, and +1 to doing it incrementally rather than in one big PR.

    Previously I've held off from doing something like this because clinic.py's use of global variables means that lots of parts of the file are tightly coupled to other parts in surprising and unfortunate ways. In #113300, warn() and fail() still use a global clinic variable in utils.py, but that variable is now altered from code in other files, making it even harder to understand what's going on. That feels worse, and it feels like we're avoiding solving the actual problem here, which is that clinic.py just shouldn't really be using global variables like this in the first place.

    But maybe it's acceptable for now, if splitting the code up into several files is a higher priority :) Getting rid of the global variables is hard!

    Reacted by Erlend E. Aasland
  6. erlend-aasland commented on Dec 20, 2023

    @erlend-aasland
    erlend-aasland
    on Dec 20, 2023
    Contributor
    More actions

    IMO, getting rid of the global variables should be a prerequisite to splitting things up. We don't need to rush this; clinic.py has been a single file since it started out in life. Argument Clinic is already hard to comprehend, so any refactoring, including splitting up should make it more readable, not the other way around. Readability is IMO the highest priority.

    Reacted by Alex Waygood
  7. vstinner
    added a commit that references this issue on Dec 20, 2023

    pythongh-113299: Create libclinic package

    b58b260
  8. vstinner commented on Dec 20, 2023

    @vstinner
    vstinner
    on Dec 20, 2023 · Hidden as off-topic
    Author
    show commentMore actions
  9. AlexWaygood commented on Dec 20, 2023

    @AlexWaygood
    AlexWaygood
    on Dec 20, 2023 · Hidden as off-topic
    show commentMore actions
  10. erlend-aasland commented on Dec 20, 2023

    @erlend-aasland
    erlend-aasland
    on Dec 20, 2023 · Hidden as off-topic
    show commentMore actions
  11. erlend-aasland commented on Dec 20, 2023

    @erlend-aasland
    erlend-aasland
    on Dec 20, 2023 · Hidden as off-topic
    show commentMore actions
  12. vstinner commented on Dec 20, 2023

    @vstinner
    vstinner
    on Dec 20, 2023 · Hidden as resolved
    Author
    show commentMore actions
  13. vstinner
    closed this as completedon Dec 20, 2023
  14. erlend-aasland
    closed this as not plannedon Dec 20, 2023
  15. erlend-aasland
    changed the title [-]Argument Clinic: split clinic.py into sub-files[/-] [+]Refactor Argument Clinic support code into libclinic[/+] on Dec 27, 2023
  16. erlend-aasland
    reopened this on Dec 27, 2023
  17. erlend-aasland commented on Dec 27, 2023

    @erlend-aasland
    erlend-aasland
    on Dec 27, 2023
    Contributor
    More actions

    Since last week, we've done a lot of yak-shaving (and there is more to be done). A bare bones libclinic has been established, containing most of the stateless formatting code. The next steps will be to move ClinicError into libclinic/errors.py, and rename cpp.py to libclinic/cpp.py.

  18. erlend-aasland commented on Dec 27, 2023

    @erlend-aasland
    erlend-aasland
    on Dec 27, 2023
    Contributor
    More actions

    libclinic/errors.py was established via #113525.

  19. erlend-aasland
    added a commit that references this issue on Dec 27, 2023

    pythongh-113299: Move cpp.py into libclinic

    5976735
  20. erlend-aasland
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Dec 27, 2023
  21. erlend-aasland
    added a commit that references this issue on Dec 27, 2023

    gh-113299: Move cpp.py into libclinic (#113526)

    7ab9efd
  22. kulikjak
    added a commit that references this issue on Jan 22, 2024

    pythongh-113299: Move cpp.py into libclinic (python#113526)

    9c60bbd
  23. aisk
    added a commit that references this issue on Feb 11, 2024

    pythongh-113299: Move cpp.py into libclinic (python#113526)

    0610f1c
  24. erlend-aasland commented on Apr 3, 2024

    @erlend-aasland
    erlend-aasland
    on Apr 3, 2024
    Contributor
    More actions

    Superseded by #113317

  25. erlend-aasland
    closed this as completedon Apr 3, 2024
  26. Glyphack
    added a commit that references this issue on Sep 2, 2024

    pythongh-113299: Move cpp.py into libclinic (python#113526)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-argument-clinictype-featureA feature request or enhancementA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.