Infer entrypoints from additional filename patterns #492
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.
Currently, rsconnect-python will infer a variety of entrypoints if none is specified by the user, depending on the files in the directory. In priority order, these are:
To the end of this list, I'd like to add:
app-*.py,app_*.py,*-app.py,*_app.py], use it and append:app(whereas the others assume the attribute is the same as the filename).I've also made two other changes:
app:appbut raise a fatal error.actionsmodule had a deprecatedget_default_entrypointimplementation that was identical to thebundleone. I now haveactions.get_default_entrypointdelegating tobundle.get_default_entrypoint(after raising its deprecation warning).Intent
Shiny for Python has some upcoming scenarios which will make a single
foo-app.pymuch more common in the future. We'd like to support deploying these without requiring an explicit--entrypointargument.Type of Change
The breaking change is that we would no longer default to
app:appif inference fails, but raise an error. I can't think of a case where it's preferable to go through with a whole deployment that's definitely not going to work. (It's definitely not going to work, right?)Approach
Pretty much copied what was already there.
Automated Tests
I added unit tests that cover both my new file patterns, and some already-existing cases that had not been covered. I also refactored the relevant unit test to make it easier to add more cases.
Directions for Reviewers
In an environment with
rsconnect-pythonandshinyinstalled:Checklist