From 51fb871f577a937c00d7b5cac2056ac71a788b44 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 1 Jan 2026 19:43:35 -0500 Subject: [PATCH] Skip `ruff` dev-dep on nix(os) overlays Since the linking will be borked if we pull the wheel using `uv`; we need to instead delegate to the `nixpkgs` version in the dev-shell. `pyrpoject` deats, - add a new deps-group: 'lint' which contains `ruff`. - drop `ruff` from std deps (not sure how it got there anyway). - mv `elasticsearch` to a new `dbs` deps group (we don't really even want to be using it in the near furure). - mv `uis` group into dep-groups section from `project.optionals-deps`. - add a `tool.uv.default-groups = ['uis', 'dev']` setting which then will avoid install of any non-explicit extras. - put `rapidfuzz` only in `uis` group. `flake.nix` tweaks, - include `ruff` and `pypkgs.ruff` in the overlay. - pass `--no-group ruff` to the `uv sync` line of shell init. --- flake.nix | 6 +++++- pyproject.toml | 32 +++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 7faf50a5..05ee1fa1 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,10 @@ bashInteractive bash-completion + # dev utils + ruff + pypkgs.ruff + qt6.qtwayland qt6.qtbase @@ -85,7 +89,7 @@ # - always use the ./py313/ venv-subdir export UV_PROJECT_ENVIRONMENT="py313" # sync project-env with all extras - uv sync --dev --all-extras + uv sync --dev --all-extras --no-group lint # ------ TIPS ------ # NOTE, to launch the py-venv installed `xonsh` (like @goodboy) diff --git a/pyproject.toml b/pyproject.toml index 0b72fdb2..6b130778 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,8 +63,6 @@ dependencies = [ "trio-util >=0.7.0, <0.8.0", "trio-websocket >=0.10.3, <0.11.0", "typer >=0.9.0, <1.0.0", - "rapidfuzz >=3.5.2, <4.0.0", - "pdbp >=1.5.0, <2.0.0", "trio >=0.27", "pendulum", "httpx >=0.27.0, <0.28.0", @@ -77,9 +75,13 @@ dependencies = [ "trio-typing>=0.10.0", "numba>=0.61.0", "pyvnc", + # TODO? mv to dev group? + "pdbp >=1.5.0, <2.0.0", ] +# ------ dependencies ------ -[project.optional-dependencies] + +[dependency-groups] uis = [ # https://docs.astral.sh/uv/concepts/projects/dependencies/#optional-dependencies # TODO: make sure the levenshtein shit compiles on nix.. @@ -94,7 +96,6 @@ uis = [ # https://docs.astral.sh/uv/concepts/projects/dependencies/#optional-dependencies ] -[dependency-groups] # TODO: a toolset that makes debugging a `pikerd` service (tree) easy # to hack on directly using more or less the local env: # - xonsh + xxh @@ -105,12 +106,11 @@ uis = [ # use `uv --dev` to enable dev = [ "pytest", - "elasticsearch >=8.9.0, <9.0.0", "prompt-toolkit ==3.0.40", "cython >=3.0.0, <4.0.0", "greenback >=1.1.1, <2.0.0", - "ruff>=0.9.6", "pyperclip>=1.9.0", + # DE-specific "i3ipc>=2.2.1", # ?from git, see below. @@ -120,6 +120,19 @@ dev = [ "pyqtgraph", ] +lint = [ + # XXX, with flake.nix needs to be from nixpkgs + "ruff>=0.9.6" + # + # ^TODO? these markers don't work; use deps-flags for now? + # ; os_name != 'nixos' and platform_system != 'NixOS'", + # ; defined('IN_NIX_SHELL')", +] +dbs = [ + "elasticsearch >=8.9.0, <9.0.0", +] +# ------ dependency-groups ------ + [tool.pytest.ini_options] # https://docs.pytest.org/en/stable/reference/reference.html#configuration-options @@ -132,24 +145,29 @@ console_output_style = 'progress' # https://docs.pytest.org/en/stable/how-to/plugins.html#disabling-plugins-from-autoloading # https://docs.pytest.org/en/stable/how-to/plugins.html#deactivating-unregistering-a-plugin-by-name addopts = '-p no:xonsh' +# ------ tool.pytest ------ [project.scripts] piker = "piker.cli:cli" pikerd = "piker.cli:pikerd" ledger = "piker.accounting.cli:ledger" +# ------ project.scripts ------ [tool.hatch.build.targets.sdist] include = ["piker"] - [tool.hatch.build.targets.wheel] include = ["piker"] +# ------ tool.hatch ------ # TODO? move to a `uv.toml`? [tool.uv] python-preference = 'system' python-downloads = 'manual' +# https://docs.astral.sh/uv/concepts/projects/dependencies/#default-groups +default-groups = ['uis', 'dev'] +# ------ tool.uv ------ [tool.uv.sources]