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

Unexpected dependency on requests #93

Open
wichert opened this issue Oct 11, 2024 · 4 comments
Open

Unexpected dependency on requests #93

wichert opened this issue Oct 11, 2024 · 4 comments

Comments

@wichert
Copy link

wichert commented Oct 11, 2024

For various reasons I had to switch to a new custom runner for GitHub actions, and this broke actions-rust-language/audit:

Cache restored from key: cargo-audit-v0.20.0
Run import audit
Traceback (most recent call last):
  File "/runner/_work/_temp/192418c1-d8d4-4dc8-b912-a20d707d5c75.py", line 1, in <module>
    import audit
  File "/runner/_work/_actions/actions-rust-lang/audit/v1/audit.py", line 8, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

would it be possible to use urllib so that there are no extra dependencies needed? Alternatively documenting this requirement, or vendoring requests (or do this with urllib3, since it has no other dependencies) are also options.

@wichert wichert changed the title Unexpected dependency on requets Unexpected dependency on requests Oct 11, 2024
@jonasbb
Copy link
Member

jonasbb commented Oct 11, 2024

Hi, thanks for the reports. Yes, there is definitely a documentation gap and the requirements could be listed better.

All the actions in https://github.com/actions-rust-lang target the GitHub runners. Mainly, because that is the only environment available to test them. I happily accept PRs to improve the situation here.

Regarding the specific dependency: urllib is not a suitable replacement. Switching to urllib3 would be fine, but that is not part of the Python distribution either. Vendoring is too complicated.
Another solution would be to add a check and install step if dependencies are missing, e.g., perform a python3 -m pip install --user requests or similar.

@jonasbb
Copy link
Member

jonasbb commented Oct 11, 2024

I added some information about the dependencies to the readme
https://github.com/actions-rust-lang/audit/blob/main/README.md#dependencies

@wichert
Copy link
Author

wichert commented Oct 12, 2024

@jonasbb can you explain why urllib is not a suitable replacement? I'ld be happy to try to submit a PR to use that, so there are no external dependencies.

@jonasbb
Copy link
Member

jonasbb commented Oct 12, 2024

urllib is quite low-level and does not offer the same features as requests. The added usability (e.g., encoding) and features (e.g., connection pooling) of requests are quite wanted.

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

No branches or pull requests

2 participants