Skip to content

Argument Clinic: split out global stateless helpers and constants from clinic.py #113317

Closed
@erlend-aasland

Description

@erlend-aasland

Feature or enhancement

clinic.py has a lot of globals in various forms. Getting rid of the globals will make it possible to split out clinic.py in multiple files (#113299). Combined, this will impact readability and maintainability of Argument Clinic in a positive way.

Most globals can be easily dealt with. We can structure them into two groups:

  • global constants that are not mutated
  • stateless helper functions and classes

It can make sense split out some of these in separate files (for example a libclinic package, as suggested in #113309). For some globals, it makes more sense to embed them into one of the existing classes (for example the global version variable clearly belongs in DSLParser).

Suggesting to start with the following:

  • move stateless text accumulator helpers into a Tools/clinic/libclinic/accumulators.py file
  • move stateless text formatting helpers into a Tools/clinic/libclinic/formatters.py file
  • move version into DSLParser and version helper into a Tools/clinic/libclinic/version.py file

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions