tn-venv-create-activate
A tn-venv plugin that activates the new environment when creating a new one.
$ tn-venv .venv
==> creating virtual environment at C:\project\.venv
==> activating C:\project\.venv in a new powershell shell — type 'exit' to leave
(.venv) PS C:\project> # ← you land here, already activated
(.venv) PS C:\project> exit # ← back to your original shell, untouched
Install
pip install tn-venv-create-activate
Why a subshell?
A child process cannot rewrite the environment block of its parent shell —
that is why plain tn-venv can only print an activation hint. The
standard workaround (used by pipenv shell and poetry shell) is to spawn
a fresh interactive shell with the environment already activated, which is
exactly what this plugin does at the end of every successful creation.
Exiting the subshell returns you to your original, unmodified shell.
Installation
$ pip install tn-venv-create-activate
The plugin registers itself through the tn_venv.plugins entry-point
group, so any tn-venv invocation in the same Python environment picks it
up automatically — no configuration needed.
How it works
After the environment has been created, the activation scripts written, and
pip seeded (session_end hook), the plugin detects the shell you are
typing in and spawns it with the environment activated:
| shell | mechanism |
|---|---|
| cmd.exe | cmd.exe /K activate.bat |
| PowerShell | powershell/pwsh -NoExit -File Activate.ps1 |
| bash | bash --rcfile <temp rc that sources activate> -i |
| zsh | ZDOTDIR temp dir whose .zshrc sources yours, then activate |
| fish | fish -i -C "source activate.fish" |
| other | PATH/VIRTUAL_ENV set directly, shell spawned interactively |
Script-based modes get the full feature set of the generated activation
scripts (deactivate, prompt prefix, PYTHONHOME bookkeeping). The
generic fallback still gives you a working prompt where python/pip
resolve into the new environment, but without a deactivate helper — use
exit, which always works.
The plugin stays out of the way when it should:
- non-interactive sessions (pipelines, CI, the tn-venv GUI host) are left alone — stdin/stdout must both be TTYs;
- if the target environment is already the active one, nothing happens;
- if the shell cannot be detected, a warning with the manual activation path is printed instead.
Configuration
| Variable | Effect |
|---|---|
TN_VENV_CREATE_ACTIVATE |
0 / no / false / off disables the plugin (e.g. in CI) |
TN_VENV_CREATE_ACTIVATE_SHELL |
Force the shell: a name (cmd, powershell, pwsh, bash, zsh, fish, …) or a full path |
Shell detection without the override walks the process tree to find the
nearest ancestor that is a known shell, then falls back to $SHELL
(POSIX), %ComSpec% (Windows), and finally /bin/sh.
License
Tokenoodle-Everything License 1.0 — see License.txt. This is not an OSI-approved license; commercial use is prohibited.
Metadata
Release files for tn-venv-create-activate 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tn_venv_create_activate-0.1.0.tar.gz | 10.5 kB | Without provenance | Details for tn_venv_create_activate-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tn_venv_create_activate-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for tn_venv_create_activate-0.1.0-py3-none-any.whl |
Total release size: 21.9 kB
Release files / tn_venv_create_activate-0.1.0.tar.gz
| Download URL | tn_venv_create_activate-0.1.0.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64b69a02b0ea769d1075ac48a9c2a558d4d75c7ecd08761e47f80db0f6620e77
|
|
BLAKE2b-256 checksum How to use checksums |
04edd21aac1c817ca70a1f3b90e93f1ce43ab94b16f3d6ec911c691214f5609f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / tn_venv_create_activate-0.1.0-py3-none-any.whl
| Download URL | tn_venv_create_activate-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a79d36d7ce2a0065da228c0dd0b689c59ecc9092da5af6e4988dfbbc94ad7f4f
|
|
BLAKE2b-256 checksum How to use checksums |
89c74669f60cb388c03cf1de3edb5f72b2b1aab3b9c9adba130c4d6a5bad93f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for tn-venv-create-activate 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.