Comments (8)
I use caching in my project with following setting:
In definition of the github action job:
- uses: actions/cache@v3
name: Cache .venv
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
Add poetry.toml file in root of project with following settings:
[virtualenvs]
create = true
in-project = true
How does it work:
- With settings in poetry.toml, virtual environment is being created inside project in .venv folder
- I do cache .venv folder based on hash of my poetry.lock file, which contains current dependencies
- When my CI job stars, I can see following:
Run actions/cache@v3
with:
path: ./.venv
key: venv-1cdf[2]
enableCrossOsArchive: false
fail-on-cache-miss: false
lookup-only: false
Received 855004 (100.0%), 144.3 MBs/sec
Cache Size: ~82 MB (85500470 B)
/usr/bin/tar -xf /home/runner/work/_temp/8cca7c6a-f27b-448d-8c10-5f718fafd2ed/cache.tzst -P -C
Cache restored successfully
Cache restored from key: venv-1cdf2[9]
# poetry install
Installing dependencies from lock file
No dependencies to install or update
Using this, when dependencies do not change in build, I do not have to download and install it again, but I can skip this step and do testing.
from actions-poetry.
I am neither owner nor contributer to this repo.
It is more up to @abatilo what should or should not be in his project readme :)
from actions-poetry.
Sorry for the delay here. I was traveling for work.
I think it makes sense that the original workflow steps would fail. You are trying to reference the poetry cash in this step that installs Python but poetry hasn't actually been installed yet. So there's a chicken and egg problem.
Installing Python and then installing poetry and then doing the cache steps make sense to me.
I would definitely be open to a pull request that adds the guidance to the readme.
Thank you both
from actions-poetry.
I am neither owner nor contributer to this repo.
It is more up to abatilo what should or should not be in his project readme :)Forgive me for the confusion 👍
Beside that, does the workflow proposed in #64 (comment) seem ok to you?
It looks good.
from actions-poetry.
🎉 This issue has been resolved in version 2.4.0 🎉
The release is available on GitHub release
Your semantic-release bot 📦🚀
from actions-poetry.
🙏 thank you very much for your comprehensive explanation 😃
Just to make sure I got it right, can you confirm that the steps would be in the following order, please?
name: Python package
# ...
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version-file: '.python-version'
- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.5.1
- uses: actions/cache@v3
name: Cache .venv
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install project dependencies
run: poetry install
- name: Run automated tests
run: poetry run pytest -v
Is that ok?
[edit: it seems to work as expected like this - @kosinal I would like to write a pull-request which would add a section in the README file explaining the process of caching the virtual environment: what do you think? Would that be of interest to you?]
[edit2: hi @abatilo; would you be interested in a pull-request adding a section in the README file to document how to combine actions-poetry with actions/cache for faster poetry install
calls?]
from actions-poetry.
I am neither owner nor contributer to this repo.
It is more up to abatilo what should or should not be in his project readme :)
Forgive me for the confusion 👍
Beside that, does the workflow proposed in #64 (comment) seem ok to you?
from actions-poetry.
hi @abatilo
I created this PR: #65. Feel free to comment and amend it 😃
from actions-poetry.
Related Issues (20)
- Support under-specified Python versions HOT 2
- Mount ssh agent socket to docker container HOT 1
- Support macos and windows os
- Add caching HOT 4
- Installation error with Python 3.5 and `ubuntu-latest` HOT 2
- Cache poetry installation itself HOT 3
- V2 only usable via branchname specification instead of versioned action HOT 4
- change default to install latest (no version specification)
- add documentation about configs, parameters, examples
- This action pip installs poetry HOT 1
- It does not seem to work with python 3.10 HOT 5
- If someone create a PR with ( or ) in the title it breaks the tool HOT 1
- Addition of major version tags HOT 2
- Install Failure Bug HOT 3
- dependabot upgrades to version 3.7.4 of this GH-action HOT 2
- windows self hosted runner - Windows Subsystem for Linux has no installed distributions.
- pipx: command not found in v3 action HOT 15
- PermissionError Installing pycparser HOT 4
- Python version not respected on macOS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from actions-poetry.