Use path to app as part of entrypoint for Express apps #816
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For running Express apps, this PR makes it so that setting an environment variable is no longer needed for uvicorn to launch the app; instead, if the app path is:
then this sets the entrypoint to
This will make it possible to deploy on shinyapps.io.
The escaping rule is this:
_<hex>_
, where<hex>
is the hexadecimal representation of the character.0app_2e_py
is not a valid name, and so can't be used as part of an entrypoint, as inshiny.express.app:0app_2e_py
.In my testing, I found that uvicorn actually would accept other characters, like if you run:
However,
gunicorn
would error if you run:because in
gunicorn
tries to parse the part after the:
as anast.Name
orast.Call
, andpath/to/app.py
contains characters that are invalid for either of those types.I decided to play it safe and make it general by escaping to valid Python variable names.