Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add constraints file support #225

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

chrissimpkins
Copy link
Contributor

Closes #224

@@ -23,13 +23,13 @@ jobs:
- 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

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.

@@ -1,11 +1,15 @@
name: "Python Dependency Installation"
description: "Install Python dependencies from requirements.txt file"
inputs:
path: # id

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.

await exec.exec(`python -m pip install -r ${requirementsPath}`);
} else {
await exec.exec(
`python -m pip install -r ${requirementsPath} -c ${constraintsPath}`

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