Skip to content

Use declarative summary method for all sub-configs - #4739

Open
svartkanin wants to merge 12 commits into
archlinux:masterfrom
svartkanin:refactor-config
Open

svartkanin wants to merge 12 commits into
archlinux:masterfrom
svartkanin:refactor-config

Conversation

@svartkanin

Copy link
Copy Markdown
Collaborator
  • Adds a new SubConfig abstract class for all sub-configuration entries
  • All configs implement the summary method which is used to assemble the installation preview

@svartkanin
svartkanin requested a review from Torxed as a code owner August 30, 2026 10:40
@codefiles

Copy link
Copy Markdown
Contributor

Would you like me to review this? Is it ready?

@svartkanin

Copy link
Copy Markdown
Collaborator Author

It is ready and I'd appreciate a review

Comment thread archinstall/lib/args.py Outdated
target.chmod(stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP)

def as_summary(self) -> str:
def as_summary(self, level: SummaryLevel = SummaryLevel.Basic) -> str:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is no change to the following, I do not see how SummaryLevel.Detailed is ever used:

All the code conditional on level being SummaryLevel.Detailed in summary methods will be dead code.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a forward thinking addition, I added it to be able to use this summary also for the installation confirmation page in follow up changes. That screen currently shows the Json blob which isn't very readable nor understandable so I'm planning to use this new summary for that one too but for that one it'll require the full detailed settings

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include details like this in the initial comment of the pull request in the future.

Comment thread archinstall/lib/args.py

summary = obj.summary()
for sub_config in self.sub_cfg().values():
summary = sub_config.summary(level)

@codefiles codefiles Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The level default (SummaryLevel.Basic) can be removed from all the summary methods if only as_summary calls them. as_summary already has SummaryLevel.Basic as the default for level and passes it to the summary methods here. If this is unnecessary duplication of the default, make level required for summary methods by removing the default from their parameters.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explained in the comment above, this is the first use case for the new summary. In a follow up I'll use it for the installation confirmation screen as well which needs all the detailed setting summaries

Comment thread archinstall/lib/models/config.py Outdated
}

@override
def summary(self, level: SummaryLevel = SummaryLevel.BASIC) -> list[str]:

@codefiles codefiles Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

level will need to be changed to _level for some summary methods because of a5e7446.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants