Skip to content

docs: clarify Python venv mechanisms, JAVA_HOME behavior, and activation performance#8928

Merged
jdx merged 8 commits intomainfrom
docs/python-venv-java-home-perf
Apr 5, 2026
Merged

docs: clarify Python venv mechanisms, JAVA_HOME behavior, and activation performance#8928
jdx merged 8 commits intomainfrom
docs/python-venv-java-home-perf

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Apr 5, 2026

Summary

Based on patterns found in ~1600 GitHub discussions from the past year:

Python virtualenvs (most common confusion topic — #5228, #7252, #8321, #8376):

  • Add comparison table for _.python.venv vs python.uv_venv_auto so users know which to use
  • Warn that they have separate code paths (e.g., uv_venv_create_args only applies to _.python.venv)
  • Add inline config example for python.uv_venv_auto
  • Note that venv activation requires mise activate — shims alone don't add venv to PATH

JAVA_HOME (#4827, #6283, #7625):

  • Add dedicated section explaining JAVA_HOME is set automatically but requires mise activate
  • Add troubleshooting for stale JAVA_HOME after version switch

Activation performance (#4821, #6279, #7042):

  • Add diagnostic tip to the existing Performance section for slow prompts

Test plan

  • Verify docs render correctly with mise run docs

🤖 Generated with Claude Code


Note

Low Risk
Low risk: documentation-only updates clarifying activation/shims behavior, virtualenv mechanisms, and how to profile slow prompts; no runtime or config logic changes.

Overview
Clarifies that some environment-dependent behaviors require full activation: adds a JAVA_HOME section to the Java docs (including a quick fix for stale values) and notes that shims alone won’t set env vars.

Reworks Python virtualenv docs to distinguish _.python.venv vs python.uv_venv_auto (with a comparison table, warnings about separate option paths, and an inline python.uv_venv_auto example), plus a tip that venv PATH activation requires mise activate/mise exec rather than shims.

Adds a new troubleshooting section for diagnosing slow shell prompts using MISE_TIMINGS, and links to it from the shims performance discussion.

Reviewed by Cursor Bugbot for commit c7ce79b. Bugbot is set up for automated code reviews on this repo. Configure here.

jdx and others added 2 commits April 5, 2026 18:16
…ion performance

Python venvs:
- Add comparison table for _.python.venv vs python.uv_venv_auto
- Explain when to use each mechanism
- Warn that they have separate code paths and settings
- Add shims limitation note for venv activation
- Add inline example for python.uv_venv_auto setting

Java:
- Add JAVA_HOME section explaining it requires mise activate
- Add troubleshooting for stale JAVA_HOME after version switch

Performance:
- Add diagnostic tip for slow prompts (_.source scripts, MISE_TRACE)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace generic advice with specific instructions to use
MISE_TIMINGS=1 (or =2 for detailed breakdowns) to identify
what's causing slow prompt latency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation for mise, focusing on performance troubleshooting, JAVA_HOME configuration for Java, and Python virtual environment management. Key additions include a comparison table for Python venv mechanisms and troubleshooting tips for shell latency. A review comment correctly identified a naming inconsistency in a warning message regarding uv_create_args and provided a suggestion to align it with the configuration examples.

Comment thread docs/lang/python.md Outdated
**`python.uv_venv_auto`** is designed for uv-managed projects. It detects an existing `.venv` created by `uv` and sources it. Use `"source"` to only activate existing venvs, or `"create|source"` to create if missing.

::: warning
These are separate mechanisms with different code paths. Settings like `python.uv_venv_create_args` only apply to `_.python.venv` (when uv is installed), not to `python.uv_venv_auto`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The warning refers to python.uv_venv_create_args, but the configuration examples below (lines 77 and 81) use python_create_args and uv_create_args. Additionally, these are options for the _.python.venv directive rather than global settings. It would be more accurate to reference the option names used in the examples.

Suggested change
These are separate mechanisms with different code paths. Settings like `python.uv_venv_create_args` only apply to `_.python.venv` (when uv is installed), not to `python.uv_venv_auto`.
These are separate mechanisms with different code paths. Options like uv_create_args only apply to _.python.venv (when uv is installed), not to python.uv_venv_auto.

jdx and others added 3 commits April 5, 2026 18:20
Without clearing __MISE_DIFF/__MISE_SESSION/__MISE_WATCH, hook-env
short-circuits and doesn't show meaningful timing data. Add the
unset step and show both MISE_TIMINGS=1 and =2 with proper flags.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The slow prompt diagnostics are about mise activate, not shims.
Move to a dedicated "Slow shell prompts" section in troubleshooting
with a link from the shims performance section.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Unsetting state vars in an activated shell triggers hook-env on the
next prompt before the user can run their manual command. Use
bash --norc instead to get a clean measurement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 5, 2026

Greptile Summary

This docs-only PR adds three new sections and refactors an existing one across four documentation files to address the most common user confusion patterns found in GitHub discussions.

Python venv: The virtualenv section is restructured with a comparison table (python.uv_venv_auto vs _.python.venv), separate subsections for each mechanism, a warning that their code paths don't share options, and a tip clarifying that shims alone don't add venv/bin/ to PATH. Java JAVA_HOME: A new section fills an existing documentation gap — explaining that JAVA_HOME is only set with mise activate, with a cd . workaround for stale values and CI/IDE guidance. Slow prompts: A new #slow-shell-prompts section adds MISE_TIMINGS=1/2 diagnostics, verified correct against src/timings.rs (output goes to stderr; 2>&1 >/dev/null is the right redirect). The mise deactivate command exists and works correctly when called from an activated shell. All technical claims in the new content were cross-checked against the source code.

Confidence Score: 5/5

Docs-only PR is safe to merge; all technical claims verified against source code

No code changes, no P0/P1 issues found. All new content (MISE_TIMINGS behavior, mise deactivate, JAVA_HOME export, uv_venv_auto values) was cross-checked against src/timings.rs, src/cli/deactivate.rs, src/plugins/core/java.rs, and src/config/settings.rs. Only open concern (uv_venv_create_args accuracy) was already addressed in a prior review thread.

No files require special attention

Important Files Changed

Filename Overview
docs/dev-tools/shims.md Single-line cross-reference to new slow-shell-prompts troubleshooting anchor added at end of Performance subsection
docs/lang/java.md New JAVA_HOME section added: explains mise activate requirement, stale-value workaround, IDE restart note, and CI/scripts guidance
docs/lang/python.md Virtualenv section restructured with comparison table, per-mechanism subsections, code-path warning, and shim limitation tip
docs/troubleshooting.md New Slow shell prompts section with MISE_TIMINGS=1/2 workflow, mise deactivate pre-step, common causes, and shims tradeoff link

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User wants automatic\nvirtualenv activation] --> B{Is it a uv project?\ne.g. has uv.lock}
    B -- Yes --> C[python.uv_venv_auto\nin \[settings\]]
    B -- No --> D[_.python.venv\nin \[env\] section]
    C --> E['source' — activate existing .venv\n'create|source' — create if missing]
    D --> F[path + create + python_create_args\nor uv_create_args]
    E --> G[Requires mise activate\nor mise exec]
    F --> G
    G --> H[Shims alone do NOT\nadd venv/bin/ to PATH]
Loading

Reviews (3): Last reviewed commit: "docs: fix deactivate usage and don't cla..." | Re-trigger Greptile

Comment thread docs/lang/python.md
Simpler approach: deactivate mise first so the prompt hook won't
re-trigger, then run hook-env with MISE_TIMINGS manually.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jdx jdx force-pushed the docs/python-venv-java-home-perf branch from 8607a6c to 61149fc Compare April 5, 2026 18:26
jdx and others added 2 commits April 5, 2026 18:27
Reference the actual _.python.venv option names (uv_create_args,
python_create_args) instead of the unrelated global setting name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mise deactivate outputs shell commands directly like activate,
no eval needed. Also reword shims suggestion since shims just move
the cost to tool invocation rather than reducing it.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 5, 2026

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.4 x -- echo 17.4 ± 0.5 16.3 19.2 1.00
mise x -- echo 17.9 ± 0.5 16.9 19.8 1.03 ± 0.04

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.4 env 16.9 ± 0.4 16.1 21.9 1.00
mise env 17.4 ± 0.7 16.4 24.3 1.03 ± 0.05

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.4 hook-env 17.5 ± 0.4 16.6 19.3 1.00
mise hook-env 18.4 ± 0.6 17.2 25.1 1.05 ± 0.04

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.4.4 ls 16.8 ± 0.5 15.6 19.4 1.00
mise ls 17.0 ± 0.4 15.6 18.2 1.01 ± 0.04

xtasks/test/perf

Command mise-2026.4.4 mise Variance
install (cached) 116ms 116ms +0%
ls (cached) 65ms 67ms -2%
bin-paths (cached) 68ms 68ms +0%
task-ls (cached) 706ms 698ms +1%

@jdx jdx enabled auto-merge (squash) April 5, 2026 18:47
@jdx jdx merged commit 2169607 into main Apr 5, 2026
37 checks passed
@jdx jdx deleted the docs/python-venv-java-home-perf branch April 5, 2026 19:08
mise-en-dev added a commit that referenced this pull request Apr 6, 2026
### 🚀 Features

- **(config)** report env files in config ls and doctor output by
@SamSoldatenko in [#8853](#8853)
- add support for token sources in GitLab and Forgejo by @roele in
[#8868](#8868)

### 🐛 Bug Fixes

- **(aqua)** prevent double .exe extension when Windows override URL
already ends in .exe by @yusei-wy in
[#8863](#8863)
- **(bash)** avoid duplicate trust warning after cd by @timothysparg in
[#8920](#8920)
- **(env)** prevent config root injection into PATH via _.source by @jdx
in [#8936](#8936)
- **(install)** suppress spurious dependency warning when tool is
configured by @jdx in [#8923](#8923)

### 📚 Documentation

- **(node)** add section on pinning npm version by @jdx in
[#8925](#8925)
- add Windows default paths and mise.toml examples alongside CLI
commands by @jdx in [#8926](#8926)
- clarify common sources of confusion from GitHub discussions by @jdx in
[#8927](#8927)
- clarify Python venv mechanisms, JAVA_HOME behavior, and activation
performance by @jdx in [#8928](#8928)
- add FAQ and troubleshooting entries based on common Discord questions
by @jdx in [#8930](#8930)

### New Contributors

- @SamSoldatenko made their first contribution in
[#8853](#8853)
- @yusei-wy made their first contribution in
[#8863](#8863)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant