restore Nix support

This commit is contained in:
The MMGen Project 2025-10-04 12:44:54 +00:00
commit 06340ed521
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 92 additions and 71 deletions

View file

@ -1 +1 @@
3.6.dev2
3.6.dev3

50
nix/curl-cffi.nix Normal file
View file

@ -0,0 +1,50 @@
{
stdenv,
lib,
python,
buildPythonPackage,
fetchPypi,
curl-impersonate-chrome,
}:
buildPythonPackage rec {
pname = "curl-cffi";
# version = "0.13.0"; # uses option PROXY_CREDENTIAL_NO_REUSE, unavailable in current libcurl
version = "0.10.0";
pyproject = true;
src = fetchPypi {
pname = "curl_cffi";
version = version;
# hash = "sha256-YuzZCjgr1QI3UONgbgqnyxo6i6QcFCcLjl4Unr9yxco="; # 0.13.0
hash = "sha256-PjezUmjKWEkvVO0CCuS1DDPuDeutQUXbn3RvBO1GbrA="; # 0.10.0
};
patches = [ ./use-system-libs.patch ];
buildInputs = [ curl-impersonate-chrome ];
build-system = with python.pkgs; [
cffi
setuptools
];
dependencies = with python.pkgs; [
cffi
certifi
typing-extensions
];
env = lib.optionalAttrs stdenv.cc.isGNU {
NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
};
pythonImportsCheck = [ "curl_cffi" ];
meta = with lib; {
description = "Python binding for curl-impersonate via cffi";
homepage = "https://curl-cffi.readthedocs.io";
license = licenses.mit;
maintainers = with maintainers; [ chuangzhu ];
};
}

View file

@ -6,7 +6,7 @@
};
python-packages = with python.pkgs; {
yahooquery = (pkgs.callPackage ./yahooquery.nix {}); # ticker
pyyaml = pyyaml; # ticker
yahooquery = (callPackage ./yahooquery.nix {}); # ticker
pyyaml = pyyaml; # ticker
};
}

23
nix/use-system-libs.patch Normal file
View file

@ -0,0 +1,23 @@
diff --git a/scripts/build.py b/scripts/build.py
index b705a0d..9bfcaab 100644
--- a/scripts/build.py
+++ b/scripts/build.py
@@ -105,7 +105,6 @@ def get_curl_libraries():
ffibuilder = FFI()
system = platform.system()
root_dir = Path(__file__).parent.parent
-download_libcurl()
ffibuilder.set_source(
@@ -114,9 +113,7 @@ ffibuilder.set_source(
#include "shim.h"
""",
# FIXME from `curl-impersonate`
- libraries=get_curl_libraries(),
- extra_objects=get_curl_archives(),
- library_dirs=[arch["libdir"]],
+ libraries=["curl-impersonate-chrome"],
source_extension=".c",
include_dirs=[
str(root_dir / "include"),

View file

@ -1,45 +0,0 @@
diff --git a/pyproject.toml b/pyproject.toml
index 9d3fb29..399c215 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,24 +10,24 @@ readme = "README.md"
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
-requests = "^2.31.0"
-pandas = "^2.0.3"
-requests-futures = "^1.0.1"
-tqdm = "^4.65.0"
-lxml = "^4.9.3"
-selenium = {version = "^4.10.0", optional = true}
-beautifulsoup4 = "^4.12.2"
+requests = ">=2.31.0"
+pandas = ">=2.0.3"
+requests-futures = ">=1.0.1"
+tqdm = ">=4.65.0"
+lxml = ">=4.9.3"
+selenium = {version = ">=4.10.0", optional = true}
+beautifulsoup4 = ">=4.12.2"
[tool.poetry.dev-dependencies]
-pytest = "^7.4.0"
-isort = "^5.0.0"
-flake8 = "^6.0.0"
-mypy = "^1.4.1"
-pytest-cov = "^4.1.0"
-black = "^23.7.0"
-pre-commit = "^3.3.3"
-ipython = "^8.0.0"
-mkdocs-material = "^9.1.18"
+pytest = ">=7.4.0"
+isort = ">=5.0.0"
+flake8 = ">=6.0.0"
+mypy = ">=1.4.1"
+pytest-cov = ">=4.1.0"
+black = ">=23.7.0"
+pre-commit = ">=3.3.3"
+ipython = ">=8.0.0"
+mkdocs-material = ">=9.1.18"
[build-system]
requires = ["poetry-core>=1.0.0"]

View file

@ -1,37 +1,30 @@
{
lib,
pkgs,
fetchFromGitHub,
buildPythonPackage,
fetchPypi,
python,
}:
with pkgs.python312.pkgs;
buildPythonPackage rec {
pname = "yahooquery";
version = "2.3.7";
version = "2.4.1";
pyproject = true;
disabled = pythonOlder "3.8.1";
src = fetchFromGitHub {
owner = "dpguthrie";
repo = "yahooquery";
rev = "refs/tags/v${version}";
hash = "sha256-Iyuni1SoTB6f7nNFhN5A8Gnv9kV78frjpqvvW8qd+/M=";
src = fetchPypi {
pname = "yahooquery";
version = version;
hash = "sha256-GQPGXq5qEtlelFAGNHkhbAeEbwE7riojkXkTUxt/rls=";
};
patches = [ ./yahooquery-noversioning.patch ];
build-system = with python.pkgs; [ hatchling ];
build-system = [ poetry-core ];
dependencies = [
requests # ^2.31.0
pandas # ^2.0.3
requests-futures # ^1.0.1
tqdm # ^4.65.0
lxml # ^4.9.3
selenium # {version = ^4.10.0, optional = true}
beautifulsoup4 # ^4.12.2
propagatedBuildInputs = with python.pkgs; [
(callPackage ./curl-cffi.nix {}) # >=0.10.0
pandas
requests-futures
tqdm
lxml
beautifulsoup4
];
doCheck = false; # skip tests