I am trying to deploy a function to CDF using the deploy-functions-oidc repo in Github. It works perfectly fine for other functions, but for functions using the “requests” library i get the following error during pre-commit: “Library stubs not installed for requests. Hint: “python3 -m pip install types-requests”. I have included both requests and types-requests in the requirement.txt file. Anyone experienced the same issue?
Solved
Error in deploying functions using 'requests' library through Github actions
Best answer by Ivar Stangeby
Right, so - the type checker `mypy` is running sandboxed in the pre-commit, so it does not know about the types installed in your environment. To have `mypy` aware of `types-requests` you can add it as additional dependencies in the `.pre_commit_config.yaml`.
```
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.2
hooks:
- id: mypy
additional_dependencies: ['types-requests']
```
Let me know if this does not solve it for you, and I’d be happy to help further!
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.