Skip to content

feat: relax outdated dependency constraints for gcloud and mock#3420

Open
hiro-o918 wants to merge 2 commits intospotify:masterfrom
hiro-o918:chore/relax-outdated-deps
Open

feat: relax outdated dependency constraints for gcloud and mock#3420
hiro-o918 wants to merge 2 commits intospotify:masterfrom
hiro-o918:chore/relax-outdated-deps

Conversation

@hiro-o918
Copy link
Copy Markdown
Contributor

@hiro-o918 hiro-o918 commented Apr 16, 2026

Description

Relax outdated version constraints in pyproject.toml.

Package Before After
google-api-python-client >=1.6.6,<2.0 >=2.0
google-auth ==1.4.1 >=2.0
google-auth-httplib2 ==0.0.3 >=0.2
httplib2 (transitive) >=0.22 (added; used directly in bigquery.py / gcs.py)
mock <2.0 unconstrained

Pins like google-auth==1.4.1 (2018) and mock<2.0 blocked security updates and constrained downstream resolution. Upper bounds dropped — luigi is a library and CI will catch regressions.

Also fixes a latent test bug in test/contrib/s3_test.py that was masked by mock<2.0: called_with (without assert_ prefix) is a no-op attribute access, and sts_mock.client.assume_role referenced the wrong child mock. With mock>=2.0 this is detected and raises AttributeError.

- gcloud group:
  - google-api-python-client: >=1.6.6,<2.0 -> >=2.0
  - google-auth: ==1.4.1 -> >=2.0
  - google-auth-httplib2: ==0.0.3 -> >=0.2
  - add httplib2>=0.22 (used directly by luigi.contrib.bigquery and gcs)
- common and visualizer groups:
  - mock: <2.0 -> unconstrained (the <2.0 cap dates back to Python 2 era)

Pin-style constraints like google-auth==1.4.1 (2018) blocked security
updates and made dependency resolution unnecessarily strict for downstream
users. Upper bounds are dropped following the recommendation that libraries
should avoid them; CI will catch breaking changes when they happen.

Signed-off-by: Hironori Yamamoto <mr.nikoru918@gmail.com>
@hiro-o918 hiro-o918 requested review from a team and dlstadther as code owners April 16, 2026 17:14
@hiro-o918 hiro-o918 marked this pull request as draft April 16, 2026 17:17
`sts_mock.client.assume_role.called_with(...)` was a no-op:
- `.client` is a child mock that was never set up by the patch
- `called_with` (without `assert_` prefix) is just an attribute access, not an assertion

The correct call site is `boto3.client("sts")` so the patched mock should be
asserted via `sts_mock.return_value.assume_role.assert_called_with(...)`.

This bug was previously hidden by `mock<2.0` which silently accepted
arbitrary attribute access. With `mock>=2.0` the unsafe attribute name
is detected and raises AttributeError.

Signed-off-by: Hironori Yamamoto <mr.nikoru918@gmail.com>
@hiro-o918 hiro-o918 marked this pull request as ready for review April 16, 2026 17:25
Comment thread pyproject.toml
Comment on lines +109 to +112
"google-api-python-client>=2.0",
"google-auth>=2.0",
"google-auth-httplib2>=0.2",
"httplib2>=0.22",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I do worry that by these not defining upper bounds that major releases will be allowed through and break things without warning. However, it would be limited only to users installing luigi[gcloud].

Would you be opposed to setting upper bounds on major version here?

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.

2 participants