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

use templates or resolve env vars in python.default_packages_file #2820

Open
m0lson84 opened this issue Oct 26, 2024 · 3 comments
Open

use templates or resolve env vars in python.default_packages_file #2820

m0lson84 opened this issue Oct 26, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@m0lson84
Copy link

Describe the bug

When installing a new version of Python the python.default_packages_file setting does not seem to be used to fine the path to the default packages file. This seems to be the case for both the TOML setting and environment variable.

To Reproduce

  • Create a default packages file in a non-default path (example: ~/.config/mise/python) and set the python.default_packages_file setting to the same path.
  • Install a new version of Python.
    • Should not attempt to install default packages.
  • Create a new default packages file in the default path (~/.default-python-packages)
  • Install a new version of Python.
    • Should now install default packages

Expected behavior

Expect the overridden default packages file path to be used when installing a new Python version.

Contents of config.toml

[tools]
go     = "1.23"
node   = "lts"
python = "3.13"

[settings]
env_file                 = ".env"
experimental             = true
go_default_packages_file = "${XDG_CONFIG_HOME}/mise/golang"

[settings.python]
default_packages_file = "${XDG_CONFIG_HOME}/mise/python"

mise doctor output

version: 2024.10.10 linux-x64 (2024-10-25)
activated: yes
shims_on_path: yes

build_info:
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS
  Built: Fri, 25 Oct 2024 20:58:39 +0000
  Rust Version: rustc 1.82.0 (f6e511eec 2024-10-15) (Homebrew)
  Profile: release

shell:
  /usr/bin/zsh
  zsh 5.8.1 (x86_64-ubuntu-linux-gnu)

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

config_files:
  ~/.config/mise/config.toml

backends:
  cargo
  core
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:

toolset:
  [email protected]
  [email protected]
  [email protected]

env_vars:
  MISE_ENV_FILE=.env
  MISE_GO_DEFAULT_PACKAGES_FILE=~/.config/mise/golang
  MISE_NODE_DEFAULT_PACKAGES_FILE=~/.config/mise/nodejs
  MISE_PYTHON_DEFAULT_PACKAGES_FILE=~/.config/mise/python
  MISE_SHELL=zsh

settings:
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cache_prune_age = "30d"
  ci = false
  color = true
  debug = false
  disable_backends = []
  disable_default_registry = false
  disable_hints = []
  disable_tools = []
  env_file = ".env"
  experimental = true
  fetch_remote_versions_cache = "1h"
  fetch_remote_versions_timeout = "10s"
  go_default_packages_file = "~/.config/mise/golang"
  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
  http_timeout = "30s"
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  log_level = "info"
  not_found_auto_install = true
  paranoid = false
  pin = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "~/.default-python-packages"
  quiet = false
  raw = false
  trace = false
  trusted_config_paths = []
  use_versions_host = true
  verbose = false
  yes = false

  [cargo]
  binstall = true

  [node]

  [pipx]
  uvx = false

  [python]
  default_packages_file = "~/.default-python-packages"
  pyenv_repo = "https://github.com/pyenv/pyenv.git"
  venv_auto_create = false
  venv_stdlib = false

  [ruby]
  default_packages_file = "~/.default-gems"
  ruby_build_repo = "https://github.com/rbenv/ruby-build.git"
  ruby_install = false
  ruby_install_repo = "https://github.com/postmodern/ruby-install.git"

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false
No warnings found
No problems found
@m0lson84 m0lson84 added the bug Something isn't working label Oct 26, 2024
@jdx
Copy link
Owner

jdx commented Oct 26, 2024

this is a feature request, you can't use env vars like that in the field

@jdx jdx added enhancement New feature or request and removed bug Something isn't working labels Oct 26, 2024
@jdx jdx changed the title python.default_packages_file path not used when installing a new Python version use templates or resolve env vars in python.default_packages_file Oct 26, 2024
@m0lson84
Copy link
Author

Understood that I can't use ${XDG_CONFIG_HOME} in the config.toml, but I am still seeing a difference in overriding the configuration of the Python plugin compared to the others that I'm using (go and node). I've updated my config to use absolute paths (showing ~ to denote home dir).

[tools]
go     = "1.23"
node   = "lts"
python = "3.13"

[settings]
env_file = ".env"
experimental  = true
go_default_packages_file = "~/.config/mise/golang"

[settings.python]
default_packages_file = "~/.config/mise/python"

This is the relevant portions from mise doctor:

toolset:
  [email protected]
  [email protected]
  [email protected]

env_vars:
  MISE_ENV_FILE=.env
  MISE_NODE_DEFAULT_PACKAGES_FILE=~/.config/mise/nodejs
  MISE_SHELL=zsh

settings:
  go_default_packages_file = "~/.config/mise/golang"
  python_default_packages_file = "~/.default-python-packages"

  [python]
  default_packages_file = "~/.default-python-packages"

I would expect to see both python_default_packages_file and python.default_packages_file to be the value provided in my config.toml.

@m0lson84
Copy link
Author

I'm very much a noob when it comes to Rust, but I'd be happy to try my hand at creating a PR for this to gain more experience if that would be okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants