jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
8.28k stars 219 forks source link

PyCharm not using mise environment variables #2167

Open Andrew-Chen-Wang opened 1 month ago

Andrew-Chen-Wang commented 1 month ago

Describe the bug

Hi I have 1) mise environment variables set in [env] and 2) a Python file; on the left, you can see a play button. When I press it, the internal shell that PyCharm spawns doesn't use the environment variables that mise sets.

Screenshot 2024-05-22 at 1 30 09 AM

To Reproduce

Set env variables in .mise.toml, create a Python file in PyCharm that import os; print(os.environ.get("VARIABLE")), then press play.

Expected behavior

The IDE should take advantage of mise's env variable. I'm using zsh, and the terminal grabs the variables just fine. It would be good to know where the environment variables are so that maybe PyCharm has some kind of setting that lets me add the variable paths or where it's set.

mise doctor output

version: 2024.5.20 macos-arm64 (2024-05-21)
activated: yes
shims_on_path: no

build_info: 
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Tue, 21 May 2024 01:40:52 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29) (Homebrew)
  Profile: release

shell: 
  /bin/zsh
  zsh 5.9 (x86_64-apple-darwin23.0)

dirs: 
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/Library/Caches/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files: 
  ~/.config/mise/config.toml
  ~/Work/Code/projects/project/.mise.toml

backends: 
  cargo
  core
  go
  npm
  pipx
  ubi

plugins: 
  bun     (core)
  deno    (core)
  erlang  (core)
  go      (core)
  java    (core)
  node    (core)
  python  (core)
  ruby    (core)
  zig     (core)

toolset: 
  node@20.12.2   
  python@3.12.2  

env_vars: 
  MISE_SHELL=zsh

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "/Users/andrew/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = true

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
No problems found

Additional context Add any other context about the problem here.