Comments (7)
We would very much like to use this action, because it will be a huge speed improvement as compared to pulling our pre-baked CI docker image. However, we absolutely need dependency management support - and specifically poetry. So sadly we can't switch until some kind of poetry support is implemented...
from setup-python.
I opened a PR that adds poetry to the virtual environments
actions/runner-images#3293
from setup-python.
I probably wouldn't install the project dependencies in the same step as setting up python, but it would be nice if the action included the major package managers. Like the node action includes yarn.
Although I think it would be better if the package manager was added at the image layer, which yarn is.
https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
from setup-python.
We ended up creating an action to install Poetry after setting up Python - it's still faster than pulling a complete pre-baked docker image with the operating system:
https://github.com/moneymeets/action-setup-poetry
Adding poetry to the base action images would of course only make it better!
from setup-python.
They closed my PR, as they think because poetry only takes a few seconds to install, it is not needed in the action image, and using actions is better.
from setup-python.
Like many of you, I also immediately run an "install dependencies" step after running this action, thus I've created a composite action:
name: 'Set up python'
description: 'Set up GitHub Actions workflow with a version of Python configured with our settings'
inputs:
python-version:
description: "Version range or exact version of Python to use, using SemVer's version range syntax"
required: false
default: '3.9'
python-requirements-file:
description: "Path to the python requirements file"
required: false
default: 'requirements.txt'
outputs:
python-path:
description: "The absolute path to the Python executable"
value: '${{ steps.python.outputs.python-path }}'
python-version:
description: "The installed and configured Python version"
value: '${{ steps.python.outputs.python-version }}'
cache-hit:
description: "A boolean value to indicate a cache entry was found"
value: '${{ steps.python.outputs.cache-hit }}'
runs:
using: composite
steps:
- id: python
uses: actions/setup-python@v4
with:
token: '${{ env.GITHUB_TOKEN }}'
python-version: '${{ inputs.python-version }}'
cache: 'pip'
cache-dependency-path: '${{ inputs.python-requirements-file }}'
- id: libxmlsec1-dev
run: sudo apt-get update && sudo apt-get --assume-yes install pkg-config libxmlsec1-dev
shell: bash
- id: requirements
run: pip install --exists-action w --requirement "${{ inputs.python-requirements-file }}"
shell: bash
The action documentation states:
The action has built-in functionality for caching and restoring dependencies. It uses toolkit/cache under the hood for caching dependencies but requires less configuration settings. Supported package managers are
pip
,pipenv
andpoetry
. Thecache
input is optional, and caching is turned off by default.The action defaults to searching for a dependency file (
requirements.txt
for pip,Pipfile.lock
for pipenv orpoetry.lock
for poetry) in the repository, and uses its hash as a part of the cache key. Inputcache-dependency-path
is used for cases when multiple dependency files are used, they are located in different subdirectories or different files for the hash that want to be used.
This means that the inputs to run the "install dependencies" step are already available, at least for the currently supported package managers, thus this action could execute it in one go.
from setup-python.
My usual take on this is that actions should follow the Unix philosophy. But in this case, by adding built-in dependency caching, we’ve already tightly coupled with the popular Python package managers. We'd welcome a PR for this if anyone wants to take that on.
from setup-python.
Related Issues (20)
- Intermittent failures during Post Setup Python step for MacOS HOT 4
- Unable to locate 'pip' when using cache HOT 6
- python-3.7.17-darwin-x64 has broken readline module due missing libncurses HOT 1
- `setup-python` failing for 3.8 on `macos-latest` HOT 5
- Fails on Rocky Linux distro, missing `lsb_release` HOT 6
- Getting `A new release of pip is available: 21.1.1 -> 24.0` on `macos-latest` HOT 6
- Psycopg2 install/build fails when imported python 3.13beta1 - cpython-313-x86_64-linux-gnu.so: undefined symbol: _PyInterpreterState_Get HOT 3
- setup-python@v4 fails for Python 3.10.14 on Mac OS 14 (latest) ARM 64 runner HOT 4
- Python 3.5 setup fails with an invalid certificate when running pip HOT 5
- 3.10.14-9004012336/python-3.10.14-linux-22.04-x64.tar.gz issue HOT 1
- Python 3.5 20.04 tool bundle not installable HOT 3
- Multiple Python versions as a comma-separated list HOT 1
- Non Portable binary, doesn't work with sudo or without LD_LIBRARY_PATH HOT 3
- Custom setuptools version HOT 9
- Cannot load Python modules if they are in a directory named "test" HOT 1
- Python 3.7/8/9/10 on Darwin runners fails: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib HOT 5
- Setups HOT 1
- My pro HOT 1
- Missing support for Python 3.8 on Ubuntu 24.04 runner HOT 1
- Caching doesn't seem to save that much time HOT 2
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 setup-python.