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 poetry plugin #46

Merged
merged 13 commits into from
Jan 5, 2022
Merged

Add poetry plugin #46

merged 13 commits into from
Jan 5, 2022

Conversation

nat-n
Copy link
Owner

@nat-n nat-n commented Dec 23, 2021

Based off of #32 by @ThatXliner and refactored a bit.

  • Uses the new command structure support in Poetry 1.2 to register commands with poe as a prefix. Also gives users the option to remove this (in which case they need to be careful not to have tasks that collide with poetry commands), or set it something else like "run " or 'x " etc.
  • Uses the virtualenv from poetry directly rather than calling poetry again in the task subprocess.
  • Uses the default verbosity level from poetry unless it's set in pyproject.toml
  • Includes a best effort hack to make open ended CLI options work with cleo via monkey patching
  • Includes some enhancements for testing code

@nat-n nat-n marked this pull request as draft December 23, 2021 14:14
@nat-n
Copy link
Owner Author

nat-n commented Dec 23, 2021

There's still an open question about how to handle passing of arguments to tasks. This doesn't work out of the box since tasks are registered as commands using cleo as a CLI library. I'm afraid that it may be necessary to refactor poethepoet to use Cleo throughout! Though this might still not help for passing arbitrary args to cmd tasks for instance. I haven't looked into this properly yet.

@ThatXliner
Copy link
Contributor

ThatXliner commented Dec 24, 2021

Ooh this looks promising. So you have the option to make it a prefix now?

Also, I'm a bit confused on the poetry_prefix configuration... What does it do? What does it mean?

@nat-n nat-n force-pushed the feature/14/poetry-plugin branch 25 times, most recently from a56b3a3 to 6ce55c2 Compare December 29, 2021 17:03
@nat-n nat-n force-pushed the feature/14/poetry-plugin branch 3 times, most recently from 38c4d2b to 4ab5d5a Compare December 29, 2021 17:04
@ThatXliner
Copy link
Contributor

Looking good! Haven't tested it on my machine yet.

Looking from the code, I guess you got the plugin to invoke the PoeThePoet object.

@@ -0,0 +1,193 @@
# pylint: disable=import-error
Copy link
Contributor

@ThatXliner ThatXliner Dec 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this? I think this was to silence Pylint from the try/except hack I did before

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this to stop pylint complaining about cleo not being a direct dependency :)

@nat-n
Copy link
Owner Author

nat-n commented Dec 29, 2021

@ThatXliner I think it's almost ready to go. If you could test it out a bit then that would be helpful :)

@nat-n nat-n marked this pull request as ready for review December 29, 2021 17:21
@nat-n nat-n mentioned this pull request Dec 30, 2021
@nat-n nat-n force-pushed the feature/14/poetry-plugin branch from 4ab5d5a to 0bc39aa Compare December 30, 2021 10:52
@nat-n nat-n merged commit e55e7f9 into development Jan 5, 2022
@nat-n nat-n deleted the feature/14/poetry-plugin branch January 5, 2022 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants