python-poetry / python-poetry/poetry-plugin-shell

poetry shell unexpected behavior - spawning the "wrong" shell

Open
#12 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
141
Forks
10
Avg merge
59m
Merged PRs (30d)
3

Description

  • Poetry version: Poetry (version 1.2.1)
  • Python version:
Poetry
Version: 1.2.1
Python:  3.10.5

Virtualenv
Python:         3.10.5
Implementation: CPython
Path:           C:\Users\my_user\AppData\Local\pypoetry\Cache\virtualenvs\pyspark-write-demo-CwtTbJGc-py3.10
Executable:     C:\Users\my_user\AppData\Local\pypoetry\Cache\virtualenvs\pyspark-write-demo-CwtTbJGc-py3.10\Scripts\python.exe
Valid:          True

System
Platform:   win32
OS:         nt
Python:     3.10.5
Path:       C:\Users\my_user\.pyenv\pyenv-win\versions\3.10.5
Executable: C:\Users\my_user\.pyenv\pyenv-win\versions\3.10.5\python.exe
  • I am on the latest stable Poetry version, installed using a recommended method. *I believe that I installed it using pip and that could be the reason of my issue. However, due to certificates issue and Co, I was not able to install poetry using (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

When trying to activate the created environment using poetry -vvv shell I get:

Loading configuration file C:\Users\my_user\AppData\Roaming\pypoetry\config.toml
Loading configuration file C:\Users\my_user\AppData\Roaming\pypoetry\auth.toml
Using virtualenv: C:\Users\my_user\AppData\Local\pypoetry\Cache\virtualenvs\pyspark-write-demo-CwtTbJGc-py3.10
Spawning shell within C:\Users\my_user\AppData\Local\pypoetry\Cache\virtualenvs\pyspark-write-demo-CwtTbJGc-py3.10

C:\Users\my_user\dev\pyspark_write_demo>

The problem is that I get a new type of shell which is not working as I expect. Consider the following screen shot:

image

As you can see, the new prompt is different than the one where I execute poetry shell. In turn, the new shell doesn't have many configurations that I'd have in the original shell (e.g. the nice-looking prompt).

However, if I try to start the environment "directly":

 C:/Users/my_user/AppData/Local/pypoetry/Cache/virtualenvs/pyspark-write-demo-Rmcv68Jg-py3.10/Scripts/Activate.ps1

I get the expected behavior as can be seen in the following image:

image

Why is this happening? What have I configured wrongly with Poetry?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the poetry -vvv shell entry point on Windows 10 and compare its spawned shell with invoking the shown Activate.ps1 path directly. Reproduce the different prompts and environment configuration, then determine the expected shell behavior and verify that the reported configuration difference is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.