-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Poetry plugin #14
Comments
Or maybe just |
@ThatXliner It'll depend on what the poetry plugin API supports in the end. Though I suspect that probably won't be possible :/ |
A plugin system was merged a while back python-poetry/poetry#3733 Looks exciting |
we can create arbitrary classes (with So something like from cleo.commands.command import Command
from poetry.plugins.application_plugin import ApplicationPlugin
class PoePlugin(ApplicationPlugin):
def activate(self, application):
for task_name in get_poe_task_names(): # Assume this function exists somewhere
application.command_loader.register_factory(
task_name,
lambda x: type(
task_name.capitalize() + "Command",
(Command),
{"name": task_name, "handle": lambda self: run_poe_task(self.name)},
# Also assume `run_poe_task` accepts task name as an argument, runs that poe task
# and returns the return code of the poe task
),
) |
Any news on this ? 😄 |
Hi @billsioros, I haven't had time to look into it much yet, though this feature probably required a bit of refactoring, so it's currently blocked on some other in progress features. Hard to give in ETA right now. |
I have tried implementing this. Haven't tested it yet |
Ok, just tested. My PR should work now. |
As @nat-n pointed out, this obviously depends on what the plugin api supports, but I suppose this would basically involve being a fallback where if there isn't another poetry command that the poe command list is checked. Anyway, I would love to see this plugin happen! though it still looks like we are waiting on poetry 1.2 for plugins to be possible. |
Well poetry 1.2 is now out along with plugin docs! |
@acalvino4 I've been working on this #46 . It's almost ready, but could use some help with testing from this branch if you're game? https://github.com/nat-n/poethepoet/tree/feature/14/poetry-plugin By default tasks are invoked like Poetry 1.2 is still in alpha. The implementation requires some hacking around limitations of cleo the CLI framework that poetry uses, hopefully it's stable enough already that it won't break before 1.2 is released. |
0.12.0 has just been released and supports using poe as a poetry plugin. In addition to running poe tasks through poetry, it also uses poetry's events API to support registering tasks as hooks to be run before or after other poetry commands. |
The roadmap for poetry includes a plugin system python-poetry/poetry#1237 which should allow for poe to run inside the poetry CLI.
Creating a Poe the Poet plugin for poetry would ideally entail that the exact same config in the pyproject.toml could be used to the same effect either via the existing poe CLI, or via poe running as a poetry plugin and invoked via the the poetry CLI.
It'll probably look something like:
poetry poe test
which would be functionally equivalent to the following but with a shorter command a perhaps a minor performance boost:
poetry run poe test
The text was updated successfully, but these errors were encountered: