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

Build Pydantic wheels with old Cython #101976

Merged
merged 4 commits into from
Oct 22, 2023

Conversation

joostlek
Copy link
Member

Proposed change

Build Pydantic wheels with old Cython.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@home-assistant home-assistant bot added cla-signed Hacktoberfest small-pr PRs with less than 30 lines. labels Oct 13, 2023
@@ -179,6 +179,7 @@ jobs:

touch requirements_old-cython.txt
cat homeassistant/package_constraints.txt | grep 'grpcio==' >> requirements_old-cython.txt
cat homeassistant/package_constraints.txt | grep 'pydantic==' >> requirements_old-cython.txt
Copy link
Member

Choose a reason for hiding this comment

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

We should get a comment above like we have for grpcio referencing the issue

@bdraco
Copy link
Member

bdraco commented Oct 13, 2023

We should merge this, but this won't actually fix it because we have wheels for 1.10.13 up on wheels already that were built with the wrong cython.

After this merges we need to:

  • wipe the wheels for 1.10.13 from wheels.home-assistant.io
  • change the package constraint to 1.10.13 in new pr (pushed to this repo as branch), and manually trigger a wheel build
  • than we can merge the constraint change pr

@frenck
Copy link
Member

frenck commented Oct 14, 2023

Why would we do that? As in, we can't bump pydantic, as we have to take into account Core installation methods?

../Frenck

@bdraco
Copy link
Member

bdraco commented Oct 14, 2023

Why would we do that? As in, we can't bump pydantic, as we have to take into account Core installation methods?

../Frenck

This change would get v1 updates unblocked for all the other install methods. core remains broken for new installs (see below for more details and limitations) and still has to wait for either pydantic issue 7689 to get fixed or for us to switch to pydantic 2.x when all the libraries are ready.

Backstory:

  • pydantic does not use an isolated environment to build wheels and will use the system installed cython even though their code does not work with cython 3

  • core install is currently broken for anyone who compiles it manually, and this PR will not fix it because the pydantic v1 does not work with cython >= 3.x. Even worse, some of the vendors are distributing the broken cython 3 compiled wheels as well (see more details in the pydantic issue)

  • The issue that joostlek opened is a bit stuck Argument 'bases' has incorrect type pydantic/pydantic#7689

  • The ideal solution would be to upgrade core to use pydantic 2.x as the problem just goes away. Unfortunately that means every library that was built on pydantic 1.x needs to add the import shims (tracked via Pydantic v2 migration issue #99218) ala

try:
    from pydantic.v1 import ValidationError
except ImportError:
    from pydantic import ValidationError  # type: ignore

@frenck frenck force-pushed the pydantic_old_cython branch from f980652 to cf18f3d Compare October 22, 2023 14:58
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @joostlek 👍

../Frenck

@frenck frenck merged commit e936ca0 into home-assistant:dev Oct 22, 2023
50 checks passed
@joostlek joostlek deleted the pydantic_old_cython branch October 22, 2023 20:39
@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed Hacktoberfest small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants