How to add local repository code to deploy?

My app comes with some package code that needs to be installed. For example with

python setup.py install

or

pip install .

And I don’t want to add my github packgage URL to my requirements.txt file.

But when I deploy the app to the streamlit server it does not find the required libraries.

I tried adding a Procfile, but that did not work. Seems that is only for heroku.

Try adding a line to requirements.txt that is just a single dot (.) or -e . (which may be more handy in local development, as it will install the local package in editable mode.

Thanks, it just not best practice to add . to the requirements.txt. But it works. I guess, I should better separate the app code from the main library.

I agree that it’s a good idea to separate out the app code from the main library. One structure I tend to prefer, in the case where I have a python package that needs installed, and also a streamlit app to show it off is:

  • pyproject.toml
  • src/package_code/
  • demo_app/
    • streamlit_app.py
    • requirements.txt

Or:

  • pyproject.toml
  • src/package_code/
  • demo_app.py
  • requirements.txt

And then putting -e . in the requirements.txt so that it installs the package code along with 3rd party libraries I’m using.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.