Skip to content

Commit

Permalink
Pass extra arguments to poetry install (#8)
Browse files Browse the repository at this point in the history
* Add customizable install args

* Document install-args option
  • Loading branch information
jvansanten authored Jan 7, 2024
1 parent d9efabb commit a3f2e6e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ jobs:
poetry run pytest
```
## Advanced usage
### Passing extra arguments to `poetry install`

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.

```yml
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: "3.12"
poetry-version: "1.6.1"
install-args: --all-extras
```
to install any optional dependencies alongside the required ones.

## License

The scripts and documentation in this project are released under the [MIT License](LICENSE).
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
poetry-version:
description: Poetry Version
required: true
install-args:
description: Extra arguments to `poetry install`
required: false
default: ''

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

0 comments on commit a3f2e6e

Please sign in to comment.