-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Import config parser into TOML parser #2996
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
base: master
Are you sure you want to change the base?
Conversation
dlstadther
left a comment
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.
Could you update a TOML test to verify the successful use of a config param from the default section? Just want to be sure that this import still works as you would expect it to in that S3Client, rather than just removing the error without actual impact. Thanks!
|
@dlstadther the core of the problem is that TOML doesn't return default config values (the method is not there). I added a test to show the use case. The problem is not S3Client(). |
|
I don't have good understanding of the configuration code, but this PR looks weird to me. Why would TOML parser depend on configparser? If we want a default method, let's add it, rather than pulling in a full class that is not really supposed to be there. |
|
@honnix it is the same logic as in the cfg parser. in default config we have: class LuigiConfigParser(BaseParser, ConfigParser):
NO_DEFAULT = object()
enabled = True
_instance = None
_config_paths = [
'/etc/luigi/client.cfg', # Deprecated old-style global luigi config
'/etc/luigi/luigi.cfg',
'client.cfg', # Deprecated old-style local luigi config
'luigi.cfg',
]
...And in TOML config: class LuigiTomlParser(BaseParser):
NO_DEFAULT = object()
enabled = bool(toml)
data = dict()
_instance = None
_config_paths = [
'/etc/luigi/luigi.toml',
'luigi.toml',
]
....Somehow |
|
If I understood correctly, TOML and the Python default config (ConfigParser) are two different ways writing config file, and there is no connection between TOML and ConfigParser. The reason |
|
Are there plans to finish this fix? This bug is making me unable to use toml config because I use S3Client. I don't see an obvious workaround absent code changes aside from switching to cfg. |
|
@bbreton This is a community-driven project, without a backing open source based business. You can offer to help by improving the PR, creating a better solution, or offer to fund someone to work on Luigi. But you cannot demand that anyone spend their spare time or company time, nor expect any plan or schedule for things to be fixed. |
honnix
left a comment
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.
A commented, inheriting from ConfigParser is not an ideal solution.
|
I have made request for change explicitly, so we can move forward with an alternative solution. |
|
The fix could be as simple as adding: |
|
@honnix don't hesitate to push on this PR. I actually tried your solution but it didn't work (so I forked the project ever since). |
|
@lallea Sorry, I was unsure if it was just forgotten or if it even needed additional work. My impression was the fix worked, but it was unclear if the method was the best. If the PR needs additional work I am certainly willing to help fix it.
|
|
@mishaker As I commented before, config parser and toml parser are two different things, so inheritance doesn't really make sense. I'm not sure why adding a defaults methods didn't work for you, but that's what the exception complains. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If closed, you may revisit when your time allows and reopen! Thank you for your contributions. |
Description
When using S3Client() with TOML parser you get this error:
Importing ConfigParser into toml_parser solves the issue.