[Nix-dev] Using/packaging Python-modules

Freddy Rietdijk freddyrietdijk at fridh.nl
Wed Dec 21 15:51:01 CET 2016


Hi Roland,

I've fixed the issues you described with
https://github.com/NixOS/nixpkgs/commit/e0d1691ba3ceffe51efb0dfde285a3e29b0002fe

I couldn't find
>   - http://nixos.org/nixpkgs/manual/#ssec-python-development
>    This anchor des not exist; maybe #development-mode is meant.
Could you tell me where you found this?

There are some issues with the links because this part of the docs is
written in Markdown and converted with Pandoc to Docbook. The Markdown part
includes some internal references but because Markdown does not support
that they are instead references to the docs online.


Freddy






On Wed, Dec 21, 2016 at 3:18 PM, Roland Koebler <
rk-list at simple-is-better.org> wrote:

> Hi,
>
> I'm trying to create nix-packages from some of my own Python-modules.
> So, I followed the Nixpkgs manual, but it did not work as described:
>
> Section 8.10.1.2.1. Python packaging on Nix:
>
> - 1st shell.nix-example: local toolz package [1]
>
>   1. variable "licenses" is not found:
>
>      user at host:~/tmp/_$ nix-shell
>      error: undefined variable ‘licenses’ at /home/rk/tmp/_/shell.nix:15:15
>      (use ‘--show-trace’ to show detailed location information)
>
>   2. after removing the license-line, I can start a nix-shell, but the
> toolz
>      package is not available:
>
>      user at host:~/tmp$ nix-shell
>      ...
>      [nix-shell:~/tmp]$ which python3.5
>      /nix/store/c5c9fs9vh12rr0lvbss1a813xwlwv0
> zh-python3-3.5.2/bin/python3.5
>
>      [nix-shell:~/tmp]$ python3.5
>      Python 3.5.2 (default, Jun 25 2016, 21:38:40)
>      [GCC 5.4.0] on linux
>      Type "help", "copyright", "credits" or "license" for more information.
>      >>> import toolz
>      Traceback (most recent call last):
>        File "<stdin>", line 1, in <module>
>      ImportError: No module named 'toolz'
>
> - 2nd shell.nix-examle: local toolz package + numpy [2]
>
>   1. variable "licenses" is not found (as above)
>   2. tests fail:
>
>         ...
>         ============================================================
> ==========
>         ERROR: exceptions (unittest.loader._FailedTest)
>         ------------------------------------------------------------
> ----------
>         AttributeError: module 'toolz.curried' has no attribute
> 'exceptions'
>
>         ============================================================
> ==========
>         ERROR: exceptions (unittest.loader._FailedTest)
>         ------------------------------------------------------------
> ----------
>         AttributeError: module 'toolz.curried' has no attribute
> 'exceptions'
>
>         ------------------------------------------------------------
> ----------
>         Ran 2 tests in 0.001s
>
>         FAILED (errors=2)
>         builder for ‘/nix/store/pa77cfky1b0f2knzn2k2czdaxz6wdym6-python3.5-toolz-0.7.4.drv’
> failed with exit code 1
>         cannot build derivation ‘/nix/store/pi89rb0v178avb0jjdm352vad42a1f7a-python3-3.5.2-env.drv’:
> 1 dependencies couldn't be built
>         error: build of ‘/nix/store/pi89rb0v178avb0jjdm352vad42a1f7a-python3-3.5.2-env.drv’
> failed
>         /home/user/.nix-profile/bin/nix-shell: failed to build all
> dependencies
>
>
> So, how can I develop with local Python packages or package local Python
> modules?
>
>
> Additionally, I've found several broken links:
>   I found several broken links:
>   - buildPythonPackage https://github.com/NixOS/nixpkgs/blob/master/pkgs/
> development/python-modules/generic/default.nix
>   - http://pythonhosted.org/setuptools/setuptools.html#development-mode
>     should probably point to http://setuptools.readthedocs.
> io/en/latest/setuptools.html#development-mode
>   - http://nixos.org/nixpkgs/manual/#ssec-python-development
>     This anchor des not exist; maybe #development-mode is meant.
>   - A link-checker (https://validator.w3.org/checklink) reported even
> more broken links.
>
> best regards
> Roland
>
>
> [1]
> with import <nixpkgs> {};
>
> pkgs.python35Packages.buildPythonPackage rec {
>   name = "toolz-${version}";
>   version = "0.7.4";
>
>   src = pkgs.fetchurl{
>     url = "mirror://pypi/t/toolz/toolz-${version}.tar.gz";
>     sha256 = "43c2c9e5e7a16b6c88ba3088a9bfc82f7db8e13378be7c78d6c14a5f8ed0
> 5afd";
>   };
>
>   meta = {
>     homepage = "http://github.com/pytoolz/toolz/";
>     description = "List processing tools and functional utilities";
>     license = licenses.bsd3;
>     maintainers = with maintainers; [ fridh ];
>   };
> }
>
>
> [2]
> with import <nixpkgs> {};
>
> ( let
>     toolz = pkgs.python35Packages.buildPythonPackage rec {
>       name = "toolz-${version}";
>       version = "0.7.4";
>
>       src = pkgs.fetchurl{
>         url = "mirror://pypi/t/toolz/toolz-${version}.tar.gz";
>         sha256 = "43c2c9e5e7a16b6c88ba3088a9bfc8
> 2f7db8e13378be7c78d6c14a5f8ed05afd";
>       };
>
>       meta = {
>         homepage = "http://github.com/pytoolz/toolz/";
>         description = "List processing tools and functional utilities";
>         license = licenses.bsd3;
>         maintainers = with maintainers; [ fridh ];
>       };
>     };
>
>   in pkgs.python35.withPackages (ps: [ps.numpy toolz])
> ).env
>
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20161221/07d23b62/attachment-0001.html>


More information about the nix-dev mailing list