python-poetry / python-poetry/poetry
Creating new virtualenv fails with cryptic error for project with invalid name
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- Poetry version: 1.6.1
- Python version: 3.10
- OS version and name: Ubuntu 22.04
- pyproject.toml: https://gist.github.com/JannisBush/7ce5c2283cb1a9035b5996d706686588
- I am on the latest stable Poetry version, installed using a recommended method.
- 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 (
-vvvoption) and have included the output below.
ubuntu@hp23:~/wpt/_hp$ poetry install -vvv
Creating virtualenv -hp-OMYWa0k7-py3.10 in /home/ubuntu/.cache/pypoetry/virtualenvs
usage: virtualenv [--version] [--with-traceback] [-v | -q] [--read-only-app-data] [--app-data APP_DATA] [--reset-app-data] [--upgrade-embed-wheels] [--discovery {builtin}] [-p py] [--try-first-with py_exe]
[--creator {builtin,cpython3-posix,venv}] [--seeder {app-data,pip}] [--no-seed] [--activators comma_sep_list] [--clear] [--no-vcs-ignore] [--system-site-packages] [--symlinks | --copies] [--no-download | --download]
[--extra-search-dir d [d ...]] [--pip version] [--setuptools version] [--wheel version] [--no-pip] [--no-setuptools] [--no-wheel] [--no-periodic-update] [--symlink-app-data] [--prompt prompt] [-h]
dest
virtualenv: error: argument --prompt: expected one argument
Issue
When trying to install a poetry env with a name starting with - the command fails.
This issue is related to https://github.com/python-poetry/poetry/issues/5794
Probably the best would be to warn that the name is invalid.
Also note that the name was not manually chosen but was set as default based on the folder I was in when running poetry init, that command might want to check the suggest package name as well and block invalid ones.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing poetry install -vvv with a project name beginning with -, then trace the virtualenv creation entry point and the default name generated by poetry init. Done means invalid names are handled clearly before virtualenv reports its cryptic --prompt error, with behavior covering both manually supplied and default project names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100