-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for configuration profiles #395
Conversation
From what I understand the configuration we can set in the file relates to the columns of the query display.
But I guess other options would be nice to have to. Did I miss something ? (is it something you planned to add afterwards ?) |
From what I understand the configuration we can set in the file relate to the columns of the query display.
@kmoppel-cognite was looking for a way to hide sections of the header (instance, system, workers).
These are not configurable through configuration files at the moment,
indeed; but we can certainly add support for these later on.
|
Hey, glad to see some progress! Looks promising :) At the same time - do I understand correctly that currently there is still no "infra" for built-in profiles where configs could be read in some fallback mode from some "flags dictionary" in code? |
Sorry, I don't get your question; can you reformulate? |
02a00a8
to
f7a86c3
Compare
This version has reached its end-of-life last year, https://peps.python.org/pep-0537/#lifespan.
We use the syntax from PEP 585 and PEP 604 and rely on 'from __future__ import annotations' to modernize the code base. However, not all generic aliases (e.g. Dict, List) can be replaced before Python 3.9.
Rephrase their help text and move then to a dedicated options group.
We introduce UIHeader class to hold header-specific options. Along the way, many names (variables, functions) are changed in order to make things more explicit.
In the command-line parser, options related to header information have their default value set to None in order to distinguish when the option was not specified from when it got, as it would store False then. This makes it possible to have a precedence of command-line options over the configuration file (implemented in types.UIHeader.make()). The validation of configuration options, previously in UISection, is extracted into a BaseSectionMixin and reused in new HeaderSection.
SectionProxy.get*() would never actually raise NoOptionError because the 'fallback' argument defaults to None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for adding this !
This stems from the idea discussed at https://github.com/dalibo/pg_activity/pull/387#issuecomment-1623178466.#396.
One thing I wonder is whether the option should be named
--config <full-path-to-config>
or if we should introduce another option later on.Based on #404