python-lint-annotate icon indicating copy to clipboard operation
python-lint-annotate copied to clipboard

Requirements not found error + fix for error in black

Open nmenardg-keeper opened this issue 3 years ago • 3 comments

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: https://github.com/psf/black/pull/2966

nmenardg-keeper avatar Jun 16 '22 16:06 nmenardg-keeper

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.

marian-code avatar Jun 21 '22 09:06 marian-code

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

nmenardg-keeper avatar Jun 21 '22 14:06 nmenardg-keeper

Closed by mistake

nmenardg-keeper avatar Jun 29 '22 15:06 nmenardg-keeper