Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pew style project management to peotry #704

Closed
sametmax opened this issue Dec 5, 2018 · 6 comments
Closed

Add pew style project management to peotry #704

sametmax opened this issue Dec 5, 2018 · 6 comments
Labels
kind/feature Feature requests/implementations

Comments

@sametmax
Copy link

sametmax commented Dec 5, 2018

  • [ X] I have searched the issues of this repo and believe that this is not a duplicate.

Issue

pew, an alternative way to manage virtualenv, has a "project" feature. You give a name to a virtualenv (pew new venv_name), then tie this name to the directory (pew setproject .). You can then activate the virtualenv from anywhere doing pew workon venv_name. It will activate the venv whether you are in the project dir or not. If you are not in the project dir, it will cd you to the project dir. It will do so even if the virtualenv is already activated.

Poetry doesn't work by virtualenv name though, so the feature would need a tweak. We could imagine it as a alias, with an API like:

$ poetry alias name src_dir # give a name to the directory / virtualenv pair
$ poetry aliases # list all name + src directory + venv dir
$ poetry go name  # activate venv and cd to the src dir 
$ poetry rmaliase name # remove the alias
$ poetry init # also prompt for the project alias name

Because poetry init already asks for a package name, it can offer to use this name as an alias by default, provided it's not already used elsewhere (which will happen if you have several versions of the same code lying around). Of course the user is free to type in whatever he or she wants, and should be able to disable the automatic cd.

This does require a persistent setting file in the user directory to list all aliases (is it ok to put it in config.toml ?), and some error handling for the case where an alias reference a missing project.

yggi49 added a commit to yggi49/poetry that referenced this issue Apr 28, 2019
@brycedrennan brycedrennan added the kind/feature Feature requests/implementations label Aug 9, 2019
@brycedrennan
Copy link
Contributor

I'm not familiar with pew. Is the value-add here is that poetry would remember where a project is so that developers can quickly cd to it?

@sametmax
Copy link
Author

sametmax commented Aug 16, 2019 via email

@sdispater
Copy link
Member

I think this goes beyond the purpose of Poetry. However, once the plugin system (see #1237) is ready that might be a good fit for it.

@zvolsky
Copy link

zvolsky commented Jan 26, 2021

In fact this is a single reason why I need virtualenvwrapper together with poetry.
This makes me problems with use of non-poetry virtualenv (virtualenvwrapper creates venvs in ~/.virtualenvs) and I sure would prefer the poetry way of venvs management because here is good integration with pyenv.
However the workon <project> is too worth for me. So I still use the old style venvs :(

So it would be really nice to have poetry workon ... (or poetry go ... as proposed here).
I think the idea of alias presented here could be good.
But it should be a little more analyzed how it could integrate with poetry/pyenv possibility to have 2+ venvs for 1 project but for 2+ different python versions.

@yggi49
Copy link
Contributor

yggi49 commented Dec 5, 2021

I think this goes beyond the purpose of Poetry. However, once the plugin system (see #1237) is ready that might be a good fit for it.

I just made a first attempt at that. If you are interested, check out poetry-alias—feedback appreciated.

Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations
Projects
None yet
Development

No branches or pull requests

5 participants