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

Introduce GitHub Action to install project requirements #139

Merged
merged 2 commits into from
May 28, 2024

Conversation

rmartin16
Copy link
Member

@rmartin16 rmartin16 commented May 28, 2024

Changes

  • Introduces composite action to install specific requirements from a project's pyproject.toml

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

All looks fairly straightforward; two suggestions around argument handling that might help avoid surprises in the future.

extra:
description: "Name of the optional dependencies marker; e.g. dev."
required: false
default: ""
Copy link
Member

Choose a reason for hiding this comment

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

Checking that I'm reading this right - if you don't specify extra as an argument, this manifests as --extra "" in the final arguments, right? Would it be worth gating the --extra argument with an if inputs.extra?

Copy link
Member Author

@rmartin16 rmartin16 May 28, 2024

Choose a reason for hiding this comment

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

The default value of extra within the install_requirement.py script is an empty string. So, passing --extra an empty string at the command-line is equivalent to not specifying --extra at all. With that, we can control specifying --extra at the command-line but it's effectively duplicating effort the script already handles.

Copy link
Member Author

Choose a reason for hiding this comment

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

That said...

         python -m install_requirement ${{ inputs.requirements }} \
-          --extra "${{ inputs.extra }}" \
+          ${{ inputs.extra && format('--extra {0}', inputs.extra) || '' }} \
           --project-root "$(printf -- "%q" "${{ steps.paths.outputs.project-root }}")"

@rmartin16 rmartin16 force-pushed the install-requirement-action branch 2 times, most recently from 122f70c to 4f15cd1 Compare May 28, 2024 23:27
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

👍

@rmartin16 rmartin16 merged commit 724f15f into main May 28, 2024
63 checks passed
@rmartin16 rmartin16 deleted the install-requirement-action branch May 28, 2024 23:55
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.

2 participants