I have my python package requirements in setup.py
and I simply do pip install .
from a directory where setup.py
exists. I don't have a requirements
file and I don't want to have one. How do I tell salt to use setup.py
instead of requirements.txt
?
Installing pip package to virtualenv and running setup.py should be different requirement.
I assume setup.py triggering is only mean for self-serving modules, external package should be put under saltstack virtualenv setup, so you can see if the required external package failed to install. But it also depends on your own taste.
To run setup.py inside your virtualenv, you must create a script that call the virutalenv, then run setup.py , e.g. vi run-setup.sh
#!/bin/bash
source $HOME/.virtualenv/xyz/bin/activate
cd $HOME/xyz_app
python setup.py
then use the cmd.run in state file to run it
run setup.py for my xyz app :
cmd_run:
- name: bash <xyz_app folder name>/run-setup.sh
- user: <username>
- group: <groupname>
UPDATE :
Since you want to load particular python package to your virtualenv, you can do it straight away during setup. Then only use cmd.run to load batch that launch setup.py (to make your custom app works)into the virtualenv.
create-my-apps-virtualenv:
virtualenv.managed:
- name: /home/myapphome/.virtualenv/myapp
- user: myappusername
- no_chown: False
# install this pacakge to my virtualenv, package must be case sensitive according.
- pip_pkgs: json, MySQL-python,SQLAlchemy