poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Activate `requires-plugins` from a project without using `poetry install`

Open tungol opened this issue 1 year ago • 10 comments

Issue Kind

Change in current behaviour

Description

I have a use case where I currently copy the pypoetry.toml and poetry.lock files into a docker container and then run poetry export. In order to install the export plugin, I looked at using the tool.poetry.requires-plugins section, but it looks like that's only checked when the project is installed. It'd be nice if there was a way to ensure all required project plugins were installed without installing the project itself. That could either be a new command or maybe poetry self install could be changed to install project plugins as well.

Impact

This would improve the flexibilty of the tool.poetry.requires-plugins configuration option.

Workarounds

I worked around the issue by installing poetry-plugin-export explicitly in my dockerfile, but it'd be nice if there was a more generic way to accomplish this.

tungol avatar Jan 07 '25 22:01 tungol

Maybe poetry install --no-root is the answer to your issue? I don't think we can install plugins without installation.

Secrus avatar Jan 08 '25 09:01 Secrus

I think I have the same request. I have a project with a CI job that requires use of poetry-plugin-export to run poetry export, and I want that plugin/command to be available without installing all of the project's requirements. I basically want to tell poetry "please install the plugins declared in pyproject" and see only those plugins installed. So far, I have not found solution other than explicitly invoking poetry self add poetry-plugin-export, but I don't like this redundancy.

poetry install --no-root does not solve this problem; that still installs all the project's requirements.

infinitewarp avatar Jan 08 '25 16:01 infinitewarp

So, you would want something like poetry install --only-plugins?

Secrus avatar Jan 08 '25 16:01 Secrus

Yeah, I think that's exactly what I'm looking for.

tungol avatar Jan 08 '25 19:01 tungol

My CI job broke and I landed here. Would be nice to have this!

nachiket-lab avatar Feb 19 '25 13:02 nachiket-lab

My CI job broke and I landed here. Would be nice to have this!

nachiket-lab avatar Feb 19 '25 13:02 nachiket-lab

For another perspective, I use poetry to export to requirements.txt in a Dockerfile so that I can use sam build (which sadly only supports requirements.txt). Previously, this could be achieved by copying over the pyproject.toml and poetry.lock files and then running poetry export. Now, poetry install has to run before poetry export can be used which means waiting for everything and plugins to install even though only the plugins are needed.

resetheadhard avatar Mar 01 '25 01:03 resetheadhard

@Secrus Do you have any timeline for implementing the requested feature?

MatthijsBurgh avatar Mar 14 '25 08:03 MatthijsBurgh

For anyone running into the case, I suggest using poetry install --dry-run as a work around — it's exactly a more verbose version of a plugin-only installation, despite its original intention to be a dry run.

stevapple avatar Mar 19 '25 15:03 stevapple

This has come up in #10043 and was previously tracking this as it related to #6154. I would like this for poetry-git-version-plugin. Maybe someone else here can answer what is the right workflow for building?

Historically we've ensured poetry was installed and just called build. Should we be calling poetry install before calling poetry build?

bmagistro avatar May 09 '25 16:05 bmagistro