Skip to content

Commit a3f2e6e

Browse files
authored
Pass extra arguments to poetry install (#8)
* Add customizable install args * Document install-args option
1 parent d9efabb commit a3f2e6e

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ jobs:
8787
poetry run pytest
8888
```
8989
90+
## Advanced usage
91+
92+
### Passing extra arguments to `poetry install`
93+
94+
By default the action will install your dendencies with `poetry install --no-interaction --no-root` You can specify extra arguments with `install-args`, e.g.
95+
96+
```yml
97+
- name: "Setup Python, Poetry and Dependencies"
98+
uses: packetcoders/action-setup-cache-python-poetry@main
99+
with:
100+
python-version: "3.12"
101+
poetry-version: "1.6.1"
102+
install-args: --all-extras
103+
```
104+
to install any optional dependencies alongside the required ones.
105+
90106
## License
91107

92108
The scripts and documentation in this project are released under the [MIT License](LICENSE).

action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
poetry-version:
1212
description: Poetry Version
1313
required: true
14+
install-args:
15+
description: Extra arguments to `poetry install`
16+
required: false
17+
default: ''
1418

1519
runs:
1620
using: "composite"
@@ -46,7 +50,7 @@ runs:
4650
uses: actions/cache@v3
4751
with:
4852
path: .venv
49-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
53+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}${{ inputs.install-args }}
5054
# Restore cache with this prefix if not exact match with key
5155
# Note cache-hit returns false in this case, so the below step will run
5256
restore-keys: |
@@ -57,4 +61,4 @@ runs:
5761
- name: Install dependencies
5862
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
5963
shell: bash
60-
run: poetry install --no-interaction --no-root
64+
run: poetry install --no-interaction --no-root ${{ inputs.install-args }}

0 commit comments

Comments
 (0)