From 8f8b955ff4e406cd3d5b45f07371d33e4a7825b3 Mon Sep 17 00:00:00 2001 From: ^_^ <8480595+ballaballaballa@users.noreply.github.com> Date: Wed, 29 Oct 2025 12:39:41 +0100 Subject: [PATCH] feat: migrate to bbpb and platformdirs, add dependency version constraints - Migrate from blackboxprotobuf to bbpb (new PyPI package name) - Update pyproject.toml and shell.nix dependencies - Import name remains 'blackboxprotobuf' (no code changes) - Migrate from appdirs to platformdirs - Replace deprecated appdirs with actively maintained platformdirs - Update grawlix/config.py to use platformdirs.user_config_dir - Update dependency declarations in pyproject.toml and shell.nix - Add minimum version constraints for all dependencies - Set requires-python = ">=3.9" (required by httpx and importlib.resources.files()) - Add Python version classifiers (3.9-3.13) - Specify minimum versions: beautifulsoup4>=4.9.0, bbpb>=1.0.0, EbookLib>=0.17, httpx>=0.23.0, importlib-resources>=5.0, lxml>=4.6.0, platformdirs>=3.0.0, pycryptodome>=3.10.0, rich>=10.0.0 - Make tomli conditional: only required for Python < 3.11 - Update shell.nix with correct SHA256 hash for bbpb 1.4.2 These changes ensure all dependencies meet minimum version requirements for Python 3.9+ compatibility and replace deprecated packages with actively maintained alternatives. --- grawlix/config.py | 4 ++-- pyproject.toml | 26 ++++++++++++++++---------- shell.nix | 12 ++++-------- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/grawlix/config.py b/grawlix/config.py index 2ede0ae..c7daa36 100644 --- a/grawlix/config.py +++ b/grawlix/config.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from typing import Optional import tomli -import appdirs +from platformdirs import user_config_dir import os @@ -27,7 +27,7 @@ def load_config() -> Config: :returns: Config object """ - config_dir = appdirs.user_config_dir("grawlix", "jo1gi") + config_dir = user_config_dir("grawlix", "jo1gi") config_file = os.path.join(config_dir, "grawlix.toml") if os.path.exists(config_file): try: diff --git a/pyproject.toml b/pyproject.toml index 83ffec8..0dd718f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,21 +6,27 @@ authors = [ description = "CLI tool for downloading ebooks" readme = "README.md" keywords = ["ebook", "cli", "downloader"] +requires-python = ">=3.9" classifiers = [ "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", ] dependencies = [ - "appdirs", - "beautifulsoup4", - "blackboxprotobuf", - "EbookLib", - "httpx", - "importlib-resources", - "lxml", - "pycryptodome", - "rich", - "tomli", + "beautifulsoup4>=4.9.0", + "bbpb>=1.0.0", + "EbookLib>=0.17", + "httpx>=0.23.0", + "importlib-resources>=5.0", + "lxml>=4.6.0", + "platformdirs>=3.0.0", + "pycryptodome>=3.10.0", + "rich>=10.0.0", + "tomli>=1.0.0; python_version<'3.11'", ] dynamic = ["version"] diff --git a/shell.nix b/shell.nix index 83e4454..da58cc4 100644 --- a/shell.nix +++ b/shell.nix @@ -2,22 +2,18 @@ with import {}; let blackboxprotobuf = python3Packages.buildPythonPackage rec { - pname = "blackboxprotobuf"; - version = "1.0.1"; + pname = "bbpb"; + version = "1.4.2"; src = python3Packages.fetchPypi { inherit pname version; - sha256 = "sha256-IztxTmwkzp0cILhxRioiCvkXfk/sAcG3l6xauGoeHOo="; + sha256 = "03446991bc500cfc9dd2049e6cc9489979e157c5ecb793e27936ab3d579d3496"; }; propagatedBuildInputs = with python3Packages; [ protobuf ]; - patchPhase = '' - sed 's/protobuf==3.10.0/protobuf/' requirements.txt > requirements.txt - ''; - doCheck = false; }; ebooklib = python3Packages.buildPythonPackage rec { @@ -36,13 +32,13 @@ in mkShell { buildInputs = [ (python3.withPackages(ps: with ps; [ - appdirs beautifulsoup4 blackboxprotobuf ebooklib httpx importlib-resources lxml + platformdirs pycryptodome rich tomli