Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python extension does not pickup Nix environment #35

Closed
GuillaumeDesforges opened this issue Nov 6, 2020 · 1 comment
Closed

Python extension does not pickup Nix environment #35

GuillaumeDesforges opened this issue Nov 6, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@GuillaumeDesforges
Copy link

GuillaumeDesforges commented Nov 6, 2020

Describe the bug
The official Python extension does not pickup the environment provided by the shell.nix.

e.g. my nix-shell has black formatter and flake8 in buildInputs, which I can call from the command line after nix-shell, but VS Code still tells me that black and flake8 are not installed.

To Reproduce
Steps to reproduce the behavior:

  1. Create poetry project, e.g. nix-shell -p poetry then poetry init && poetry add -D black
  2. Create shell.nix
let
  pkgs = import <nixpkgs> {};
  python-env = pkgs.poetry2nix.mkPoetryEnv {
    projectDir = ./.;
  };
in
  pkgs.mkShell {
    buildInputs = [
      python-env
    ];
  }
  1. Start VS Code with Python extension, select shell.nix and reload.
  2. Try to format some Python code using black (in VS Code Shift+Alt+F, after setting "python.formatting.provider": "black" in settings)

Expected behavior
VS Code should pickup black from my nix shell

Environment:

  • OS: NixOS 20.03
  • VS Code:
    Version: 1.51.0-insider
    Commit: fce8fc82cacf0b4e2a18c633b6c6f3058702a5c9
    
  • Version: v0.1.2

Additional context
Add any other context about the problem here.

@GuillaumeDesforges GuillaumeDesforges added the bug Something isn't working label Nov 6, 2020
@GuillaumeDesforges
Copy link
Author

I looked at the source code. This extension just defines environment variables for the current process.

const set = (name: string, value: string | undefined) => {
process.env[name] = value;
};

I pushed the issue to upstream.

microsoft/vscode-python#14794

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants