-
Notifications
You must be signed in to change notification settings - Fork 208
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
refactor!: Demonstrator: New config management class (and some more stuff) #1850
base: dev
Are you sure you want to change the base?
Conversation
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.
Hi @buhtz, I've had a look over this.
I don't have any big suggestions, but I commented on a few small things.
There are a few style tweaks (particularly the suggestion for create-manpage
at the end), so let me know if you'd prefer not to get these kind of style comments.
OK, I know implemented all config-fields from Config class in Konfig class as properties including man page content. |
Blocked by
That PR is intended to get merged but also it is more a demonstrator instead of a modification to the current BIT behavior. The code technically is not "connected" to regular BIT and merging it won't change BIT behavior.
The objective was to replace the configuration management logic currently realized in the
Config
class. The current implementation is inefficient and blown up. Additionally that class does a lot more then just managing the configuration.The PR demonstrate the new solution. Some details are not finished and need to be solved. But I would like to discuss the approach as early as possible before finishing it.
__main__
incommon/konfig.py
file for a short example.Konfig
as name for the new class because of lack of a better alternative. I am open for suggestions. On a long run we will "delete" the wholeConfig
class with separating its behavior in several other classes. Once whenConfig
is gone we can renameKonfig
intoConfig
.configparser
now is used to read and write the config file. Because that package reads INI-like files I used a little trick because BIT's config file is not an INI file. After reading the raw file into memory I simply add[BIT]
before the first line and then read it withconfigparser
.Profile
internally dealing withKonfig
.backintime-config (1)
man page still is done with a script. The script does not parse the konfig.py file anymore but useinspect
to extract the relevant information (from public properties with docstrings).How to integrate it into BIT? Not in this PR but later. I would use
Config
in a wrapper-like manner usingKonfig
internally. This is a lot of extra work. But this step would make it smooth and less-risky transforming the codebase into usingKonfig
. And also the needed PRs can be smaller. This way we can carefully decouple the codebase step by step from theConfig
class monolith.Side note to myself
ConfigParser
can't handle lines like this:Problem is solved.