Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions pkgs/development/python-modules/streaming-form-data/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,33 @@
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.
# The only consumer of streaming-form-data is Moonraker, which doesn't use that code.
# 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
Expand All @@ -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 ];
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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


Expand Down
Loading