diff --git a/mmgen_node_tools/data/version b/mmgen_node_tools/data/version index 6f735af..f9d163c 100644 --- a/mmgen_node_tools/data/version +++ b/mmgen_node_tools/data/version @@ -1 +1 @@ -3.6.dev2 +3.6.dev3 diff --git a/nix/curl-cffi.nix b/nix/curl-cffi.nix new file mode 100644 index 0000000..15f9764 --- /dev/null +++ b/nix/curl-cffi.nix @@ -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 ]; + }; +} diff --git a/nix/node-tools-packages.nix b/nix/node-tools-packages.nix index 19792c7..1244425 100644 --- a/nix/node-tools-packages.nix +++ b/nix/node-tools-packages.nix @@ -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 }; } diff --git a/nix/use-system-libs.patch b/nix/use-system-libs.patch new file mode 100644 index 0000000..1d04487 --- /dev/null +++ b/nix/use-system-libs.patch @@ -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"), diff --git a/nix/yahooquery-noversioning.patch b/nix/yahooquery-noversioning.patch deleted file mode 100644 index 4bd3297..0000000 --- a/nix/yahooquery-noversioning.patch +++ /dev/null @@ -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"] diff --git a/nix/yahooquery.nix b/nix/yahooquery.nix index 8b1535d..3e8925f 100644 --- a/nix/yahooquery.nix +++ b/nix/yahooquery.nix @@ -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