summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorAzul <mail@azulinho.com>2017-01-12 16:59:27 +0000
committerAzul <mail@azulinho.com>2017-01-12 16:59:27 +0000
commit58613a7eedb9b24be5d9d05718eed59aa0f1d6bf (patch)
tree59a0fc0ff20fbcae756bd64541a17b9af9f252f0 /doc
parentaa9a9dd1b42f8e17f625a3d6c5466753b19a4428 (diff)
downloadnixpkgs-58613a7eedb9b24be5d9d05718eed59aa0f1d6bf.tar
nixpkgs-58613a7eedb9b24be5d9d05718eed59aa0f1d6bf.tar.gz
nixpkgs-58613a7eedb9b24be5d9d05718eed59aa0f1d6bf.tar.bz2
nixpkgs-58613a7eedb9b24be5d9d05718eed59aa0f1d6bf.tar.lz
nixpkgs-58613a7eedb9b24be5d9d05718eed59aa0f1d6bf.tar.xz
nixpkgs-58613a7eedb9b24be5d9d05718eed59aa0f1d6bf.tar.zst
nixpkgs-58613a7eedb9b24be5d9d05718eed59aa0f1d6bf.zip
python docs: update block according to code review
Diffstat (limited to 'doc')
-rw-r--r--doc/languages-frameworks/python.md34
1 files changed, 23 insertions, 11 deletions
diff --git a/doc/languages-frameworks/python.md b/doc/languages-frameworks/python.md
index 7fd26c88e38..6b86312c21f 100644
--- a/doc/languages-frameworks/python.md
+++ b/doc/languages-frameworks/python.md
@@ -812,36 +812,48 @@ and install python modules through `pip` the traditional way.
 Create this `default.nix` file, together with a `requirements.txt` and simply execute `nix-shell`.
 
 ```
-
-th import <nixpkgs> {};
+with import <nixpkgs> {};
 with pkgs.python27Packages;
 
-buildPythonPackage { 
+stdenv.mkDerivation { 
   name = "impurePythonEnv";
   buildInputs = [
+    # these packages are required for virtualenv and pip to work:
+    #
+    python27Full
+    python27Packages.virtualenv
+    python27Packages.pip
+    # the following packages are related to the dependencies of your python 
+    # project. 
+    # In this particular example the python modules listed in the 
+    # requirements.tx require the following packages to be installed locally 
+    # in order to compile any binary extensions they may require.
+    #
     taglib
     openssl
     git
     libxml2
     libxslt
     libzip
-    python27Full
-    python27Packages.virtualenv
-    python27Packages.pip
     stdenv
     zlib ];
   src = null;
-  # When used as `nix-shell --pure`
   shellHook = ''
-  unset http_proxy
-  export GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt
-  virtualenv --no-wheel --no-setuptools venv 
+  # set SOURCE_DATE_EPOCH so that we can use python wheels
+  SOURCE_DATE_EPOCH=$(date +%s)
+  virtualenv --no-setuptools venv 
   export PATH=$PWD/venv/bin:$PATH
-  pip install -r requirements.txt --no-use-wheel
+  pip install -r requirements.txt
   '';
 }
 ```
 
+Note that the `pip install` is an imperative action. So every time `nix-shell`
+is executed it will attempt to download the python modules listed in 
+requirements.txt. However these will be cached locally within the `virtualenv`
+folder and not downloaded again.
+
+
 ## Contributing
 
 ### Contributing guidelines