Skip to content

RES-1160 | Drop the requests dependency, use stdlib urllib - #50

Open
alexrecuenco-hf wants to merge 2 commits into
hellofresh:masterfrom
alexrecuenco-hf:fix/global-python-dependency
Open

RES-1160 | Drop the requests dependency, use stdlib urllib#50
alexrecuenco-hf wants to merge 2 commits into
hellofresh:masterfrom
alexrecuenco-hf:fix/global-python-dependency

Conversation

@alexrecuenco-hf

Copy link
Copy Markdown

Summary

neo.py runs directly against whatever python3 is on the runner's PATH — the composite action never runs actions/setup-python or installs any dependencies (see action.yml). It only worked because requests happened to be preinstalled on GitHub-hosted ubuntu-latest runners (which is also why this repo's own CI, which runs on ubuntu-latest, never caught it).

On leaner/custom self-hosted runner images without requests preinstalled globally, this action fails with:

ModuleNotFoundError: No module named 'requests'

Rather than pushing every consumer to provision requests globally on their runner images, this replaces the one place requests is used (a couple of authenticated GETs against the compare API, with Link-header pagination) with urllib.request from the standard library. No behavior change, no new dependency to manage — the action now works on any Python 3 runner out of the box.

Test plan

  • ./neo/tests.py TestChangedFiles -v — all unit tests pass unchanged
  • ./neo/tests.py IntegrationTest -v — both integration tests pass against the real GitHub API, including test_pagination, which exercises the rewritten Link header parsing/pagination against this repo's own commit history
  • Confirmed no remaining references to requests anywhere in the repo

neo.py imports requests but the composite action runs it directly via
the runner's global python3, without ever installing dependencies
(no setup-python, no pip install step). This only worked by accident
on runners whose global python happens to have requests preinstalled
(e.g. GitHub-hosted ubuntu-latest, which is also why this repo's own
CI never caught it). Self-hosted runners with a leaner base image
don't have it, and the action fails with ModuleNotFoundError.

Since the only use of requests here is a couple of authenticated GET
requests with Link-header pagination, urllib.request covers it without
adding a dependency the action has no way to install for itself.
Comment thread neo/neo.py
@alexrecuenco-hf alexrecuenco-hf changed the title Drop the requests dependency, use stdlib urllib RES-1160 | Drop the requests dependency, use stdlib urllib Aug 5, 2026
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.

3 participants