Skip to content

Fix Python 3.9 tests by freezing Pandas at v2.2.3 #990

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

mgyucht
Copy link
Contributor

@mgyucht mgyucht commented Jun 13, 2025

What changes are proposed in this pull request?

In the 2.3.0 release of pandas, there was an issue with the Python 3.9 release causing pd.__version__ to have a different structure than normal (see pandas-dev/pandas#61579 for details). The mocking framework used by the SDK, pyfakefs, implements special mocking for Pandas and requires that the Pandas version have form major.minor.patch. This isn't the case for this release, causing failures during test setup.

This PR addresses this by freezing dependencies of the Python SDK for testing. make dev will now install the frozen dev dependencies. make dev-latest will install the latest version, simply running pip install ".[dev]". The lock file can be updated manually by running make update-dev-dep-lockfile. For Python 3.9, we pin tests to use pandas version 2.2.3, as the latest version interacts poorly with pyfakefs.

Additionally, unit tests will now run against both the frozen and latest dependencies. Failures will only be blocking on frozen dependencies; the unfrozen dependencies will serve as an early warning system that something has broken that we may need to look into.

The Makefile contains additional information about how tests are run and how to update the requirements-dev-*.txt files for each Python version.

How is this tested?

N/A.

NO_CHANGELOG=true

@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 11:54 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 11:54 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 11:55 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 11:55 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 12:00 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 12:01 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 12:58 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 12:59 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:05 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:06 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:07 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:08 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:10 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:11 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:16 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:17 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:25 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:25 — with GitHub Actions Inactive
Makefile Outdated
# done

dev-env:
python -m venv .venv$(PYTHON_VERSION_NO_DOTS)
Copy link
Contributor

@renaudhartert-db renaudhartert-db Jun 13, 2025

Choose a reason for hiding this comment

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

IIUC, the python version in that environment will be the one used to run that command, which might be different from the one specified in the environment name. Is that an issue?

dev:
python3 -m venv .venv
# Detect Python version from the system
PYTHON_VERSION := $(shell python3 -c 'import sys; print(f"{sys.version_info.major}{sys.version_info.minor}")')
Copy link
Contributor

Choose a reason for hiding this comment

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

I was actually going to comment about not fixing the version but you fixed it already :-)

@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:45 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 13:46 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 14:16 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 13, 2025 14:16 — with GitHub Actions Inactive
This reverts commit 8f9e7f8.
@mgyucht mgyucht temporarily deployed to test-trigger-is June 16, 2025 09:56 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 16, 2025 09:57 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 16, 2025 09:57 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 16, 2025 09:58 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 16, 2025 10:11 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 16, 2025 10:11 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 16, 2025 10:22 — with GitHub Actions Inactive
@mgyucht mgyucht temporarily deployed to test-trigger-is June 16, 2025 10:22 — with GitHub Actions Inactive
htmlcov
.python-version
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just making sure my usage of pyenv doesn't accidentally pollute the repo.

@@ -16,6 +16,7 @@ exclude NEXT_CHANGELOG.md
exclude tagging.py
exclude .package.json
exclude .release_metadata.json
exclude requirements-dev-*.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ensures the requirements files are not unnecessarily bundled in the source wheel file.

Copy link
Contributor

@renaudhartert-db renaudhartert-db Jun 20, 2025

Choose a reason for hiding this comment

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

It's a shame we cannot add a comment in the manifest to make that clear

@mgyucht mgyucht requested a review from renaudhartert-db June 16, 2025 11:45
Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 990
  • Commit SHA: 0d21811cec3e3af15be7574c005bbce59f572f25

Checks will be approved automatically on success.

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