install-poetry icon indicating copy to clipboard operation
install-poetry copied to clipboard

Add support to install poetry plugins

Open pbk0 opened this issue 3 years ago • 7 comments

Poetry 1.2+ will now support plugins. It will be a good idea to support installing plugins if the poetry version is 1.2+. That is by adding the below lines to the main.sh script:

<...>
plugins=$7
<...>
poetry plugin add $plugins
<...>

pbk0 avatar Sep 19 '21 02:09 pbk0

Thanks for bringing this up @pbk0 👏

I just have a few questions, in case you already know:

  • What happens when you run poetry plugin add <plugin>? Does it make changes to the lockfile or does it start a process separate from the normal poetry install?
  • How can I test plugin installation locally? I tried this, without luck:
❯ poetry self update --preview            
Updating Poetry to 1.2.0a2

Updating dependencies
Resolving dependencies... (4.3s)

Package operations: 0 installs, 1 update, 0 removals

  - Updating charset-normalizer (2.0.5 -> 2.0.6)

Updating the poetry script

Poetry (1.2.0a2) is installed now. Great!

❯ poetry plugin add poetry-version-plugin
The command "plugin" is not defined.

sondrelg avatar Sep 19 '21 07:09 sondrelg

Can you make sure if you have multiple poetry installations? (try which/where poetry) Also, I am assuming the poetry installation is isolated. I faced some issues with stale poetry installations. So maybe clean things up and then try installing 1.2.0a2 Below script might be useful

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py > get-poetry.py
python get-poetry.py --uninstall
rm get-poetry.py

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py > install-poetry.py
python install-poetry.py --uninstall
python install-poetry.py --version 1.2.0a2
rm install-poetry.py

poetry --version

BTW the plugin gets installed in isolation alongside isolated poetry installation and it does not mess up with local installations lockfile.

How can I test plugin installation locally? I tried this, without luck:

If I am correct this can happen only if poetry is installed via pip instead of install-poetry.py script

pbk0 avatar Sep 19 '21 09:09 pbk0

I think you were right about dual installations, got it to work now 👍

So the solution would just be something like specifying:

- uses: snok/install-poetry@v1
  with:
    version: 1.2.0a2
    plugins: |
        poetry-plugin-a
        poetry-plugin-b

or

- uses: snok/install-poetry@v1
  with:
    version: 1.2.0a2
    plugins: poetry-plugin-a, poetry-plugin-b

or

- uses: snok/install-poetry@v1
  with:
    version: 1.2.0a2
    plugins: poetry-plugin-a poetry-plugin-b

Where the plugins inputs should be parsed as a list, and installed in main.sh by running poetry plugin add {parsed list}?

That sounds doable 👍

Would you be interested in creating a PR for this @pbk0?

sondrelg avatar Sep 19 '21 10:09 sondrelg

Yes, it's doable. I will try and send you PR. Anyways the plugins are a new feature and don't expect it to stabilize soon.

pbk0 avatar Sep 19 '21 22:09 pbk0

May I ask about the status of this feature? I see the issue was closed, but I'm not sure if the feature was implemented.

PS - thanks for creating this plugin. I'm a recent convert to the Poetry ecosystem, it's awesome.

connortann avatar Feb 04 '22 14:02 connortann

The feature was not implemented, so re-opening 👍 I don't have time to implement this currently, but a PR is very welcome 🙂

sondrelg avatar Feb 04 '22 16:02 sondrelg

I'd be happy to attempt a PR!

~~Quick question: what is the purpose of main.sh, should that be updated too? It appears to duplicate the installation script in action.yml , and I'm not sure if/how it gets invoked.~~

EDIT: Ah, it's explained in scripts/README.md . So, looks like just action.yml should be updated with new features.

connortann avatar Feb 04 '22 17:02 connortann