Skip to content

Home directory based virtualenvs path (~/directory/path) creates a ~ directory in the project root #1149

@valignatev

Description

@valignatev

Hi!
First of all, thanks a lot for a great tool, I can't say enough how I like it!
Now, to the ticket

Issue

When configuring virtualenvs.path in the ~/.config/pypoetry/config.toml with the tilde to specify (for example, ~/.virtualenvs, Poetry creates a ~/.virtualenws directories in the project root instead. More specifically, considering this project structure:

.
├── proj
│   └── __init__.py
├── poetry.lock
├── pyproject.toml
├── README.rst
└── tests
    ├── __init__.py
    └── test_proj.py

When we do poetry install in the project root, it becomes this:

.
├── ~
│   └── .virtualenvs
├── proj
│   └── __init__.py
├── poetry.lock
├── pyproject.toml
├── README.rst
└── tests
    ├── __init__.py
    └── test_proj.py

The contents of a config.toml:

[settings]
virtualenvs.path = "~/.virtualenvs"

[repositories]

Absolute path in the virtualenvs.path works, of course.

I've found out why this happens. Here: https://github.com/sdispater/poetry/blob/master/poetry/utils/env.py#L202

Without the expanduser call, ~ will be treated like a regular directory name.

This should be pretty easy to fix, so I can submit a PR. I'm not sure though if adding a test would be easy as well, since I'm not very familliar with Poetry test suit yet :)

Let me know if I should do it. Or maybe for some reason you don't want to support ~/ paths :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/configRelated to configuration managementkind/bugSomething isn't working as expectedkind/featureFeature requests/implementations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions