| 8 Nov 2023 |
@ryoschin:matrix.org | In reply to @k900:0upti.me Then you can use poetry2nix Should I then paste my previous question here, or? | 12:22:09 |
K900 | Just use the example flake in the poetry2nix repo | 12:22:25 |
@ryoschin:matrix.org | Using the flake section is too small for me to spot it.. I swear I thought there was only the shell example! Sorry for wasting your time | 12:23:56 |
@ryoschin:matrix.org | Is there a way to automatically call poetry shell? It seems like MyPy cannot automatically detect packages downloaded via poetry, however when used in poetry shell, it works. | 14:51:51 |
@ryoschin:matrix.org | * Is there a way to automatically call poetry shell? It seems like MyPy cannot automatically detect packages downloaded via poetry, however when used in poetry shell, it can. | 14:52:03 |
@ryoschin:matrix.org | * Is there a way to automatically call poetry shell? It seems like MyPy cannot automatically detect packages downloaded via poetry, however when installed with poetry add mypy and used in poetry shell, it can. | 14:54:22 |
K900 | You should not be installing stuff through poetry at all | 14:56:40 |
K900 | You should just use the Nix shell | 14:56:44 |
K900 | And mypy should respect PYTHONPATH from that | 14:56:49 |
@ryoschin:matrix.org | O-oh... So, I do not use pyproject.toml to specify the dependencies, and instead use flake.nix to specify the python311Packages.package? | 14:59:00 |
K900 | No | 14:59:26 |
K900 | You use pyproject.toml | 14:59:29 |
K900 | Which poetry2nix translates to a Nix shell definition | 14:59:35 |
K900 | (see the example) | 14:59:38 |
K900 | Oh wait | 14:59:56 |
K900 | Shit | 14:59:58 |
K900 | The example is bad | 15:00:01 |
K900 | /me makes a mental note to fix the example | 15:00:08 |
@ryoschin:matrix.org | In reply to @k900:0upti.me Which poetry2nix translates to a Nix shell definition I guess that does explain the point of poetry2nix | 15:00:42 |
@ryoschin:matrix.org | So I must start it with nix-shell? I cannot use flake.nix with direnv to automatically do it? | 15:03:04 |
K900 | You can use flake.nix | 15:03:46 |
K900 | You just need to change the flake a little bit | 15:03:52 |
@petrichor:envs.net | confusingly, the corresponding nixs flakes command to nix-shell is nix develop | 15:04:24 |
@petrichor:envs.net | that should work with a flake that has a devshells.${your system}.default output | 15:04:48 |
@ryoschin:matrix.org | nix flake init --template github:nix-community/poetry2nix
All I did was modify this one by adding some packages. Is it not supposed to work by default, or?
| 15:04:59 |
@ryoschin:matrix.org | In reply to @petrichor:envs.net confusingly, the corresponding nixs flakes command to nix-shell is nix develop Right, and will direnv not do that by default? | 15:05:35 |
K900 | https://github.com/nix-community/poetry2nix/pull/1407 | 15:05:48 |
K900 | Basically add this | 15:05:50 |
@petrichor:envs.net | should do, if your .envrc includes use flake | 15:07:18 |
@ryoschin:matrix.org | [tool.poetry.dependencies]
python = "^3.11"
discord = "^2.3.2"
This is the part where I specify the dependencies. And, while building with direnv, this popped out:
> ModuleNotFoundError: No module named 'setuptools'
| 15:41:44 |