Skip to content

Add pew style project management to peotry #704

@sametmax

Description

@sametmax
  • [ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureFeature requests/implementations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions