From ef8462dbca40bc497df0712265a2588bef5a8c93 Mon Sep 17 00:00:00 2001 From: Tom Hunze Date: Tue, 10 Jun 2025 19:53:40 +0200 Subject: [PATCH 1/2] python313Packages.streaming-form-data: 1.13.0 -> 1.19.1 https://github.com/siddhantgoel/streaming-form-data/blob/v1.19.1/CHANGELOG.md --- .../streaming-form-data/default.nix | 19 ++++---- .../streaming-form-data/drop-smart-open.patch | 43 ++++++++++++------- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/pkgs/development/python-modules/streaming-form-data/default.nix b/pkgs/development/python-modules/streaming-form-data/default.nix index 156366c9da4c..fd93534af974 100644 --- a/pkgs/development/python-modules/streaming-form-data/default.nix +++ b/pkgs/development/python-modules/streaming-form-data/default.nix @@ -4,21 +4,23 @@ buildPythonPackage, pythonOlder, cython, + setuptools, pytestCheckHook, requests-toolbelt, }: buildPythonPackage rec { pname = "streaming-form-data"; - version = "1.13.0"; - format = "setuptools"; + version = "1.19.1"; + pyproject = true; + disabled = pythonOlder "3.6"; src = fetchFromGitHub { owner = "siddhantgoel"; repo = "streaming-form-data"; rev = "v${version}"; - hash = "sha256-Ntiad5GZtfRd+2uDPgbDzLBzErGFroffK6ZAmMcsfXA="; + hash = "sha256-3tK7dX5p1uH/azmFxzELM1bflGI/SHoLvsw+Ta+7rC4="; }; # streaming-form-data has a small bit of code that uses smart_open, which has a massive closure. @@ -26,13 +28,10 @@ buildPythonPackage rec { # So, just drop the dependency to not have to deal with it. patches = [ ./drop-smart-open.patch ]; - # The repo has a vendored copy of the cython output, which doesn't build on 3.13, - # so regenerate it with our cython, which does. - preBuild = '' - cython streaming_form_data/_parser.pyx - ''; - - nativeBuildInputs = [ cython ]; + nativeBuildInputs = [ + cython + setuptools + ]; nativeCheckInputs = [ pytestCheckHook diff --git a/pkgs/development/python-modules/streaming-form-data/drop-smart-open.patch b/pkgs/development/python-modules/streaming-form-data/drop-smart-open.patch index 6c0946c926ec..526f667d9da1 100644 --- a/pkgs/development/python-modules/streaming-form-data/drop-smart-open.patch +++ b/pkgs/development/python-modules/streaming-form-data/drop-smart-open.patch @@ -1,36 +1,49 @@ -diff --git a/streaming_form_data/targets.py b/streaming_form_data/targets.py -index a399f3a..b816714 100644 ---- a/streaming_form_data/targets.py -+++ b/streaming_form_data/targets.py -@@ -1,6 +1,5 @@ - import hashlib +diff --git a/pyproject.toml b/pyproject.toml +index 43b7231..51c5e9c 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -27,7 +27,6 @@ classifiers = [ + ] + keywords = ["cython", "form-data", "forms", "http", "multipart", "streaming", "web"] + dependencies = [ +- "smart-open>=7.0.5", + ] + + [project.urls] +diff --git a/src/streaming_form_data/targets.py b/src/streaming_form_data/targets.py +index fc31f67..219c183 100644 +--- a/src/streaming_form_data/targets.py ++++ b/src/streaming_form_data/targets.py +@@ -2,7 +2,6 @@ import hashlib from pathlib import Path + from typing import Callable, List, Optional, Union + -import smart_open # type: ignore - from typing import Callable, List, Optional -@@ -164,6 +163,7 @@ class S3Target(BaseTarget): - S3Target enables chunked uploads to S3 buckets (using smart_open)""" - - def __init__(self, file_path, mode, transport_params=None, **kwargs): + class BaseTarget: +@@ -313,6 +312,7 @@ class SmartOpenTarget(BaseTarget): + mode: + The mode in which the file should be opened + """ + raise Exception("Nixpkgs: disabled") + super().__init__(**kwargs) - self._file_path = file_path diff --git a/tests/test_targets.py b/tests/test_targets.py -index 0cc79ab..78ab40b 100644 +index 4aa6b57..d768e2f 100644 --- a/tests/test_targets.py +++ b/tests/test_targets.py @@ -2,8 +2,6 @@ import os.path import tempfile import pytest --from moto import mock_s3 +-from moto import mock_aws -import boto3 from streaming_form_data.targets import ( BaseTarget, -@@ -271,6 +269,7 @@ def mock_client(): +@@ -305,6 +303,7 @@ def mock_client(): yield client From 5fb2e04299686399b555cc2492266481a18ad260 Mon Sep 17 00:00:00 2001 From: Tom Hunze Date: Tue, 10 Jun 2025 20:29:39 +0200 Subject: [PATCH 2/2] python313Packages.streaming-form-data: refactor --- .../python-modules/streaming-form-data/default.nix | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/streaming-form-data/default.nix b/pkgs/development/python-modules/streaming-form-data/default.nix index fd93534af974..ff39dfd30def 100644 --- a/pkgs/development/python-modules/streaming-form-data/default.nix +++ b/pkgs/development/python-modules/streaming-form-data/default.nix @@ -2,7 +2,6 @@ lib, fetchFromGitHub, buildPythonPackage, - pythonOlder, cython, setuptools, pytestCheckHook, @@ -14,12 +13,10 @@ buildPythonPackage rec { version = "1.19.1"; pyproject = true; - disabled = pythonOlder "3.6"; - src = fetchFromGitHub { owner = "siddhantgoel"; repo = "streaming-form-data"; - rev = "v${version}"; + tag = "v${version}"; hash = "sha256-3tK7dX5p1uH/azmFxzELM1bflGI/SHoLvsw+Ta+7rC4="; }; @@ -28,7 +25,7 @@ buildPythonPackage rec { # So, just drop the dependency to not have to deal with it. patches = [ ./drop-smart-open.patch ]; - nativeBuildInputs = [ + build-system = [ cython setuptools ]; @@ -42,14 +39,10 @@ buildPythonPackage rec { pythonImportsCheck = [ "streaming_form_data" ]; - preCheck = '' - # remove in-tree copy to make pytest find the installed one, with the native parts already built - rm -rf streaming_form_data - ''; - meta = { description = "Streaming parser for multipart/form-data"; homepage = "https://github.com/siddhantgoel/streaming-form-data"; + changelog = "https://github.com/siddhantgoel/streaming-form-data/blob/${src.tag}/CHANGELOG.md"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ zhaofengli ]; };