-
Notifications
You must be signed in to change notification settings - Fork 176
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
Make MODULE:APP non-positional (but still required) argument #439
Comments
I'd accept a PR to allow Hard disagree on config files vs CLI args tho, as far as version controlling config files tend to be far superior. :-) I do understand the desired flexibility between CMD and ENTRYPOINT in the case of a Dockerfile, and hence would support the feature request. |
Hi! So, I'm so so involved in waitress these days, but I still make heavy use of it. I was the person who committed
Secondly, there was the requirement to keep compatibility with the There is a lot of code in |
You could also implement what you're looking for trivially around line 271-276 (also lines 261-263) by checking |
I will add up a little, if you please. 😊 The point is that you already have those "configs" in files, somewhere. And when you keep propagating them from files ("sources") to another files, in other "pipeline stages" and environments, eventually you will miss some file - it will go out of sync with source. Crazy things will happen. Instead, you need to eliminate as much "(configuration) files" as you can, and reconstitute everything from one single source of truth, providing applications and services it's configuration with chain-loading. More on that topic can be read here: https://www.skarnet.org/software/s6/overview.Html. |
I'm planning to dive into code on weekends. |
Could someone please assign this issue to me? |
@tribals in most open source software projects, no one assigns issues, including this one. You can make a comment to let other developers know you are working on it, and create a pull request. |
Here is first take on this: |
Feel free to create a PR and mark it as draft. This will make it easier to track progress for us as maintainers. |
Currently, the usage of
waitress-serve
is as follows:This is rather inconvenient, as "application" argument is rarely change over the lifetime of project. But, this forces to pass all the arguments that definitely change before, but still keep "app" somewhere and append it in the end. This makes changing those arguments difficult.
For example, when deploying Flask application (running in dev. server) to Docker, one can write Dockerfile like that:
This makes resulting image something like "runnable artifact" - you can
docker run -it your/awesome:latest
- and it will work out of the box. Besides that, you can alsodocker run -it your/awesome shell
- and it will throw you right into "application" internals, inside plain old Python REPL. Among those, you can just pass Flask arguments directly to container - and it will work "as expected".But this is all for development. What about production? Translating this example to
waitress-serve
yields this:This will fail, because you must pass "arguments" (
CMD
in Docker vocabulary) before MODULE:APP - and this is unachievable withwaitress-serve
.Although one still can implement this logic in "his own CLI, wrapping
waitress
API directly" - but I argue exactly against that - this is unfortunate that every Python Web programmer need to implement it's own "wrapper" for so much common things - this leads to duplication of logic, maintenance burden and creeps design of application to the dark. The logic is so simple thatwaitress-serve
should be used literally for all deployments.So, it would be nice to have non-positional, required argument to pass application module/instance to
waitress-serve
.Side-note on configuration files: they make configuration harder. Better to pass arguments and set environment variables.
The text was updated successfully, but these errors were encountered: