Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install in-house requirements for Python Heroku projects?

Tags:

python

pip

heroku

We have a few in-house libraries that we've split off (for several reasons, mostly administrative or to have the possibility to easily open source them later). They live in private Github repositories, if that matters.

I'd like to deploy an app to Heroku to try it out. It depends on one of those libraries.

I'm supposed to specify my dependencies in requirements.txt. That's easy for the PyPI-installable stuff, but what do I do for these in-house dependencies?

I could either run my own private PyPI mirror that has this stuff, or I could use editable packages (even though the documentation says they shouldn't be used in production).

What's the appropriate way to do it?

like image 376
lvh Avatar asked Feb 02 '12 13:02

lvh


People also ask

How do I install Python packages in Heroku?

Just go to your Python file(s) and copy out the "froms" and "imports" and install them here. % pipenv install [space-separated list of your modules] % pipenv install flask sklearn [etc ...] Doing this will create a Pipfile. When pushed to Heroku, this tells the Heroku system to install the modules with pip.

Is requirements txt necessary for Heroku?

Create necessary project files These are 1) the Procfile and 2) the `requirements. txt` file. Both of these are required by Heroku to install all app dependencies and subsequently utilize Gunicorn to fire off our app in the cloud. First create the Procfile.

How do I deploy a Heroku project in Python?

Install app dependencies locally txt in the root directory is one way for Heroku to recognize your Python app. The requirements. txt file lists the app dependencies together. When an app is deployed, Heroku reads this file and installs the appropriate Python dependencies using the pip install -r command.

How do I install Heroku dependencies?

Run the npm install command in your local app directory to install the dependencies that you declared in your package. json file. Start your app locally using the heroku local command, which is installed as part of the Heroku CLI. Your app should now be running on http://localhost:5000/.


2 Answers

GitHub allows HTTP Basic authentication on Git repos.

So, you can add a line like this:

-e git+https://username:[email protected]/kennethreitz/[email protected]#egg=requests

And everything will work properly :)

like image 115
Kenneth Reitz Avatar answered Oct 15 '22 10:10

Kenneth Reitz


In requirements.txt you can mention like the following.

git+git://github.com/kracekumar/blaze.git

Meanwhile you can clone the library and create virtual environment and install inside the env. Heroku dev center has articles including virtual env set up.

like image 33
Kracekumar Avatar answered Oct 15 '22 09:10

Kracekumar