Skip to content

.env no longer contributes to Python environment #184

@timthedevguy

Description

@timthedevguy

Type: Bug

Behaviour

Prior to release on 2025/02/11 I could enable the optInto feature named "pythonTerminalEnvVarActivation" and would have any environment variable that is supplied by a local .env file accessible in the terminal to be used by the running python app.

Steps to reproduce:

  1. Create a Python project and .venv, activate the venv as normal
  2. Create a file named .env in the project and add enviornment variables
  3. Add "python.experiments.OptInto": ["pythonTerminalEnvVarActivation"]" to settings
  4. Open new terminal within VSCode
  5. View environment contributions via link in Terminal popup, or import os, os.environ['VAR_NAME'] in interactive python session

Diagnostic data

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

2025-02-11 12:31:50.853 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2025-02-11 12:31:50.853 [info] Experiment 'pythonTestAdapter' is active
2025-02-11 12:31:50.853 [info] Experiment 'pythonRecommendTensorboardExt' is active
2025-02-11 12:31:51.077 [info] > pyenv which python
2025-02-11 12:31:51.077 [info] cwd: .
2025-02-11 12:31:54.001 [info] Discover tests for workspace name: sire - uri: c:\Users\redacted\Projects\Python\sire
2025-02-11 12:31:55.590 [info] Starting Pylance language server.
2025-02-11 12:32:09.933 [info] Discover tests for workspace name: sire - uri: c:\Users\redacted\Projects\Python\sire
2025-02-11 12:33:33.601 [info] Discover tests for workspace name: undefined - uri: c:\Users\redacted\AppData\Roaming\Code\User\profiles\-598afd23\settings.json
2025-02-11 12:36:33.943 [info] Discover tests for workspace name: undefined - uri: c:\Users\redacted\AppData\Roaming\Code\User\profiles\-598afd23\settings.json

Extension version: 2025.0.0
VS Code version: Code 1.97.0 (33fc5a94a3f99ebe7087e8fe79fbe1d37a251016, 2025-02-04T22:41:26.688Z)
OS version: Windows_NT x64 10.0.26100
Modes:

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.9
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): System
  • Value of the python.languageServer setting: Default
User Settings


languageServer: "Pylance"

experiments
• optInto: ["pythonTerminalEnvVarActivation","pythonTestAdapter"]

Installed Extensions
Extension Name Extension Id Version
alpinejs pic 1.0.0
autodocstring njp 0.6.1
autopep8 ms- 2024.2.0
debugpy ms- 2025.0.0
django big 1.0.2
django-html bib 1.3.0
django-intellisense sha 0.0.2
djlint mon 2024.10.0
dotenv mik 1.0.1
flake8 ms- 2024.0.0
format-selection-stub mot 0.0.2
gitlens eam 16.2.2
html-css-class-completion Zig 1.20.0
htmx-v2-tags dan 0.0.8
iis-express war 1.5.0
isort ms- 2023.10.1
js-debug ms- 1.97.0
js-debug-companion ms- 1.1.3
libman adr 1.0.1
markdown-all-in-one yzh 3.6.2
npm ide 1.7.4
open-in-browser tec 2.0.0
powershell ms- 2025.0.0
prettier-vscode esb 11.0.0
pylint ms- 2024.2.0
python ms- 2025.0.0
rainbow-csv mec 3.17.0
rainbow-tags vol 0.4.1
read-urls mur 2.1.0
redis-for-vscode Red 1.2.0
remote-wsl ms- 0.88.5
test-adapter-converter ms- 0.2.1
todo-tree Gru 0.0.226
volar Vue 2.2.0
vsc-python-indent Kev 1.19.0
vscode-azurefunctions ms- 1.16.2
vscode-azureresourcegroups ms- 0.10.4
vscode-django bat 1.15.0
vscode-docker ms- 1.29.4
vscode-edit-csv jan 0.11.2
vscode-fontawesome-gallery tom 0.0.7
vscode-gitflow Ser 1.3.27
vscode-github-actions git 0.27.1
vscode-html-css ecm 2.0.13
vscode-icons vsc 12.11.0
vscode-js-profile-table ms- 1.0.10
vscode-markdownlint Dav 0.58.2
vscode-mdx-preview xyc 0.3.3
vscode-pylance ms- 2025.2.1
vscode-python-envs ms- 0.3.10421010
vscode-python-test-adapter lit 0.8.2
vscode-test-explorer hbe 2.22.1
vscode-thunder-client ran 2.34.0
vscode-yarn gam 2.1.0
System Info
Item Value
CPUs 12th Gen Intel(R) Core(TM) i5-12600KF (16 x 3686)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.84GB (14.30GB free)
Process Argv --folder-uri file:///c%3A/Users/redacted/Projects/Python/evetools --crash-reporter-id 55e8d7b9-404f-4260-840a-36bf2b8177f5
Screen Reader no
VM 0%

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionality

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions