From 139cc86d20ffdb3c888cc6a066a275e95fc1684d Mon Sep 17 00:00:00 2001 From: teutat3s Date: Sat, 6 Jan 2024 17:15:26 +0100 Subject: [PATCH] fix: python deps cleanup --- python-overlay.nix | 24 +++++++---- python/barcodenumber.nix | 15 +++++++ python/erpnext.nix | 17 ++++---- python/frappe.nix | 55 ++++--------------------- python/gocardless-pro.nix | 19 --------- python/jsonobject.nix | 17 -------- python/pydantic.nix | 85 +++++++++++++++++++++++++++++++++++++++ python/redisearch.nix | 28 ------------- python/rejson.nix | 24 ----------- python/taxjar.nix | 22 ---------- 10 files changed, 131 insertions(+), 175 deletions(-) create mode 100644 python/barcodenumber.nix delete mode 100644 python/gocardless-pro.nix delete mode 100644 python/jsonobject.nix create mode 100644 python/pydantic.nix delete mode 100644 python/redisearch.nix delete mode 100644 python/rejson.nix delete mode 100644 python/taxjar.nix diff --git a/python-overlay.nix b/python-overlay.nix index 8951ea3..f521d65 100644 --- a/python-overlay.nix +++ b/python-overlay.nix @@ -12,22 +12,30 @@ final: prev: { honcho = pyFinal.callPackage ./python/honcho.nix {}; # erpnext dependencies - gocardless-pro = pyFinal.callPackage ./python/gocardless-pro.nix {}; - redisearch = pyFinal.callPackage ./python/redisearch.nix {}; - taxjar = pyFinal.callPackage ./python/taxjar.nix {}; + barcodenumber = pyFinal.callPackage ./python/barcodenumber.nix {}; # frappe dependencies email-reply-parser = pyFinal.callPackage ./python/email-reply-parser.nix {}; maxminddb-geolite2 = pyFinal.callPackage ./python/maxminddb-geolite2.nix {}; psycopg2-binary = pyFinal.callPackage ./python/psycopg2-binary.nix {}; traceback-with-variables = pyFinal.callPackage ./python/traceback-with-variables.nix {}; + pydantic = pyFinal.callPackage ./python/pydantic.nix {}; - # indirect dependencies - # taxjar - jsonobject = pyFinal.callPackage ./python/jsonobject.nix {}; - # redisearch - rejson = pyFinal.callPackage ./python/rejson.nix {}; + versioningit = pyPrev.versioningit.overridePythonAttrs (oldAttrs: (rec { + version = "2.2.1"; + src = pyPrev.fetchPypi { + inherit version; + inherit (oldAttrs) pname; + hash = "sha256-DlgkLXq9phrmNZalSUrp7WMayF2Ls8yOF24yU8pLy7U="; + }; + })); + fastapi = pyPrev.fastapi.overridePythonAttrs (oldAttrs: (rec { + propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ + pyPrev.pydantic-settings + pyPrev.pydantic-extra-types + ]; + })); plaid-python = pyPrev.plaid-python.overridePythonAttrs (oldAttrs: (rec { version = "7.2.1"; diff --git a/python/barcodenumber.nix b/python/barcodenumber.nix new file mode 100644 index 0000000..1dc0d58 --- /dev/null +++ b/python/barcodenumber.nix @@ -0,0 +1,15 @@ +{ + buildPythonPackage, + fetchPypi, +}: +buildPythonPackage rec { + pname = "barcodenumber"; + version = "0.2.1"; + src = fetchPypi { + inherit pname version; + sha256 = "sha256-nW8+m32i42kLR4oC4lrKoBkFYgKHgpZPGAFNJvtLMhc="; + }; + propagatedBuildInputs = [ ]; + nativeBuildInputs = [ ]; + doCheck = false; +} diff --git a/python/erpnext.nix b/python/erpnext.nix index 3f45bd9..093430d 100644 --- a/python/erpnext.nix +++ b/python/erpnext.nix @@ -6,18 +6,16 @@ # Core dependencies , pycountry -, python-stdnum , unidecode -, redisearch +, barcodenumber , rapidfuzz +, holidays # Integration dependencies -, gocardless-pro , googlemaps , plaid-python , python-youtube -, taxjar -, tweepy +, pypng }: let pinData = import ../srcs/pin.nix; @@ -47,17 +45,16 @@ buildPythonPackage rec { propagatedBuildInputs = [ # Core dependencies pycountry - python-stdnum unidecode - redisearch + barcodenumber rapidfuzz + holidays # Integration dependencies - gocardless-pro googlemaps plaid-python python-youtube - taxjar - tweepy + # used for QR code generation + pypng ]; } diff --git a/python/frappe.nix b/python/frappe.nix index 9cf6fb3..a36e516 100644 --- a/python/frappe.nix +++ b/python/frappe.nix @@ -8,12 +8,13 @@ , babel , click , filelock +, filetype , gitpython , jinja2 , pillow , pyjwt , pymysql -, pypdf2 +, pypdf , pypika , pyqrcode , pyyaml @@ -30,7 +31,6 @@ , cryptography , email-reply-parser , git-url-parse -, gitdb , gunicorn , html5lib , ipython @@ -47,12 +47,9 @@ , premailer , psutil , psycopg2-binary -, pyasn1 -, pycountry -, pycryptodome +, pydantic , pyopenssl , pyotp -, pypng , python-dateutil , pytz , rauth @@ -63,11 +60,11 @@ , rq , rsa , semantic-version +, sentry-sdk , sqlparse , tenacity , terminaltables , traceback-with-variables -, urllib3 , xlrd , zxcvbn , markdownify @@ -76,7 +73,6 @@ , boto3 , dropbox , google-api-python-client -, google-auth-httplib2 , google-auth-oauthlib , google-auth , posthog @@ -100,48 +96,18 @@ buildPythonPackage rec { format = "pyproject"; nativeBuildInputs = [ pythonRelaxDepsHook flit-core ]; - pythonRelaxDeps = [ - "Babel" - "beautifulsoup4" - "boto3" - "cairocffi" - "Click" - "croniter" - "cryptography" - "filelock" - "google-api-python-client" - "google-auth" - "hiredis" - "ipython" - "openpyxl" - "phonenumbers" - "Pillow" - "pyasn1" - "pycountry" - "pycryptodome" - "PyJWT" - "PyMySQL" - "pyOpenSSL" - "pyotp" - "pypng" - "pytz" - "redis" - "requests" - "rq" - "tenacity" - "WeasyPrint" - ]; propagatedBuildInputs = [ babel click filelock + filetype gitpython jinja2 pillow pyjwt pymysql - pypdf2 + pypdf pypika pyqrcode pyyaml @@ -158,7 +124,6 @@ buildPythonPackage rec { cryptography email-reply-parser git-url-parse - gitdb gunicorn html5lib ipython @@ -175,12 +140,9 @@ buildPythonPackage rec { premailer psutil psycopg2-binary - pyasn1 - pycountry - pycryptodome + pydantic pyopenssl pyotp - pypng python-dateutil pytz rauth @@ -191,11 +153,11 @@ buildPythonPackage rec { rq rsa semantic-version + sentry-sdk sqlparse tenacity terminaltables traceback-with-variables - urllib3 xlrd zxcvbn markdownify @@ -204,7 +166,6 @@ buildPythonPackage rec { boto3 dropbox google-api-python-client - google-auth-httplib2 google-auth-oauthlib google-auth posthog diff --git a/python/gocardless-pro.nix b/python/gocardless-pro.nix deleted file mode 100644 index 77907d0..0000000 --- a/python/gocardless-pro.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - buildPythonPackage, - fetchPypi, - requests, - six -}: -buildPythonPackage rec { - pname = "gocardless-pro"; - version = "1.22.0"; - src = fetchPypi { - pname = "gocardless_pro"; - inherit version; - sha256 = "sha256-i4gBeJvl/aCujeXGvJG+z1Wp2aczKg8clnfMyK8fz/w="; - }; - propagatedBuildInputs = [ - requests - six - ]; -} diff --git a/python/jsonobject.nix b/python/jsonobject.nix deleted file mode 100644 index 8751792..0000000 --- a/python/jsonobject.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - buildPythonPackage, - fetchPypi, - cython, - six -}: -buildPythonPackage rec { - pname = "jsonobject"; - version = "2.1.0"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-UpijeVA+Q+/Aq0AC10LA/LuhqWKO3azE6lR7cThRRGY="; - }; - propagatedBuildInputs = [ six ]; - nativeBuildInputs = [ cython ]; - doCheck = false; -} diff --git a/python/pydantic.nix b/python/pydantic.nix new file mode 100644 index 0000000..1370f58 --- /dev/null +++ b/python/pydantic.nix @@ -0,0 +1,85 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pythonOlder +, hatchling +, hatch-fancy-pypi-readme +, libxcrypt +, annotated-types +, pydantic-core +, typing-extensions +, email-validator +, dirty-equals +, faker +, pytestCheckHook +, pytest-mock +}: + +buildPythonPackage rec { + pname = "pydantic"; + version = "2.3.0"; + pyproject = true; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "pydantic"; + repo = "pydantic"; + rev = "refs/tags/v${version}"; + hash = "sha256-toqrWg8bYzc3UmvG/YmXawfmT8nqaA9fxy24k1cdj+M="; + }; + + buildInputs = lib.optionals (pythonOlder "3.9") [ + libxcrypt + ]; + + nativeBuildInputs = [ + hatch-fancy-pypi-readme + hatchling + ]; + + propagatedBuildInputs = [ + annotated-types + pydantic-core + typing-extensions + ]; + + passthru.optional-dependencies = { + email = [ + email-validator + ]; + }; + + nativeCheckInputs = [ + dirty-equals + faker + pytest-mock + pytestCheckHook + ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); + + preCheck = '' + export HOME=$(mktemp -d) + substituteInPlace pyproject.toml \ + --replace "'--benchmark-columns', 'min,mean,stddev,outliers,rounds,iterations'," "" \ + --replace "'--benchmark-group-by', 'group'," "" \ + --replace "'--benchmark-warmup', 'on'," "" \ + --replace "'--benchmark-disable'," "" + ''; + + disabledTestPaths = [ + "tests/benchmarks" + + # avoid cyclic dependency + "tests/test_docs.py" + ]; + + pythonImportsCheck = [ "pydantic" ]; + + meta = with lib; { + description = "Data validation and settings management using Python type hinting"; + homepage = "https://github.com/pydantic/pydantic"; + changelog = "https://github.com/pydantic/pydantic/blob/v${version}/HISTORY.md"; + license = licenses.mit; + maintainers = with maintainers; [ wd15 ]; + }; +} diff --git a/python/redisearch.nix b/python/redisearch.nix deleted file mode 100644 index 7c0c7a1..0000000 --- a/python/redisearch.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ buildPythonPackage -, fetchPypi -, pythonRelaxDepsHook -, unittestCheckHook -, redis -, rejson -, hiredis -}: -buildPythonPackage rec { - pname = "redisearch"; - version = "2.1.1"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-V1rNWhOhB/8AXUVyoTa1A7Evpb8mr8N70R9qkj8exzw="; - }; - nativeBuildInputs = [ pythonRelaxDepsHook ]; - pythonRelaxDeps = [ - "redis" - ]; - propagatedBuildInputs = [ - redis - rejson - hiredis - ]; - nativeCheckInputs = [ - unittestCheckHook - ]; -} diff --git a/python/rejson.nix b/python/rejson.nix deleted file mode 100644 index 3e72a45..0000000 --- a/python/rejson.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ buildPythonPackage -, pythonRelaxDepsHook -, unittestCheckHook -, fetchPypi -, redis -, six -}: -buildPythonPackage rec { - pname = "rejson"; - version = "0.5.6"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-vs3hNSAAUAi3ls5WyxKOsiUC18addIJv81HNQ79zvJc="; - }; - nativeBuildInputs = [ pythonRelaxDepsHook ]; - pythonRelaxDeps = [ - "redis" - ]; - propagatedBuildInputs = [ - redis - six - ]; - doCheck = false; -} diff --git a/python/taxjar.nix b/python/taxjar.nix deleted file mode 100644 index 611d28b..0000000 --- a/python/taxjar.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - buildPythonPackage, - fetchPypi, - jsonobject, - requests, - mock -}: -buildPythonPackage rec { - pname = "taxjar"; - version = "1.9.2"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-c8lkCLzEmNTuBYLyVNRQq4SLSveDpNKKf6NHxHpg7Ec="; - }; - propagatedBuildInputs = [ - jsonobject - requests - ]; - checkInputs = [ - mock - ]; -}