rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
129 stars 79 forks source link

PyPI repository not recorded in manifest #486

Open jmcphers opened 3 years ago

jmcphers commented 3 years ago

If Python content uses a specific PyPI repository in order to get access to packages not available in default repositories, it is unlikely to work when published since that repository is not recorded in the manifest generated by rsconnect. You must instead manually ensure that the PyPI repository used by RStudio Connect has the packages your Python content requires.

This is about to become a much more prevalent issue now that RStudio Package Manager allows you to create snapshots, which get their own repository URLs.

https://solo.rstudiopm.com/client/#/repos/32/overview

https://docs.rstudio.com/rspm/admin/python/

Recording these PyPI repository URLs when publishing content is essential to making it possible to use them to install Python package dependencies when the content runs on RStudio Connect.

hadley commented 1 year ago

@mmarchetti do you have any thoughts on what we need to do here?

mmarchetti commented 1 year ago

In environment.py, we could capture the index_url and extra_index_url configuration into the requirements.txt file with Python code analogous to:

URL=$(python -m pip config get global.index_url) && echo "--index-url $URL" >> requirements.txt
URL=$(python -m pip config get global.extra_index_url) && echo "--extra-index-url $URL" >> requirements.txt
hadley commented 1 year ago

@mmarchetti would you mind doing a PR to that end?

mmarchetti commented 1 year ago

Notes from our Python team meeting:

hadley commented 1 year ago

@mmarchetti BTW deployApp() currently has forceGeneratePythonEnvironment = FALSE; if you set it to TRUE it will overwrite an existing requirements.txt.