Skip to content

Split declaration? #3193

Closed
Closed
@HalfWhitt

Description

@HalfWhitt

What is the problem or limitation you are having?

Travertino's declaration.py, at 501 lines, isn't exactly a huge file. But it's got a decent bit going on in it, and will have more once composite_property is added.

Describe the solution you'd like

I'd like to propose splitting the file in two, at roughly the halfway mark: keep Choices and the various properties together, and put BaseStyle in its own file.

If that's a go, then the question would be how precisely to do it. I think the main options are:

  • Split it into two (still top-level) files. It would probably makes sense to rename these to properties and style. I feel like this is probably what we'd do if starting here from scratch, but it means Toga (and maybe user code, on the slim chance anyone's using it) would need to change their imports. We'd also need to keep an import-only declaration module at first, as a compatibility shim for Toga <= 0.4.8.
  • Turn declaration into a subpackage containing the two files, with an __all__ exporting all the needed symbols, so all the imports stay the same.
  • A sort of compromise of the two: two top-level files, named properties and declaration, the latter of which imports all the properties from the former.

My instinct would be the first option, but either of the other two would mean less code churn.

Describe alternatives you've considered

Leave it as-is.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features, or improvements to existing features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions