FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Requirements not found error + fix for error in black by nmenardg-keeper · Pull Request #6 · marian-code/python-lint-annotate · GitHub

Requirements not found error + fix for error in black - #6

Open
nmenardg-keeper wants to merge 5 commits into
marian-code:masterfrom
nmenardg-keeper:requirements-not-found-error
Open

Requirements not found error + fix for error in black#6
nmenardg-keeper wants to merge 5 commits into
marian-code:masterfrom
nmenardg-keeper:requirements-not-found-error

Conversation

nmenardg-keeper commented Jun 16, 2022
edited
Loading

Copy link
Copy Markdown

setup-python action was searching for the requirements.txt file of the linted python project, which in pipenv projects broke the action
and
updated black to get this fix: psf/black#2966

Copy link
Copy Markdown
Owner

Now that I am looking at this, I see a bigger problem.
If we do install requirements.txt than linting with mypy is a lot less usefull since it just ignores missing libraries: missing-imports but that is far from ideal. The checks pass but the user does not know that some may have been silently skipped.

Is see few options here:

  • we have to figure out how to install all dependencies ourselves, maybe add some configurable mypy option where the user could point the action to the requirements file(s). We would also ideally need to take care of other installation tools like poetry
  • second option is to make the user install everything the package requires. But that also has its problems. What if other actions are separated from this one? We are setting our own python version with @setup-python this will overwrite the setup the user has done if I am not mistaken. The @setup-python could be left on the user but then we have to be prepared to handle some non-standard environments whis can be really cumbersome.
  • just state in the README that this action requires a requirements.txt file to be placed in repo even if it should be empty

I am quite short on time and will look into it later, but you could take a shot at this @nmenardg-keeper if you would like :)
Or just let me hear your toughts on this.

Comment thread requirements.txt
@@ -1,4 +1,4 @@
black==21.11b1

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

We also need to update README file

Copy link
Copy Markdown
Author

You're making good points here. Thinking about it, here are the options I see:

  1. User provides a command to run for installing dependencies
    1. Very flexible, but kind of dirty
  2. Let the user do the setup beforehand. setup-python and installing dependencies
    1. To be honest I don't understand the problems you mention here.
  3. Tell the user to generate a requirements.txt file beforehand
    1. this is possible with pipenv requirements, I don't know about other tools like poetry
    2. Very easy on our part
    3. I don't like the idea of asking people to provide an empty requirements.txt that wouldn't help mypy in the end

I'd go with option 3

Comment thread action.yml
run: pip install -r ${{ github.action_path }}/requirements.txt
run: |
pip install -r requirements.txt # project's dependencies
pip install -r ${{ github.action_path }}/requirements.txt # linters

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

setup-python's cache argument was expecting a requirements.txt but is not doing the install

See the example in their readme file:
https://github.com/actions/setup-python#caching-packages-dependencies

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

yeah, i have noticed this as well. Thanks for the fix

nmenardg-keeper deleted the requirements-not-found-error branch June 28, 2022 21:22
nmenardg-keeper restored the requirements-not-found-error branch June 29, 2022 15:34

Copy link
Copy Markdown
Author

Closed by mistake

with:
python-version: "3.8"
- name: Generate requirements.txt file
run: |

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm thinking if shouldn't just do this automatically? Check if the requirements file exists (provided by user). If not, install pipenv and generate dependencies.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If you have time to do that then go ahead, but I don't

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL