Last active
May 28, 2019 12:10
-
-
Save pavank/de13956d83ec663ef63cdba6943750b5 to your computer and use it in GitHub Desktop.
Setting up a brand new Python Virtual Env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Step 1(Project context) : mkdir project-folder && cd project-folder | |
Step-2(Global site package) : pip install virtualenv | |
Step-3(create virtualenv with python version ) : virtualenv -p /usr/bin/python3.7 .venv | |
Step-4(activate .venv) : source .venv/bin/activate | |
Step-4(Local to .venv) : pip install pip-tools | |
Step-5(manual) : create requirements.in / dev-requirements.in | |
requirements.in | |
=============== | |
psycopg2 | |
sqlalchemy | |
Step-6(Compile Spec files) : pip-compile --generate-hashes requirements.in | |
This generates a file as below | |
requirements.txt | |
================ | |
# | |
# This file is autogenerated by pip-compile | |
# To update, run: | |
# | |
# pip-compile --generate-hashes | |
# | |
psycopg2==2.8.2 \ | |
--hash=sha256:00cfecb3f3db6eb76dcc763e71777da56d12b6d61db6a2c6ccbbb0bff5421f8f \ | |
--hash=sha256:076501fc24ae13b2609ba2303d88d4db79072562f0b8cc87ec1667dedff99dc1 \ | |
--hash=sha256:4e2b34e4c0ddfeddf770d7df93e269700b080a4d2ec514fec668d71895f56782 \ | |
--hash=sha256:5cacf21b6f813c239f100ef78a4132056f93a5940219ec25d2ef833cbeb05588 \ | |
--hash=sha256:61f58e9ecb9e4dc7e30be56b562f8fc10ae3addcfcef51b588eed10a5a66100d \ | |
--hash=sha256:8954ff6e47247bdd134db602fcadfc21662835bd92ce0760f3842eacfeb6e0f3 \ | |
--hash=sha256:b6e8c854cdc623028e558a409b06ea2f16d13438335941c7765d0a42b5bedd33 \ | |
--hash=sha256:baca21c0f7344576346e260454d0007313ccca8c170684707a63946b27a56c8f \ | |
--hash=sha256:bb1735378770fb95dbe392d29e71405d45c8bdcfa064f916504833a92ab03c55 \ | |
--hash=sha256:de3d3c46c1ee18f996db42d1eb44cf1565cc9e38fb1dbd9b773ff6b3fa8035d7 \ | |
--hash=sha256:dee885602bb200bdcb1d30f6da6c7bb207360bc786d0a364fe1540dd14af0bab | |
sqlalchemy==1.3.3 \ | |
--hash=sha256:91c54ca8345008fceaec987e10924bf07dcab36c442925357e5a467b36a38319 | |
Step-7(Sync local env form PyPi) : pip-sync dev-requirements.txt requirements.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment