diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index d52fd61f7eac23..b7c0d0ac648854 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -20753,6 +20753,12 @@ name = "n-hass"; keys = [ { fingerprint = "FDEE 6116 DBA7 8840 7323 4466 A371 5973 2728 A6A6"; } ]; }; + n0099 = { + email = "nixpkgs@n0099.com"; + github = "n0099"; + githubId = 13030387; + name = "n0099"; + }; n00b0ss = { email = "nixpkgs@n00b0ss.de"; github = "n00b0ss"; diff --git a/nixos/doc/manual/release-notes/rl-2611.section.md b/nixos/doc/manual/release-notes/rl-2611.section.md index 262419e87126ab..48c03153418080 100644 --- a/nixos/doc/manual/release-notes/rl-2611.section.md +++ b/nixos/doc/manual/release-notes/rl-2611.section.md @@ -141,6 +141,8 @@ - [MinusPod](https://github.com/ttlequals0/MinusPod), a self-hosted server that removes ads from podcasts before you ever hit play. Available as [services.minuspod](#opt-services.minuspod.enable). +- [freqtrade](https://github.com/freqtrade/freqtrade), a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram or webUI. It contains backtesting, plotting and money management tools as well as strategy optimization by machine learning. Available as [services.freqtrade](#opt-services.freqtrade.enable). + - [Stump](https://www.stumpapp.dev/), a free and open source comics, manga and digital book server with OPDS support. Available as [services.stump](#opt-services.stump.enable). - [P2Pool](https://github.com/SChernykh/p2pool), a decentralized mining pool for Monero. Available as [services.p2pool](#opt-services.p2pool.enable). diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index b87750c762d99f..5e2bc743a583fd 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -673,6 +673,7 @@ ./services/display-managers/sddm.nix ./services/editors/emacs.nix ./services/editors/infinoted.nix + ./services/finance/freqtrade.nix ./services/finance/libeufin/bank.nix ./services/finance/libeufin/module.nix ./services/finance/libeufin/nexus.nix diff --git a/nixos/modules/services/finance/freqtrade.nix b/nixos/modules/services/finance/freqtrade.nix new file mode 100644 index 00000000000000..a08af0b8f8f1b0 --- /dev/null +++ b/nixos/modules/services/finance/freqtrade.nix @@ -0,0 +1,222 @@ +{ + config, + pkgs, + lib, + ... +}: + +let + cfg = config.services.freqtrade; + settingsFormat = pkgs.formats.json { }; +in +{ + options.services.freqtrade = + with { + inherit (lib) mkOption mkEnableOption; + inherit (lib.types) + str + bool + port + submodule + lazyAttrsOf + nullOr + listOf + path + externalPath + ; + }; + let + genCommonOptions = type: cfg: parentCfg: { + settings = mkOption { + description = + let + prefix = lib.optionalString (type == "root") "Global "; + object = + if type == "root" then + "all bots and webserver that get merged with [`lib.recursiveUpdate`](https://nixos.org/manual/nixpkgs/unstable/#function-library-lib.attrsets.recursiveUpdate)" + else + "the ${type}"; + in + "${prefix}Freqtrade config for ${object}. See [Freqtrade documentation](https://www.freqtrade.io/en/stable/configuration/) for possible key and vaules."; + type = submodule ( + { name, config, ... }: + + let + getSetting = key: config.${key} or cfg.settings.${key} or parentCfg.settings.${key}; + in + { + freeformType = settingsFormat.type; + options = + let + genCfgAttrPath = rec { + cfg = + optionAttrPath: + let + nonRootAttrPath = + lib.optionalString (type != "root") + ".${ + if type == "bot" then + "bot.${name}" + else if type == "webserver" then + type + else + throw "Unknown type." + }"; + in + "config.services.freqtrade${nonRootAttrPath}.${optionAttrPath}"; + parentCfg = + operator: optionAttrPath: + lib.optionalString (type != "root") " ${operator} config.services.freqtrade.${optionAttrPath}"; + cfgOperatorParent = + optionAttrPath: operator: cfg optionAttrPath + parentCfg operator optionAttrPath; + }; + in + { + dry_run = mkOption { + description = + let + object = if type == "root" then "all bots and webserver" else type; + suffix = lib.optionalString (type == "root") " by default"; + in + "Define if ${object} must be in Dry Run or production mode${suffix}."; + type = bool; + default = parentCfg.settings.dry_run or true; + defaultText = lib.literalExpression ( + lib.optionalString (type != "root") "config.services.freqtrade.settings.dry_run or " + "true" + ); + }; + add_config_files = mkOption { + description = "Additional config files. These files will be merged with the nix config using merge strategy like the nix [update operator `//`](https://nix.dev/manual/nix/2.34/language/operators#update)."; + type = listOf path; + default = cfg.extraConfigFiles ++ parentCfg.extraConfigFiles or [ ]; + defaultText = lib.literalExpression (genCfgAttrPath.cfgOperatorParent "extraConfigFiles" "++"); + }; + user_data_dir = mkOption { + description = "Directory containing user data."; + type = externalPath; + default = + let + result = lib.tryEval cfg.userDataDir; + in + if result.success then result.value else parentCfg.userDataDir; + defaultText = lib.literalExpression (genCfgAttrPath.cfgOperatorParent "userDataDir" "or"); + }; + db_url = + let + prefix = if config ? bot_name then "bot-${config.bot_name}" else "tradesv3"; + suffix = lib.optionalString (getSetting "dry_run") ".dryrun"; + in + mkOption { + description = "Declares database URL to use."; + type = str; + default = "sqlite://${getSetting "user_data_dir"}/db/${prefix}${suffix}.sqlite"; + defaultText = + let + userDataDir = genCfgAttrPath.cfgOperatorParent "settings.user_data_dir" "or"; + prefix = + if type == "bot" then + ''''${${genCfgAttrPath.cfg "settings.bot_name"} or "tradesv3"}'' + else + "tradesv3"; + suffix = ''lib.optionalString (${genCfgAttrPath.cfgOperatorParent "settings.dry_run" "or"}) ".dryrun"''; + in + lib.literalExpression "sqlite://\${${userDataDir}}/db/${prefix}\${${suffix}}.sqlite"; + }; + }; + } + ); + default = { }; + apply = value: lib.recursiveUpdate (parentCfg.settings or { }) value; + }; + extraConfigFiles = mkOption { + description = "Additional config files. These files will be merged with the nix config using merge strategy like the nix update operator `//`."; + type = listOf path; + default = [ ]; + }; + userDataDir = mkOption { + description = "Directory containing user data."; + type = externalPath; + }; + }; + in + { + enable = mkEnableOption "Freqtrade, a free and open source crypto trading bot written in Python"; + bot = mkOption { + description = "Instances of Freqtrade. For requirements about set multiple bots see [Running multiple instances of Freqtrade](https://www.freqtrade.io/en/stable/advanced-setup/#running-multiple-instances-of-freqtrade)."; + type = lazyAttrsOf ( + submodule ( + { name, config, ... }: { + options = genCommonOptions "bot" config cfg; + config.settings.bot_name = lib.mkDefault name; + } + ) + ); + }; + webserver = { + enable = mkEnableOption "Freqtrade webserver, which using [FreqUI](https://www.freqtrade.io/en/stable/freq-ui/#webserver-mode) to download historical data, test pairlists, run backtesting and other commands"; + listen = { + addr = mkOption { + description = "Bind IP address. See the [API Server documentation](https://www.freqtrade.io/en/stable/rest-api/) for more details."; + type = str; + }; + port = mkOption { + description = "Bind port. See the [API Server documentation](https://www.freqtrade.io/en/stable/rest-api/) for more details."; + type = port; + }; + }; + } + // genCommonOptions "webserver" cfg.webserver cfg; + } + // genCommonOptions "root" cfg { }; + config = + let + genSystemdService = command: settingsJSON: { + wantedBy = [ "multi-user.target" ]; + serviceConfig.ExecStart = "${lib.getExe pkgs.freqtrade} ${command} --config ${settingsJSON}"; + }; + commonSystemdService = id: { + # https://github.com/freqtrade/freqtrade/blob/6fa470939cc74bf0672e0e348a4d9b293072e43c/freqtrade.service.watchdog + after = [ "network.target" ]; + serviceConfig = { + # not using `Notify` and passing `--sd-notify` in `ExecStart` to prevent deadlock + # due to `multi-user.target` of the container waits this unit + # `ExecStart` of this unit waits for internet access before send `sd_notify()`: https://github.com/freqtrade/freqtrade/blob/158eac5609f13d5fdbd2b09106589a786ae9fcf9/freqtrade/worker.py#L67 + # and `ExecStartPost` of the host unit `container@.service` that setup `ip route` on the host side: https://github.com/NixOS/nixpkgs/blob/667d5cf1c59585031d743c78b394b0a647537c35/nixos/modules/virtualisation/nixos-containers.nix#L297 + # waits `multi-user.target` in the container as `systemd-nspawn` in `ExecStart` waits it: https://github.com/NixOS/nixpkgs/blob/667d5cf1c59585031d743c78b394b0a647537c35/nixos/modules/virtualisation/nixos-containers.nix#L198 + Type = "exec"; + Restart = "on-failure"; + SyslogIdentifier = "freqtrade-${id}"; + SuccessExitStatus = 130; # https://github.com/freqtrade/freqtrade/blob/f3ec9796fbfa333625be451fd8c03e0dad8869b7/freqtrade/main.py#L66 + }; + }; + in + lib.mkIf cfg.enable { + services.freqtrade.webserver.settings.api_server = with cfg.webserver.listen; { + enabled = true; + listen_ip_address = addr; + listen_port = port; + }; + systemd.services = { + "freqtrade@" = commonSystemdService "bot-%I"; + freqtrade-webserver = lib.mkIf cfg.webserver.enable ( + lib.mkMerge [ + (lib.pipe cfg.webserver.settings [ + (settingsFormat.generate "freqtrade-webserver-settings.json") + (genSystemdService "webserver") + ]) + (commonSystemdService "webserver") + ] + ); + } + // lib.concatMapAttrs (name: botCfg: { + "freqtrade@${name}" = + (lib.pipe botCfg.settings [ + (settingsFormat.generate "freqtrade-bot-${name}-settings.json") + (genSystemdService "trade") + ]) + // { + overrideStrategy = "asDropin"; # https://github.com/NixOS/nixpkgs/issues/80933#issuecomment-1295396500 + }; + }) cfg.bot; + }; +} diff --git a/pkgs/by-name/fr/freqtrade/client.nix b/pkgs/by-name/fr/freqtrade/client.nix new file mode 100644 index 00000000000000..e2257a0c77481e --- /dev/null +++ b/pkgs/by-name/fr/freqtrade/client.nix @@ -0,0 +1,36 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + setuptools, + wheel, + python-rapidjson, + ccxt, +}: + +buildPythonPackage (finalAttrs: { + pname = "freqtrade-client"; + version = "2026.10"; + src = fetchFromGitHub { + owner = "freqtrade"; + repo = "freqtrade"; + tag = finalAttrs.version; + hash = "sha256-L/iZC4kKsQjgKw3X3uK7ZeMsjsS/Y9miJfj5dy1jfWA="; + rootDir = "ft_client"; + }; + pyproject = true; + build-system = [ + setuptools + wheel + ]; + dependencies = [ + ccxt.pinnedDeps.requests + python-rapidjson + ]; + meta = { + description = "Provides a minimal rest client for the freqtrade rest api."; + homepage = "https://github.com/freqtrade/freqtrade/tree/develop/ft_client"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/by-name/fr/freqtrade/frequi.nix b/pkgs/by-name/fr/freqtrade/frequi.nix new file mode 100644 index 00000000000000..b5420d08d97e4d --- /dev/null +++ b/pkgs/by-name/fr/freqtrade/frequi.nix @@ -0,0 +1,48 @@ +{ + lib, + stdenv, + fetchFromGitHub, + git, + nodejs, + dart-sass, + pnpm_12, + pnpmConfigHook, + fetchPnpmDeps, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "frequi"; + version = "3.2.1"; + src = fetchFromGitHub { + owner = "freqtrade"; + repo = "frequi"; + tag = finalAttrs.version; + hash = "sha256-Z3gW8+rPYM/THdS2jgo44xCW1XUIj5TDAEFqsa31mC4="; + }; + pnpmDeps = fetchPnpmDeps { + inherit (finalAttrs) pname version src; + pnpm = pnpm_12; # https://github.com/freqtrade/frequi/blob/fc11114c1ba6d6d412137bc4f6f60c7ad7cd1ab7/package.json#L68 + fetcherVersion = 4; + hash = "sha256-ltrRILUNgyBzg5U6RLGq5fZ0K34dnynDFxmpBUPdMiQ="; + }; + nativeBuildInputs = [ + git # https://github.com/freqtrade/frequi/blob/7d8a81c1022fa39dffbcd69f45a01767259dd4de/vite.config.ts#L12 + nodejs + pnpm_12 + pnpmConfigHook + ]; + buildPhase = '' + # https://github.com/sass/embedded-host-node/issues/334 + substituteInPlace node_modules/sass-embedded/dist/lib/src/compiler-path.js \ + --replace-fail 'compilerCommand = (() => {' 'compilerCommand = (() => { return ["${lib.getExe dart-sass}"];' + mkdir $out + pnpm run build --outDir $out + ''; + meta = { + description = "Freqtrade UI - Frontend for Freqtrade"; + homepage = "https://github.com/freqtrade/frequi"; + changelog = "https://github.com/freqtrade/frequi/releases/tag/${finalAttrs.src.rev}"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/by-name/fr/freqtrade/ft-pandas-ta.nix b/pkgs/by-name/fr/freqtrade/ft-pandas-ta.nix new file mode 100644 index 00000000000000..5abec4e12279fd --- /dev/null +++ b/pkgs/by-name/fr/freqtrade/ft-pandas-ta.nix @@ -0,0 +1,46 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + setuptools, + fetchPypi, + wheel, + numpy, + pandas, +}: + +buildPythonPackage (finalAttrs: { + pname = "ft-pandas-ta"; + version = "0.3.16"; + src = fetchFromGitHub { + owner = "freqtrade"; + repo = "pandas-ta"; + tag = finalAttrs.version; + hash = "sha256-xT8/42BU27ZEGjQsfXF/5N2N+NrAJZrAQ2MM1hcetvc="; + }; + pyproject = true; + build-system = [ + (setuptools.overridePythonAttrs rec { + # https://github.com/freqtrade/pandas-ta/commit/cf1b52b2de85525c299654d8f1e6dd607f4acaa1 + # https://github.com/freqtrade/pandas-ta/commit/9d7218ed6a120804bd56e3e0381a58a9c2b52720 + version = "75.6.0"; + src = fetchPypi { + pname = "setuptools"; + inherit version; + hash = "sha256-gZkiJVjffIYhavT4TDDps0ph2LoZNmzJFEJM29KCUvY="; + }; + }) + wheel + ]; + dependencies = [ + numpy + pandas + ]; + meta = { + description = "An easy to use Python 3 Pandas Extension with 130+ Technical Analysis Indicators."; + homepage = "https://github.com/freqtrade/pandas-ta"; + changelog = "https://github.com/freqtrade/pandas-ta/releases/tag/${finalAttrs.src.rev}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/by-name/fr/freqtrade/package.nix b/pkgs/by-name/fr/freqtrade/package.nix new file mode 100644 index 00000000000000..6f9d7da3a326f5 --- /dev/null +++ b/pkgs/by-name/fr/freqtrade/package.nix @@ -0,0 +1,138 @@ +{ + lib, + fetchFromGitHub, + python3Packages, + withFreqUI ? true, + withPlot ? false, + withFreqAI ? false, + withFreqAIRL ? false, + withHyperopt ? false, +}: + +let + ft-pandas-ta = python3Packages.callPackage ./ft-pandas-ta.nix { }; + technical = python3Packages.callPackage ./technical.nix { }; + freqtrade-client = python3Packages.callPackage ./client.nix { }; + frequi = python3Packages.callPackage ./frequi.nix { }; + dedupedDeps = + with rec { + inherit (python3Packages) + ccxt + httpcore + starlette + ; + inherit (ccxt.pinnedDeps) certifi idna; + }; rec { + anyio = python3Packages.anyio.override { inherit idna; }; + httpx = python3Packages.httpx.override { + inherit certifi idna anyio; + httpcore = httpcore.override { inherit certifi; }; + }; + fastapi = python3Packages.fastapi.override { starlette = starlette.override { inherit anyio; }; }; + }; +in +python3Packages.buildPythonApplication (finalAttrs: { + pname = "freqtrade"; + version = "2026.10"; + src = fetchFromGitHub { + owner = "freqtrade"; + repo = "freqtrade"; + tag = finalAttrs.version; + hash = "sha256-APolLFb1GQ+vKsv8fuB91WANRRWftuWQfCZLGTwdacM="; + }; + pyproject = true; + build-system = with python3Packages; [ + setuptools + wheel + ]; + dependencies = + with python3Packages; + [ + ccxt + sqlalchemy + (python-telegram-bot.override { inherit (dedupedDeps) httpx; }) + humanize + cachetools + ccxt.pinnedDeps.requests + dedupedDeps.httpx + ccxt.pinnedDeps.urllib3 + ccxt.pinnedDeps.certifi + jsonschema + scipy + numpy + pandas + bottleneck + numexpr + ta-lib + ft-pandas-ta + technical + tabulate + (pycoingecko.override { inherit (ccxt.pinnedDeps) requests; }) + python-rapidjson + orjson + jinja2 + questionary + prompt-toolkit + joblib + cloudpickle + rich + pyarrow + dedupedDeps.fastapi + pydantic + pyjwt + websockets + uvicorn + psutil + schedule + janus + ast-comments + aiofiles + ccxt.pinnedDeps.aiohttp + cryptography + sdnotify + python-dateutil + pytz + packaging + freqtrade-client + ] + ++ lib.optionals withPlot finalAttrs.passthru.optional-dependencies.plot + ++ lib.optionals withFreqAI finalAttrs.passthru.optional-dependencies.freqAI + ++ lib.optionals withFreqAIRL finalAttrs.passthru.optional-dependencies.freqAIRL + ++ lib.optionals withHyperopt finalAttrs.passthru.optional-dependencies.hyperopt; + optional-dependencies = with python3Packages; { + plot = [ plotly ]; + freqAI = [ + scikit-learn + joblib + lightgbm + xgboost + tensorboard + datasieve + ]; + freqAIRL = [ + torch + gymnasium + stable-baselines3 + sb3-contrib + tqdm + ]; + hyperopt = [ + scikit-learn + filelock + optuna + cmaes + ]; + }; + postInstall = lib.optionalString withFreqUI '' + # https://github.com/freqtrade/freqtrade/blob/064e67c42af3c4026d123990f992ac42f7ee3cde/freqtrade/commands/deploy_commands.py#L117 + ln -s ${frequi} $out/${python3Packages.python.sitePackages}/freqtrade/rpc/api_server/ui/installed + ''; + meta = { + description = "Free, open source crypto trading bot"; + longDescription = "Freqtrade is a free and open source crypto trading bot written in Python. It is designed to support all major exchanges and be controlled via Telegram or webUI. It contains backtesting, plotting and money management tools as well as strategy optimization by machine learning."; + homepage = "https://www.freqtrade.io"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ n0099 ]; + mainProgram = "freqtrade"; + }; +}) diff --git a/pkgs/by-name/fr/freqtrade/technical.nix b/pkgs/by-name/fr/freqtrade/technical.nix new file mode 100644 index 00000000000000..0ad71f19fc46ae --- /dev/null +++ b/pkgs/by-name/fr/freqtrade/technical.nix @@ -0,0 +1,32 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + setuptools, + ta-lib, + pandas, +}: + +buildPythonPackage (finalAttrs: { + pname = "technical"; + version = "1.7.0"; + src = fetchFromGitHub { + owner = "freqtrade"; + repo = "technical"; + tag = finalAttrs.version; + hash = "sha256-Ltab9QTiyH3lSCbHTi+MO2F6joMb1CJjQ6hCznCmP1w="; + }; + pyproject = true; + build-system = [ setuptools ]; + dependencies = [ + ta-lib + pandas + ]; + meta = { + description = "Various indicators developed or collected for the Freqtrade"; + homepage = "https://github.com/freqtrade/technical"; + changelog = "https://github.com/freqtrade/technical/releases/tag/${finalAttrs.src.rev}"; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/by-name/ta/ta-lib/package.nix b/pkgs/by-name/ta/ta-lib/package.nix index 7250f9dcf79fe4..11d630add6e598 100644 --- a/pkgs/by-name/ta/ta-lib/package.nix +++ b/pkgs/by-name/ta/ta-lib/package.nix @@ -7,7 +7,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "ta-lib"; - version = "0.7.1"; + version = "0.8.3"; __structuredAttrs = true; strictDeps = true; @@ -16,16 +16,16 @@ stdenv.mkDerivation (finalAttrs: { owner = "TA-Lib"; repo = "ta-lib"; tag = "v${finalAttrs.version}"; - hash = "sha256-tme5YuTWdf4lCsWXF97kSeka7Vmqte0vTjwtaUNN+kA="; + hash = "sha256-mctOWXfnrZT7G6BJhCNVy8KwwsjEkRyohZL0rnvoFIE="; }; nativeBuildInputs = [ autoreconfHook ]; meta = { - description = "Add technical analysis to your own financial market trading applications"; + description = "Technical analysis library: indicators and candlestick patterns, batch and streaming, native in C, Rust, Java, C#... and more"; mainProgram = "ta-lib-config"; - homepage = "https://ta-lib.org/"; - changelog = "https://github.com/TA-Lib/ta-lib-python/blob/${finalAttrs.src.rev}/CHANGELOG"; + homepage = "https://ta-lib.org"; + changelog = "https://github.com/TA-Lib/ta-lib/blob/${finalAttrs.src.rev}/CHANGELOG.md"; license = lib.licenses.bsd3; platforms = lib.platforms.linux; maintainers = with lib.maintainers; [ rafael ]; diff --git a/pkgs/by-name/xg/xgboost/package.nix b/pkgs/by-name/xg/xgboost/package.nix index a7ad4b644c32d0..488f5da548de71 100644 --- a/pkgs/by-name/xg/xgboost/package.nix +++ b/pkgs/by-name/xg/xgboost/package.nix @@ -46,7 +46,7 @@ effectiveStdenv.mkDerivation (finalAttrs: { # in \ # rWrapper.override{ packages = [ xgb ]; }" pname = lib.optionalString rLibrary "r-" + "xgboost"; - version = "3.0.5"; + version = "3.3.0"; strictDeps = true; __structuredAttrs = true; @@ -57,7 +57,7 @@ effectiveStdenv.mkDerivation (finalAttrs: { repo = "xgboost"; tag = "v${finalAttrs.version}"; fetchSubmodules = true; - hash = "sha256-khaD9gvKfUyWhkrIZXzGzKw/nfgeTcp9akCi5X3IORo="; + hash = "sha256-rQ8mEU3OmGf17owxnsWzTBaUeXke/0bQRAXC9/LQM1I="; }; nativeBuildInputs = [ @@ -126,17 +126,25 @@ effectiveStdenv.mkDerivation (finalAttrs: { "ThreadGroup.TimerThread" "ThreadGroup.TimerThreadSimple" ]; - networkingTest = [ + networkingTests = [ "AllgatherTest.Basic" "AllgatherTest.VAlgo" "AllgatherTest.VBasic" "AllgatherTest.VRing" "AllreduceGlobal.Basic" "AllreduceGlobal.Small" + "AllreduceTest.AllreduceV" "AllreduceTest.Basic" "AllreduceTest.BitOr" "AllreduceTest.Restricted" "AllreduceTest.Sum" + "Anchors/QuantileDistributedContainerTest.Invariants/empty_numeric_bins16" + "Anchors/QuantileDistributedContainerTest.Invariants/dense_numeric_unweighted_bins2" + "Anchors/QuantileDistributedContainerTest.Invariants/dense_numeric_unweighted_bins16" + "Anchors/QuantileDistributedContainerTest.Invariants/dense_numeric_weighted_bins256" + "Anchors/QuantileDistributedContainerTest.Invariants/sparse_numeric_weighted_bins32" + "Anchors/QuantileDistributedContainerTest.Invariants/dense_mixed_unweighted_bins16" + "Anchors/QuantileDistributedContainerTest.Invariants/sparse_mixed_weighted_bins64" "Approx.PartitionerColumnSplit" "BroadcastTest.Basic" "CPUHistogram.BuildHistColSplit" @@ -169,7 +177,9 @@ effectiveStdenv.mkDerivation (finalAttrs: { "QuantileHist.MultiPartitionerColumnSplit" "QuantileHist.PartitionerColumnSplit" "Stats.SampleMean" + "Stats.SampleMeanDist" "Stats.WeightedSampleMean" + "Stats.WeightedSampleMeanDist" "SimpleDMatrix.ColumnSplit" "TrackerAPITest.CAPI" "TrackerTest.AfterShutdown" @@ -177,8 +187,19 @@ effectiveStdenv.mkDerivation (finalAttrs: { "TrackerTest.GetHostAddress" "TrackerTest.Print" "VectorAllgatherV.Basic" + # belows only being tested on `aarch64-macos` + "LoopTest.Timeout" + "LoopTest.Op" + "LoopTest.Block" + "SocketTest.Basic" + "SocketTest.Bind" ]; - excludedTests = xsimdTests ++ networkingTest; + numaTests = [ + "Numa.GetNumNodes" + "Numa.GetHasCpuNodes" # https://github.com/dmlc/xgboost/blob/ec5977f38e0cb7853848c4269b77f9c9183dc63b/src/common/numa_topo.cc#L205 + "Numa.GetHasNormalMemoryNodes" # https://github.com/dmlc/xgboost/blob/ec5977f38e0cb7853848c4269b77f9c9183dc63b/src/common/numa_topo.cc#L194 + ]; + excludedTests = xsimdTests ++ networkingTests ++ numaTests; in "-${builtins.concatStringsSep ":" excludedTests}"; }; diff --git a/pkgs/development/python-modules/ast-comments/default.nix b/pkgs/development/python-modules/ast-comments/default.nix new file mode 100644 index 00000000000000..3b0789b74261af --- /dev/null +++ b/pkgs/development/python-modules/ast-comments/default.nix @@ -0,0 +1,26 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + poetry-core, +}: + +buildPythonPackage (finalAttrs: { + pname = "ast-comments"; + version = "1.3.0"; + src = fetchFromGitHub { + owner = "t3rn0"; + repo = "ast-comments"; + tag = finalAttrs.version; + hash = "sha256-Ji0nFjoNAtLQk7334GYZpe+TNn6+M9h1meJeI5v82M0="; + }; + pyproject = true; + build-system = [ poetry-core ]; + meta = { + description = "A Python extension to the built-in `ast` module that preserves comments in the Abstract Syntax Tree. This library finds comments in source code and includes them as nodes in the parsed AST."; + homepage = "https://github.com/t3rn0/ast-comments"; + changelog = "https://github.com/t3rn0/ast-comments/releases/tag/${finalAttrs.src.rev}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/development/python-modules/ccxt/default.nix b/pkgs/development/python-modules/ccxt/default.nix new file mode 100644 index 00000000000000..532a590434fa0e --- /dev/null +++ b/pkgs/development/python-modules/ccxt/default.nix @@ -0,0 +1,80 @@ +{ + callPackage, + lib, + pythonOlder, + fetchFromGitHub, + buildPythonPackage, + setuptools, + cryptography, + typing-extensions, + zlib-ng, + uvloop, + orjson, + coincurve, + aiohappyeyeballs, + aiosignal, + attrs, + frozenlist, + propcache, + cffi, + pycparser, +}: + +let + pinnedDeps = callPackage ./deps.nix { }; # https://github.com/NixOS/nixpkgs/blob/c7e10647eadb53b7cf3552a53e8bb33c8248c8c3/pkgs/by-name/README.md?plain=1#L187-L205 +in +buildPythonPackage (finalAttrs: { + pname = "ccxt"; + version = "4.5.92"; + src = fetchFromGitHub { + owner = "ccxt"; + repo = "ccxt"; + tag = "v${finalAttrs.version}"; + hash = "sha256-3sL6eIYrhMt7hk0IRRRPforDF7WwyKK6O+EZBp2OjqE="; + }; + pyproject = true; + build-system = [ setuptools ]; + passthru = { inherit pinnedDeps; }; + dependencies = [ + setuptools + pinnedDeps.certifi + pinnedDeps.requests + cryptography + typing-extensions + pinnedDeps.aiohttp + pinnedDeps.yarl + pinnedDeps.aiohttp-fast-zlib + zlib-ng + uvloop + ] + # https://github.com/ccxt/ccxt/blob/e6fd82900c9f2b71fa0fa7524d95dd788e2803fc/pyproject.toml#L68 + ++ lib.optional (pythonOlder "3.15") orjson + ++ lib.optional (pythonOlder "3.14") coincurve + ++ [ + aiohappyeyeballs + aiosignal + attrs + frozenlist + pinnedDeps.multidict + propcache + cffi + pycparser + pinnedDeps.charset-normalizer + pinnedDeps.idna + pinnedDeps.urllib3 + ]; + postPatch = '' + # https://github.com/ccxt/ccxt/blob/e6fd82900c9f2b71fa0fa7524d95dd788e2803fc/pyproject.toml#L88-L90 + # too many transitive usages to override + substituteInPlace pyproject.toml \ + --replace-fail '"cffi==2.0.0"' '"cffi"' \ + --replace-fail '"pycparser==3.0"' '"pycparser"' + ''; + meta = { + description = "A unified trading API with more than 100 crypto exchanges and prediction markets in JavaScript / TypeScript / Python / C# / PHP / Go / Java / Rust"; + homepage = "https://ccxt.com"; + changelog = "https://github.com/ccxt/ccxt/blob/${finalAttrs.src.rev}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/development/python-modules/ccxt/deps.nix b/pkgs/development/python-modules/ccxt/deps.nix new file mode 100644 index 00000000000000..d436718f77a21a --- /dev/null +++ b/pkgs/development/python-modules/ccxt/deps.nix @@ -0,0 +1,121 @@ +{ + fetchFromGitHub, + certifi, + requests, + aiohttp, + aiodns, + pycares, + yarl, + aiohttp-fast-zlib, + multidict, + coverage, + charset-normalizer, + setuptools, + idna, + urllib3, +}: + +# https://github.com/ccxt/ccxt/pull/29093 +# rerun `nix why-depends --derivation .#python3Packages.{ccxt,}` until no match +let + certifi' = certifi.overridePythonAttrs rec { + # https://github.com/NixOS/nixpkgs/pull/554025/changes/f64b15a4f03d3c7715f713934fd91d3d776daa75 + version = "2026.07.22"; + src = fetchFromGitHub { + owner = "certifi"; + repo = "python-certifi"; + tag = version; + hash = "sha256-euVWKJiFsx7F8YRMgRrrHswBmDBmrV/guiuvqtSUnSs="; + }; + }; + aiohttp' = ( + aiohttp.override { + multidict = multidict'; + yarl = yarl'; + aiodns = aiodns.override { + pycares = pycares.override { idna = idna'; }; + }; + } + ); + yarl' = yarl.override { + multidict = multidict'; + idna = idna'; + }; + multidict' = multidict.overridePythonAttrs rec { + version = "6.9.1"; + src = fetchFromGitHub { + owner = "aio-libs"; + repo = "multidict"; + tag = "v${version}"; + hash = "sha256-Xe8n3Y8x5fOS+xme5pKJuiiU6y+oXosZLoEA1Rkp+Qw="; + }; + # https://github.com/aio-libs/multidict/commit/ecc83e16512ff380b784294bdddaca169b47b1a4 + # or just remove `python -m coverage` like https://github.com/NixOS/nixpkgs/blob/6efd49fd338b7c7947843d5635620d99d017a9b5/pkgs/development/python-modules/typer/default.nix#L36 + nativeCheckInputs = [ coverage ]; + }; + charset-normalizer' = + (charset-normalizer.override { + setuptools = setuptools.overridePythonAttrs rec { + # https://github.com/jawah/charset_normalizer/blob/b66f922bfbdbdd9dd46af18a8964d4fb888756d4/pyproject.toml#L2 + version = "82.0.1"; + src = fetchFromGitHub { + owner = "pypa"; + repo = "setuptools"; + tag = "v${version}"; + hash = "sha256-M4fB+R4UNla2VlcWNhfDLvExQMpjLkPkgVsU4vg6ImU="; + }; + }; + }).overridePythonAttrs # https://github.com/NixOS/nixpkgs/issues/370936#issuecomment-6699941196 + ( + final: prev: { + # https://github.com/NixOS/nixpkgs/pull/541370/changes/59e6f2bdee0589aa705fa9584a5b81ad0c6cc864 + version = "3.4.7"; + src = fetchFromGitHub { + owner = "jawah"; + repo = "charset_normalizer"; + tag = final.version; + hash = "sha256-dOdJ4f98smCYdskp3BwtQG6aOyK+2a73+x580FKRWDk="; + }; + postPatch = (prev.postPatch or "") + '' + substituteInPlace _mypyc_hook/backend.py \ + --replace-fail "mypy>=1.4.1,<=1.20" "mypy" + ''; + } + ); + idna' = idna.overridePythonAttrs rec { + # https://github.com/NixOS/nixpkgs/pull/531987/changes/71bf5cc8cb35b23e1bc393533a5177898fabbfbd + version = "3.18"; + src = fetchFromGitHub { + owner = "kjd"; + repo = "idna"; + tag = "v${version}"; + hash = "sha256-9nLy/9PNuLSQJsf4Jes0uN695+LGjz2LXlfiZxxvGV4="; + }; + }; + urllib3' = urllib3.overridePythonAttrs rec { + version = "2.8.0"; + src = fetchFromGitHub { + owner = "urllib3"; + repo = "urllib3"; + tag = version; + hash = "sha256-/EABIEAZDr5936K5Utjlx0nsGHWsHoimqC6dGDuOJAo="; + }; + postPatch = ""; # https://github.com/NixOS/nixpkgs/pull/523660 + }; +in +{ + certifi = certifi'; + requests = requests.override { + idna = idna'; + urllib3 = urllib3'; + certifi = certifi'; + charset-normalizer = charset-normalizer'; + }; + aiohttp = aiohttp'; + yarl = yarl'; + aiohttp-fast-zlib = aiohttp-fast-zlib.override { aiohttp = aiohttp'; }; + multidict = multidict'; + charset-normalizer = charset-normalizer'; + idna = idna'; + urllib3 = urllib3'; +} diff --git a/pkgs/development/python-modules/datasieve/default.nix b/pkgs/development/python-modules/datasieve/default.nix new file mode 100644 index 00000000000000..d55cbb468603b2 --- /dev/null +++ b/pkgs/development/python-modules/datasieve/default.nix @@ -0,0 +1,32 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + poetry-core, + pandas, + scikit-learn, +}: + +buildPythonPackage (finalAttrs: { + pname = "datasieve"; + version = "0.1.9"; + src = fetchFromGitHub { + owner = "emergentmethods"; + repo = "datasieve"; + tag = "v${finalAttrs.version}"; + hash = "sha256-5TNqggX0Yebyn0sBe2BFEZDwXw5EpbPqi6/P1hMcF1U="; + }; + pyproject = true; + build-system = [ poetry-core ]; + buildInputs = [ + pandas + scikit-learn + ]; + meta = { + description = "Adding coherence to the SKLearn pipeline"; + homepage = "https://github.com/emergentmethods/datasieve"; + changelog = "https://github.com/emergentmethods/datasieve/releases/tag/${finalAttrs.src.rev}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/development/python-modules/pycoingecko/default.nix b/pkgs/development/python-modules/pycoingecko/default.nix new file mode 100644 index 00000000000000..d12f97695de6fb --- /dev/null +++ b/pkgs/development/python-modules/pycoingecko/default.nix @@ -0,0 +1,28 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + setuptools, + requests, +}: + +buildPythonPackage (finalAttrs: { + pname = "pycoingecko"; + version = "3.2.0"; + src = fetchFromGitHub { + owner = "man-c"; + repo = "pycoingecko"; + tag = finalAttrs.version; + hash = "sha256-ltqOp33t3jgofqT8NkDV/dy6qbn9e5vxkdLNn2ERpq8="; + }; + pyproject = true; + build-system = [ setuptools ]; + dependencies = [ requests ]; + meta = { + description = "Python wrapper around the CoinGecko API"; + homepage = "https://github.com/man-c/pycoingecko"; + changelog = "https://github.com/man-c/pycoingecko/blob/${finalAttrs.src.rev}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/development/python-modules/stable-baselines3-contrib/default.nix b/pkgs/development/python-modules/stable-baselines3-contrib/default.nix new file mode 100644 index 00000000000000..b52e89ec0310f4 --- /dev/null +++ b/pkgs/development/python-modules/stable-baselines3-contrib/default.nix @@ -0,0 +1,27 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + stable-baselines3, +}: + +buildPythonPackage (finalAttrs: { + pname = "stable-baselines3-contrib"; + version = "2.9.0"; + src = fetchFromGitHub { + owner = "Stable-Baselines-Team"; + repo = "stable-baselines3-contrib"; + tag = "v${finalAttrs.version}"; + hash = "sha256-HAaZKnplXSFfh42zQG1QUsKrMu7JFsWhhpP4r814RA0="; + }; + pyproject = true; + dependencies = [ stable-baselines3 ]; + dontCheckPythonMetadata = true; # https://github.com/Stable-Baselines-Team/stable-baselines3-contrib/blob/075bd5be8d43848b0f0cd3bc8a32f6892d0d58fb/setup.py#L66 + meta = { + description = "Contrib package for Stable-Baselines3 - Experimental reinforcement learning (RL) code"; + homepage = "https://sb3-contrib.readthedocs.io"; + changelog = "https://stable-baselines3.readthedocs.io/en/master/misc/changelog.html"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/development/python-modules/ta-lib/default.nix b/pkgs/development/python-modules/ta-lib/default.nix new file mode 100644 index 00000000000000..eb81a6031a3d83 --- /dev/null +++ b/pkgs/development/python-modules/ta-lib/default.nix @@ -0,0 +1,44 @@ +{ + lib, + fetchFromGitHub, + buildPythonPackage, + setuptools, + cython, + numpy, + ta-lib, +}: + +buildPythonPackage (finalAttrs: { + pname = "ta-lib"; + version = "0.8.3"; + src = fetchFromGitHub { + owner = "TA-Lib"; + repo = "ta-lib-python"; + tag = "v${finalAttrs.version}"; + hash = "sha256-zZeI1jMke5T32bwRfRUPZL7r9AgDzOsSnXX+SbmkGzQ="; + }; + pyproject = true; + build-system = [ + setuptools + cython + numpy + ]; + dependencies = [ numpy ]; + postPatch = '' + substituteInPlace pyproject.toml --replace-fail ', "cmake"]' ']' + ''; + dontConfigure = true; # use already built `ta-lib` to remove `cmake`: https://github.com/TA-Lib/ta-lib-python/blob/b273aa93a97cd027c7b6dc26e50f689400e06667/setup.py#L129 + env = { + # https://github.com/TA-Lib/ta-lib-python/pull/772 + TA_INCLUDE_PATH = "${ta-lib}/include"; + TA_LIBRARY_PATH = "${ta-lib}/lib"; + }; + buildInputs = [ ta-lib ]; + meta = { + description = "Python wrapper for TA-Lib"; + homepage = "https://ta-lib.github.io/ta-lib-python/"; + changelog = "https://github.com/TA-Lib/ta-lib-python/blob/${finalAttrs.src.rev}/CHANGELOG"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ n0099 ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b9527ef113b70e..d2c4b821967732 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1457,6 +1457,8 @@ self: super: with self; { asserts = callPackage ../development/python-modules/asserts { }; + ast-comments = callPackage ../development/python-modules/ast-comments { }; + ast-grep-cli = callPackage ../development/python-modules/ast-grep-cli { }; ast-grep-py = callPackage ../development/python-modules/ast-grep-py { }; @@ -3026,6 +3028,8 @@ self: super: with self; { cccolutils = callPackage ../development/python-modules/cccolutils { krb5-c = pkgs.krb5; }; + ccxt = callPackage ../development/python-modules/ccxt { }; + cdcs = callPackage ../development/python-modules/cdcs { }; cddlparser = callPackage ../development/python-modules/cddlparser { }; @@ -4208,6 +4212,8 @@ self: super: with self; { datashader = callPackage ../development/python-modules/datashader { }; + datasieve = callPackage ../development/python-modules/datasieve { }; + datasketch = callPackage ../development/python-modules/datasketch { }; datastar-py = callPackage ../development/python-modules/datastar-py { }; @@ -14956,6 +14962,8 @@ self: super: with self; { pycoin = callPackage ../development/python-modules/pycoin { }; + pycoingecko = callPackage ../development/python-modules/pycoingecko { }; + pycollada = callPackage ../development/python-modules/pycollada { }; pycolorecho = callPackage ../development/python-modules/pycolorecho { }; @@ -20305,6 +20313,8 @@ self: super: with self; { stable-baselines3 = callPackage ../development/python-modules/stable-baselines3 { }; + stable-baselines3-contrib = callPackage ../development/python-modules/stable-baselines3-contrib { }; + stac-valid = callPackage ../development/python-modules/stac-valid { }; stack-data = callPackage ../development/python-modules/stack-data { }; @@ -20757,6 +20767,8 @@ self: super: with self; { t61codec = callPackage ../development/python-modules/t61codec { }; + ta-lib = callPackage ../development/python-modules/ta-lib { inherit (pkgs) ta-lib; }; + tabcmd = callPackage ../development/python-modules/tabcmd { }; tableaudocumentapi = callPackage ../development/python-modules/tableaudocumentapi { };