trying to avoid env installation for ruff#2
Conversation
|
As mentioned, with a cached environment this is probably not super important, but I'd still avoid loading/risking installing a whole environment if it's not needed. Thanks again Rouven for all of this, so cool! :) |
SmartMonkey-git
left a comment
There was a problem hiding this comment.
Looks good. Only two wishes ✨
| - name: Get project version with yq | ||
| id: get_python_version | ||
| uses: mikefarah/yq@v4.46.1 | ||
| with: | ||
| cmd: yq '.project.requires-python' pyproject.toml | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5.6.0 | ||
| with: | ||
| python-version: ${{ steps.get_python_version.outputs.result }} |
There was a problem hiding this comment.
Would not add them in here. Either another action or put them directly into the jobs. Since, when I run this action, I would not expect it to setup python for me.
There was a problem hiding this comment.
Not sure I understand, we need python and pip to install and run ruff... I think I am misunderstanding your comment
There was a problem hiding this comment.
Yes, you need python, but it would also be unexpected if it installed the version found in my pyproject toml, because it promises just install a package.
…o the action can be reused
|
Actually, I found that there is a ruff action, that does already, what you implemented. :/ https://github.com/marketplace/actions/ruff-action Should we keep what you have? |
.github/workflows/ci.yaml
Outdated
| @@ -41,7 +41,10 @@ jobs: | |||
| fetch-depth: 0 | |||
|
|
|||
| - name: Setup Env | |||
There was a problem hiding this comment.
This and the linting action is not named correctly. :)
| with: | ||
| cmd: yq '.project.requires-python' pyproject.toml | ||
|
|
||
| - name: Set up Python |
There was a problem hiding this comment.
Can you do a check here if python is already installed?
There was a problem hiding this comment.
Put the installation of python from pyproject.toml into its own action:
https://github.com/SmartMonkey-git/robinson-group-python-template/blob/bebd65e622957bee96e4ca043e0ff5cc1b4468d9/.github/actions/python_from_pyproject/action.yaml
Could you please us it? :)
The action was also depended on the pypoject.toml. No its not anymore
Try ruff action
# Conflicts: # .github/actions/setup_env/action.yaml
As we were discussing elsewhere:
"The idea of skipping to set up the whole environment came from here, all the way at the bottom (they do it with tox.ini but that does not matter):
https://pythonspeed.com/articles/pylint-flake8-ruff/
But we are already caching the environment so I don't expect much difference in practice."