python3Packages.ddgs: 9.10.0 -> 9.11.4; primp: re-init at 1.1.3 (#496738)
This commit is contained in:
@@ -1,53 +1,44 @@
|
||||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
setuptools,
|
||||
click,
|
||||
fastapi,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
lxml,
|
||||
httpx,
|
||||
h2,
|
||||
fake-useragent,
|
||||
mcp,
|
||||
primp,
|
||||
setuptools,
|
||||
uvicorn,
|
||||
versionCheckHook,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
buildPythonPackage (finalAttrs: {
|
||||
pname = "ddgs";
|
||||
version = "9.10.0";
|
||||
version = "9.11.4";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "deedy5";
|
||||
repo = "ddgs";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-NNXGvDGynu6QtVqxVr74b/qehQ7qhq1NiVxyuKw2C4w=";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-+UefNpWKq1Rcm90M+hQavEORYZF4FWC1FzH7TfAH6WA=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# We're removing the HTTP client primp below for security reasons,
|
||||
# but can use the already included httpx instead.
|
||||
# Note that while httpx is only used for HTTP/2 by upstream,
|
||||
# it can handle HTTP/1.1 just fine as well.
|
||||
./replace-primp.patch
|
||||
];
|
||||
|
||||
pythonRemoveDeps = [
|
||||
# primp requires a very outdated, potentially insecure version of boringssl
|
||||
"primp"
|
||||
];
|
||||
|
||||
build-system = [ setuptools ];
|
||||
|
||||
dependencies = [
|
||||
click
|
||||
lxml
|
||||
httpx
|
||||
h2
|
||||
fake-useragent
|
||||
]
|
||||
++ httpx.optional-dependencies.http2
|
||||
++ httpx.optional-dependencies.socks
|
||||
++ httpx.optional-dependencies.brotli;
|
||||
primp
|
||||
];
|
||||
|
||||
optional-dependencies = {
|
||||
api = [
|
||||
fastapi
|
||||
mcp
|
||||
uvicorn
|
||||
];
|
||||
};
|
||||
|
||||
nativeCheckInputs = [ versionCheckHook ];
|
||||
versionCheckProgramArg = "version";
|
||||
@@ -55,11 +46,11 @@ buildPythonPackage rec {
|
||||
pythonImportsCheck = [ "ddgs" ];
|
||||
|
||||
meta = {
|
||||
description = "D.D.G.S. | Dux Distributed Global Search. A metasearch library that aggregates results from diverse web search services";
|
||||
description = "A metasearch library that aggregates results from diverse web search services";
|
||||
mainProgram = "ddgs";
|
||||
homepage = "https://github.com/deedy5/ddgs";
|
||||
changelog = "https://github.com/deedy5/ddgs/releases/tag/${src.tag}";
|
||||
changelog = "https://github.com/deedy5/ddgs/releases/tag/${finalAttrs.src.tag}";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ drawbu ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
diff --git a/ddgs/base.py b/ddgs/base.py
|
||||
index 11111acc7a..b71ee337d9 100644
|
||||
--- a/ddgs/base.py
|
||||
+++ b/ddgs/base.py
|
||||
@@ -9,7 +9,7 @@
|
||||
from lxml import html
|
||||
from lxml.etree import HTMLParser as LHTMLParser
|
||||
|
||||
-from .http_client import HttpClient
|
||||
+from .http_client2 import HttpClient2 as HttpClient
|
||||
from .results import BooksResult, ImagesResult, NewsResult, TextResult, VideosResult
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
diff --git a/ddgs/cli.py b/ddgs/cli.py
|
||||
index 36cf2f373c..7cf0b2f35d 100644
|
||||
--- a/ddgs/cli.py
|
||||
+++ b/ddgs/cli.py
|
||||
@@ -9,11 +9,11 @@
|
||||
from urllib.parse import unquote
|
||||
|
||||
import click
|
||||
-import primp
|
||||
|
||||
from . import __version__
|
||||
from .ddgs import DDGS
|
||||
from .utils import _expand_proxy_tb_alias
|
||||
+from .http_client2 import HttpClient2
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
def _download_file(url: str, dir_path: str, filename: str, proxy: str | None, *, verify: bool) -> None:
|
||||
try:
|
||||
- resp = primp.Client(proxy=proxy, impersonate="random", impersonate_os="random", timeout=10, verify=verify).get(
|
||||
+ resp = HttpClient2(proxy=proxy, timeout=10, verify=verify).get(
|
||||
url,
|
||||
)
|
||||
if resp.status_code == 200:
|
||||
+4156
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
rustPlatform,
|
||||
libiconv,
|
||||
pytestCheckHook,
|
||||
pytest-asyncio,
|
||||
}:
|
||||
|
||||
buildPythonPackage (finalAttrs: {
|
||||
pname = "primp";
|
||||
version = "1.1.3";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "deedy5";
|
||||
repo = "primp";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-ahTIEStYQ5M7EYidQYpYEVbYwwFFRfBXErWOMDdgNnk=";
|
||||
};
|
||||
|
||||
# The Cargo.lock is not pushed upstream
|
||||
cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; };
|
||||
postPatch = ''
|
||||
cp ${./Cargo.lock} Cargo.lock
|
||||
'';
|
||||
|
||||
buildAndTestSubdir = "crates/primp-python";
|
||||
|
||||
nativeBuildInputs = [
|
||||
rustPlatform.bindgenHook
|
||||
rustPlatform.cargoSetupHook
|
||||
rustPlatform.maturinBuildHook
|
||||
];
|
||||
|
||||
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
libiconv
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
pytest-asyncio
|
||||
];
|
||||
disabledTestPaths = [ "crates/primp-python/tests/test_impersonate.py" ];
|
||||
|
||||
# Tests crash with Abort trap: 6 on Darwin due to tokio runtime
|
||||
# initialization in PyInit_pyo3_async_runtimes being blocked by the sandbox.
|
||||
doCheck = !stdenv.isDarwin;
|
||||
|
||||
pythonImportsCheck = [ "primp" ];
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/deedy5/primp/releases/tag/${finalAttrs.src.tag}";
|
||||
description = " HTTP client that can impersonate web browsers";
|
||||
homepage = "https://github.com/deedy5/primp";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ drawbu ];
|
||||
};
|
||||
})
|
||||
@@ -358,7 +358,6 @@ mapAliases {
|
||||
postgrest-py = postgrest; # added 2025-08-29
|
||||
powerlineMemSegment = throw "'powerlineMemSegment' has been renamed to/replaced by 'powerline-mem-segment'"; # Converted to throw 2025-10-29
|
||||
prayer-times-calculator = throw "'prayer-times-calculator' has been renamed to/replaced by 'prayer-times-calculator-offline'"; # Converted to throw 2025-10-29
|
||||
primp = throw "primp was removed as it required a very outdated version of boringssl"; # added 2025-10-20
|
||||
prometheus_client = throw "'prometheus_client' has been renamed to/replaced by 'prometheus-client'"; # Converted to throw 2025-10-29
|
||||
prompt_toolkit = throw "'prompt_toolkit' has been renamed to/replaced by 'prompt-toolkit'"; # Converted to throw 2025-10-29
|
||||
protonup = throw "'protonup' has been renamed to/replaced by 'protonup-ng'"; # Converted to throw 2025-10-29
|
||||
|
||||
@@ -12813,6 +12813,8 @@ self: super: with self; {
|
||||
|
||||
primer3 = callPackage ../development/python-modules/primer3 { };
|
||||
|
||||
primp = callPackage ../development/python-modules/primp { };
|
||||
|
||||
print-color = callPackage ../development/python-modules/print-color { };
|
||||
|
||||
priority = callPackage ../development/python-modules/priority { };
|
||||
|
||||
Reference in New Issue
Block a user