dream2nix icon indicating copy to clipboard operation
dream2nix copied to clipboard

The Python devShell is missing all of the Python package dependencies

Open exarkun opened this issue 2 years ago • 2 comments
trafficstars

With a brand new dream2nix, generated by following the instructions on https://nix-community.github.io/dream2nix/guides/getting-started-python.html#build-the-project, the devShell is missing most of what it should have.

For example:

flake.nix:

{
  inputs.dream2nix.url = "github:nix-community/dream2nix";
  outputs = inp:
    inp.dream2nix.lib.makeFlakeOutputs {
      systems = [ "x86_64-linux" ];
      config.projectRoot = ./.;
      source = ./.;
      projects = ./projects.toml;
    };
}

projects.toml:

[tahoe-lafs]
name = "tahoe-lafs"
relPath = ""
subsystem = "python"
translator = "pip"

[tahoe-lafs.subsystemInfo]
pythonVersion = "3.10"
❯ nix develop
❯ python
Python 3.10.7 (main, Sep  5 2022, 13:12:31) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import twisted
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'twisted'
>>> import attrs
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'attrs'
>>> import foolscap
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'foolscap'
>>> import zfec
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'zfec'
>>> 

All of the test dependency modules are missing too:

>>> import hypothesis
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'hypothesis'
>>> import testtools
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'testtools'
>>> import pytest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pytest'
>>> import paramiko
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'paramiko'
>>> import coverage
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'coverage'
>>> 

If the results of pip can be trusted in this environment then there's essentially nothing installed:

❯ pip freeze
poetry-core @ file:///build/source/dist/poetry_core-1.1.0-py3-none-any.whl

(poetry_core is not a Tahoe-LAFS dependency, at least not directly...)

I would expect the devShell to include Python itself (which it does) as well as all of the project's declared "install_requires" dependencies. It would be nice to be able to have the project's declared "test" extras dependencies too.

exarkun avatar Jan 26 '23 15:01 exarkun

Is there any update on this issue? I am facing exactly the same. The build works fine but not the development.

LEXUGE avatar Jun 27 '23 06:06 LEXUGE

@LEXUGE With this tweak, this branch of Poetry2Nix ends up with the packages in its dev-shells. Perhaps the same hack can be applied here?

Dessix avatar Jul 18 '23 06:07 Dessix