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

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

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

Conversation

nmenardg-keeper
Copy link

@nmenardg-keeper nmenardg-keeper commented Jun 16, 2022

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

@marian-code
Copy link
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.

@@ -1,4 +1,4 @@
black==21.11b1
Copy link
Owner

Choose a reason for hiding this comment

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

We also need to update README file

@nmenardg-keeper
Copy link
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

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
Author

Choose a reason for hiding this comment

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

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
Owner

Choose a reason for hiding this comment

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

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

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

Closed by mistake

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

Choose a reason for hiding this comment

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

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
Author

Choose a reason for hiding this comment

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

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

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.

None yet

2 participants