diff --git a/pkgs/development/python-modules/streaming-form-data/default.nix b/pkgs/development/python-modules/streaming-form-data/default.nix index 156366c9da4ca..ff39dfd30def8 100644 --- a/pkgs/development/python-modules/streaming-form-data/default.nix +++ b/pkgs/development/python-modules/streaming-form-data/default.nix @@ -2,23 +2,22 @@ lib, fetchFromGitHub, buildPythonPackage, - pythonOlder, cython, + setuptools, pytestCheckHook, requests-toolbelt, }: buildPythonPackage rec { pname = "streaming-form-data"; - version = "1.13.0"; - format = "setuptools"; - disabled = pythonOlder "3.6"; + version = "1.19.1"; + pyproject = true; src = fetchFromGitHub { owner = "siddhantgoel"; repo = "streaming-form-data"; - rev = "v${version}"; - hash = "sha256-Ntiad5GZtfRd+2uDPgbDzLBzErGFroffK6ZAmMcsfXA="; + tag = "v${version}"; + 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 +25,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 ]; + build-system = [ + cython + setuptools + ]; nativeCheckInputs = [ pytestCheckHook @@ -43,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 ]; }; 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 6c0946c926ecb..526f667d9da14 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 --import smart_open # type: ignore - from typing import Callable, List, Optional + from typing import Callable, List, Optional, Union +-import smart_open # type: ignore -@@ -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