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

python311Packages.pydantic: 1.10.12 -> 2.3.0 #269633

Merged
merged 30 commits into from
Dec 2, 2023

Conversation

natsukium
Copy link
Member

@natsukium natsukium commented Nov 24, 2023

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Priorities

Add a 👍 reaction to pull requests you find important.

Eval reports

https://gist.github.com/natsukium/3d7429de0b016cf07492f3561331d002

Known issue

@augustebaum
Copy link
Contributor

augustebaum commented Nov 25, 2023

Should also help with python3Packages.pydantic-extra-types (see Hydra failure logs).
EDIT: Verified it works!

@mweinelt
Copy link
Member

Should also help with python3Packages.pydantic-extra-types (see Hydra failure logs).

Which is only broken because I introduced it before reverting pydantic back to 1.x.

@mweinelt
Copy link
Member

mweinelt commented Nov 25, 2023

List of newly failing builds between master and this branch for pkgs/top-level/release-python.nix.

Edit: Excluded builds that failed transitively.

cloudflare-dyndns.x86_64-linux
flare-floss.x86_64-linux
frigate.x86_64-linux
home-assistant-component-tests.lametric.x86_64-linux
home-assistant-component-tests.notion.x86_64-linux
home-assistant-component-tests.peco.x86_64-linux
home-assistant-component-tests.zwave_js.x86_64-linux
khoj.x86_64-linux
octoprint.x86_64-linux
python310Packages.bentoml.x86_64-linux
python310Packages.correctionlib.x86_64-linux
python310Packages.dbt-semantic-interfaces.x86_64-linux
python310Packages.deepwave.x86_64-linux
python310Packages.dependency-injector.x86_64-linux
python310Packages.farm-haystack.x86_64-linux
python310Packages.flask-security-too.x86_64-linux
python310Packages.ha-mqtt-discoverable.x86_64-linux
python310Packages.huum.x86_64-linux
python310Packages.labelbox.x86_64-linux
python310Packages.linear_operator.x86_64-linux
python310Packages.maison.x86_64-linux
python310Packages.pgmpy.x86_64-linux
python310Packages.pycfmodel.x86_64-linux
python310Packages.pyngo.x86_64-linux
python310Packages.pytraccar.x86_64-linux
python310Packages.pytradfri.x86_64-linux
python310Packages.qcs-api-client.x86_64-linux
python310Packages.radios.x86_64-linux
python310Packages.shazamio.x86_64-linux
python310Packages.sqlglot.x86_64-linux
python310Packages.steamship.x86_64-linux
python310Packages.withings-api.x86_64-linux
python310Packages.xbox-webapi.x86_64-linux
python311Packages.bentoml.x86_64-linux
python311Packages.correctionlib.x86_64-linux
python311Packages.dbt-semantic-interfaces.x86_64-linux
python311Packages.deepwave.x86_64-linux
python311Packages.dependency-injector.x86_64-linux
python311Packages.farm-haystack.x86_64-linux
python311Packages.flask-security-too.x86_64-linux
python311Packages.ha-mqtt-discoverable.x86_64-linux
python311Packages.huum.x86_64-linux
python311Packages.labelbox.x86_64-linux
python311Packages.linear_operator.x86_64-linux
python311Packages.maison.x86_64-linux
python311Packages.pgmpy.x86_64-linux
python311Packages.pycfmodel.x86_64-linux
python311Packages.pyngo.x86_64-linux
python311Packages.pytraccar.x86_64-linux
python311Packages.pytradfri.x86_64-linux
python311Packages.radios.x86_64-linux
python311Packages.shazamio.x86_64-linux
python311Packages.steamship.x86_64-linux
python311Packages.withings-api.x86_64-linux
python311Packages.xbox-webapi.x86_64-linux

@mweinelt
Copy link
Member

Wondering if we want to provide pydantic_1 for the time being, so we don't accumulate various unmaintained overrides.

@natsukium
Copy link
Member Author

Wondering if we want to provide pydantic_1 for the time being, so we don't accumulate various unmaintained overrides.

for application?

@mweinelt
Copy link
Member

Looked at home-assistant and frigate, and it gets messy fast. I can upgrade frigate to 0.13.0rc6, but for home-assistant I don't think we can fix things without breaking something else.

@dotlambda
Copy link
Member

for home-assistant I don't think we can fix things without breaking something else

How many overrides would we need to fix home-assistant?

@mweinelt
Copy link
Member

