4 ms·
I'm dipping into both Rails and a Python project right now (non-Django), both for the first time, and had difficulty "listing required packages to go along the
by pacemkr 15y ago
I'm dipping into both Rails and a Python project right now (non-Django), both for the first time, and had difficulty "listing required packages to go along the source" in Python.
In Rails/Ruby I can use Bundler:
git clone
bundle install
[do development]
I'd like to do the same for a python project:
git clone
_something_ install_my_dependencies
[do development]
I looked into pip, but it seems I have to package my src into a Python module and install that. setup.py doesn't make sense for my project since it's not a module meant for redistribution. I intend to use py2exe. Basically I just need a way to install dependencies for development.
foreach thing in file
pip install thing
is the best that I can come up with. This is admittedly not terrible, but I feel like there is a better way and I just don't know about it.
- chrismsnz 15y agoThere is a better way! A virtualenv combined with pip and a project requirements[1] file is the best way to handle this. It even supports SVN/SSH checkouts and .egg distributed packages. [1] http://www.pip-installer.org/en/latest/requirement-format.html http://www.pip-installer.org/en/latest/requirement-format.ht...
- pacemkr 15y agoCan I use pip to just install the dependencies without packaging my project as a module? I understand that pip installs "my module" to site packages or a directory under virtualenv. This is not what I need. I don't have a "my module" to install. I just need to make sure that the dependencies are installed on the machine/virtualenv that I'm using for development. I studied the requirement file documentation and I couldn't find a solution. It seems that to take advantage of this feature in pip I have to write a setup.py, and as I've mentioned that really doesn't make sense for my type of project. Or am I misunderstanding something?
- X-Istence 15y agopip freeze > requirements.txt pip install -f requirements.txt Now whenever you go to develop, pip install -f requirements.txt, when you update dependent packages, pip freeze. You are by no means required to make your source code a module or anything like that. If you use the above with a virtualenv you can isolate different models for different projects and have them frozen at different versions. You are also able to modify requirements.txt to include version specific information. packagename==3.4.0 now locks packagename to 3.4.0 when pip goes to install it. I'm assuming your git directory looks like this: $DIR \ | - requirements.txt | - fileone.py | - filetwo.py | - folder \ | - __init__.py | - filethree.py I have several projects set up exactly like that, especially since they will never have to be distributed using a .egg or anything else.