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 #1062

Closed
wants to merge 3 commits into from

Conversation

yggi49
Copy link
Contributor

@yggi49 yggi49 commented Apr 28, 2019

This PR is a first attempt at addressing the feature request from issue #704. I did not yet add/fix tests or add documentation, as I would first appreciate some feedback on (a) whether this is welcome at all, and (b) if yes, whether this PR is headed in the right direction.

Summary

This PR introduces a new alias command suite:

  • poetry alias set fnord – define “fnord” as alias for the current project. If a different project already used “fnord” as its alias, the command would abort with a corresponding error message. Note: only one alias can be defined per project—i.e., if poetry alias set ... was called again, the current project’s alias would effectively be renamed.

  • poetry alias show – show the alias that has been defined for the current project.

  • poetry alias list – list all project aliases in alphabetical order along with their assigned project directories.

  • poetry alias go fnord – change to the directory of the project aliased “fnord” and execute poetry shell there to activate the virtualenv. This only works if not already inside an activated virtualenv.

  • poetry alias rm fnord – remove the “fnord” project alias. The alias name is optional for this command; if omitted, the current project’s alias will be removed.

  • poetry alias prune – remove all aliases that no longer point to a project directory.

  • poetry alias clean – remove all alias definitions.

Additionally, poetry init now also asks for a project alias, with the package name being the default value for it. Users can enter a period . if they do not want to set an alias this way.

Internally, all aliases are centrally stored in an aliases.toml file in the virtualenv cache directory, next to envs.toml. This PR’s central piece is the poetry.utils.alias.AliasManager class, with the console commands being thin wrappers around its functionality.

Pull Request Check List

This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!

  • Added tests for changed code.
  • Updated documentation for changed code.

@yggi49
Copy link
Contributor Author

yggi49 commented Jun 14, 2019

@sdispater, is it worth to keep working on this PR?

@brycedrennan brycedrennan added the kind/feature Feature requests/implementations label Aug 16, 2019
@funkyfuture
Copy link
Contributor

seems like this would fit well to use (and test) a coming plugin system, see #1237.

@sdispater
Copy link
Member

Thanks for you contribution!

However, I think this goes beyond the purpose of Poetry (see my comment #704 (comment)).

@sdispater sdispater closed this Nov 1, 2019
Copy link

github-actions bot commented Mar 1, 2024

This pull request 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 1, 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

Successfully merging this pull request may close these issues.

4 participants