Skip to content

Add constraints file support#225

Open
chrissimpkins wants to merge 8 commits intomasterfrom
add-constraints-file
Open

Add constraints file support#225
chrissimpkins wants to merge 8 commits intomasterfrom
add-constraints-file

Conversation

@chrissimpkins
Copy link
Copy Markdown
Contributor

Closes #224

- name: Python environment report
run: python -c "import sys; print(sys.version)"
- name: Run ${{ matrix.python-version }} platform tests (default)
uses: py-actions/py-dependency-install@master
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, the best way to self-test an action is to make a local checkout in the job and call it through a relative path. Here's an example: https://github.com/ansible-community/ansible-test-gh-action/blob/d397b87/.github/workflows/test-action.yml#L144.

Comment thread action.yml
name: "Python Dependency Installation"
description: "Install Python dependencies from requirements.txt file"
inputs:
path: # id
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of removing old input names, it's best to use a deprecationMessage (with this setting, GitHub hints end-users to update gracefully, whenever they run your action) like I did here: https://github.com/pypa/gh-action-pypi-publish/blob/79739dc/action.yml#L12-L23. Of course, this requires a bit of logic elsewhere, to use the old value as a fallback.

Comment thread src/index.js
await exec.exec(`python -m pip install -r ${requirementsPath}`);
} else {
await exec.exec(
`python -m pip install -r ${requirementsPath} -c ${constraintsPath}`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's best to use an env var for this, since pip doesn't bypass constraints to internal ephemeral envs made for building sdists via PEP 517.

Suggested change
`python -m pip install -r ${requirementsPath} -c ${constraintsPath}`
`PIP_CONSTRAINT='${constraintsPath}' python -m pip install -r ${requirementsPath}`

(not sure if this syntax works in JS, you may need to figure out how to pass env vars in a different way...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support constraint files?

2 participants