mweinelt commented Nov 28, 2023

Downgrade of aionotion and aiopurpleair, as well as fastapi, which for tests depends on pydantic-settings and pydantic-extra-types, which require pydantic>=2, and this is where I stopped.

commit 222c86ea948b8454314410f76ac05e64ea444e41 (HEAD -> pydantic2)
Author: Martin Weinelt <[email protected]>
Date:   Tue Nov 28 19:49:23 2023 +0100

    home-assistant: pin pydantic_1
    
    and downgrade
    - aionotion to 2023.05.5
    - aiopurpleair 2022.12.1

diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix
index 8f5768fbd2c1..f682cfcf0492 100644
--- a/pkgs/servers/home-assistant/default.nix
+++ b/pkgs/servers/home-assistant/default.nix
@@ -50,6 +50,31 @@ let
         };
       });
 
+      aionotion = super.aionotion.overridePythonAttrs (old: rec {
+        version = "2023.05.5";
+        src = fetchFromGitHub {
+          owner = "bachya";
+          repo = "aionotion";
+          rev = "refs/tags/${version}";
+          hash = "sha256-/2sF8m5R8YXkP89bi5zR3h13r5LrFOl1OsixAcX0D4o=";
+        };
+      });
+
+      aiopurpleair = super.aiopurpleair.overridePythonAttrs (old: rec {
+        version = "2022.12.1";
+        src = fetchFromGitHub {
+          owner = "bachya";
+          repo = "aiopurpleair";
+          rev = "refs/tags/${version}";
+          hash = "sha256-YmJH4brWkTpgzyHwu9UnIWrY5qlDCmMtvF+KxQFXwfk=";
+        };
+        postPatch = ''
+          substituteInPlace pyproject.toml --replace \
+            '"setuptools >= 35.0.2", "wheel >= 0.29.0", "poetry>=0.12"' \
+            '"poetry-core"'
+        '';
+      });
+
       aiowatttime = super.aiowatttime.overridePythonAttrs (oldAttrs: rec {
         version = "0.1.1";
         src = fetchFromGitHub {
@@ -201,6 +226,8 @@ let
         };
       });
 
+      pydantic = super.pydantic_1;
+
       py-synologydsm-api = super.py-synologydsm-api.overridePythonAttrs (oldAttrs: rec {
         version = "2.1.4";
         src = fetchFromGitHub {

@natsukium
Copy link
Member Author

I tried adding a conditional branch to fastapi for in case of pydantic override, and it might work.

commit b27a86adf0c7c3b5e726cb2022214a9bf9a5f4d6
Author: natsukium <[email protected]>
Date:   Tue Nov 28 22:33:12 2023 +0900

    fixup! python311Packages.fastapi: add optional-dependencies for pydantic 2

diff --git a/pkgs/development/python-modules/fastapi/default.nix b/pkgs/development/python-modules/fastapi/default.nix
index 3b4d31e59522..f311c9cc92e7 100644
--- a/pkgs/development/python-modules/fastapi/default.nix
+++ b/pkgs/development/python-modules/fastapi/default.nix
@@ -69,6 +69,7 @@ buildPythonPackage rec {
     orjson
     email-validator
     uvicorn
+  ] ++ lib.optionals (lib.versionAtLeast pydantic.version "2") [
     pydantic-settings
     pydantic-extra-types
   ] ++ uvicorn.optional-dependencies.standard;

@natsukium
Copy link
Member Author

@mweinelt Since aionotion and aiopurpleair are the packages whose main consumer is home-assistant, I have reverted the update. I applied a patch for v1 and v2 support instead.
frigate should be able to build now. (Unfortunately, we need to rebuild tensorflow.😟)

@mweinelt
Copy link
Member

Frigate is fine. Will check on home-assistant in a bit.

Unfortunately, we need to rebuild tensorflow.😟

✔ tensorflow-2.13.0 ⏱ 2h42m18s

😢

@mweinelt

This comment was marked as outdated.

@natsukium natsukium marked this pull request as ready for review December 2, 2023 06:56
@natsukium
Copy link
Member Author

@mweinelt It's ready to be merged into python-updates.

@mweinelt mweinelt merged commit 8b197a5 into NixOS:python-updates Dec 2, 2023
4 of 5 checks passed
@mweinelt
Copy link
Member

mweinelt commented Dec 2, 2023

Thank you for working that out!

@hongquan
Copy link

hongquan commented Jan 4, 2024

You can mark pyngo as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants