-
Notifications
You must be signed in to change notification settings - Fork 3
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
Remove BASE_DIR
parsing for settings
#105
Conversation
c81759b
to
427ec9d
Compare
Also note, |
427ec9d
to
94e95c6
Compare
`settings.yaml` being parsed from a base directory has issues when being installed from pip. The user must now pass a `settings_file` path to goosebit when running. With these changes, gooseBit should be run with `python -m goosebit [settings_file]`. There is also now help information with `python -m goosebit --help`. Fixes: #103
94e95c6
to
bdb8e6b
Compare
# skip arg parsing if running pytest | ||
if "pytest" not in sys.modules: | ||
cli_args = parser.parse_args() | ||
return ( | ||
init_settings, | ||
YamlConfigSettingsSource(settings_cls, cli_args.settings_file), | ||
env_settings, | ||
file_secret_settings, | ||
) |
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.
Not a fan of this personally, but I cant think of a better option with the current project structure...
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.
This looks awful. There must be a better way.
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.
I don't think this is going into the right direction. What if you want to run the service with e.g. gunicorn
together with a settings file?
I would rather see the app search for a system-wide file (e.g. in /etc
) and maybe the current directory. This can be made portable with e.g. the platformdirs
package.
@@ -0,0 +1,5 @@ | |||
import argparse |
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.
This is not where I would expect argument parsing. IMHO this should be in __main__.py
.
Fair enough. Closing because I dont think this makes much sense then |
settings.yaml
being parsed from a base directory has issues when being installed from pip. The user must now pass asettings_file
path to goosebit when running.With these changes, gooseBit should be run with
python -m goosebit [settings_file]
. There is also now help information withpython -m goosebit --help
.Fixes: #103