simple-web-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 83950c271ffd4b879f8ea4c61a7e9ec78e05e50c
parent 17a15da6da49a63ff6d13bb4175798ef5ae46474
Author: Silas Brack <silasbrack@gmail.com>
Date:   Mon, 29 Sep 2025 23:27:04 +0200

docs: clean up, fix documentation

Diffstat:
Mflake.nix | 61+++++++++++++++++++++++++------------------------------------
Mpyproject.toml | 4++--
2 files changed, 27 insertions(+), 38 deletions(-)

diff --git a/flake.nix b/flake.nix @@ -43,14 +43,12 @@ sourcePreference = "wheel"; }; - - # Construct package set pythonSets = forAllSystems ( system: - let + let pkgs = nixpkgs.legacyPackages.${system}; - inherit (pkgs) stdenv; + inherit (pkgs) stdenv; baseSet = pkgs.callPackage pyproject-nix.build.packages { python = pkgs.python313; }; @@ -122,21 +120,20 @@ }; }; - }; - }); + }; + }); }; - in + in # Use base package set from pyproject.nix builders - baseSet.overrideScope - ( - lib.composeManyExtensions [ - pyproject-build-systems.overlays.default - overlay - pyprojectOverrides - includeLoggingConfigOverride - ] - ) - ); + baseSet.overrideScope ( + lib.composeManyExtensions [ + pyproject-build-systems.overlays.default + overlay + pyprojectOverrides + includeLoggingConfigOverride + ] + ) + ); # inherit (pkgs.callPackages pyproject-nix.build.util { }) mkApplication; in @@ -144,7 +141,9 @@ # Package a virtual environment as our main application. # # Enable no optional dependencies for production build. - packages = forAllSystems (system: { default = pythonSets.${system}.mkVirtualEnv "simple-web-app-env" workspace.deps.default; }); + packages = forAllSystems (system: { + default = pythonSets.${system}.mkVirtualEnv "simple-web-app-env" workspace.deps.default; + }); # default = mkApplication { # venv = pythonSet.mkVirtualEnv "simple-web-app-env" workspace.deps.default; @@ -157,12 +156,13 @@ let appRoot = self.packages.${system}.default; appProgram = "${appRoot}/bin/simple-web-app"; - in { + in + { default = { type = "app"; program = appProgram; }; - } + } ); # Run the checks by running `nix flake check` @@ -181,10 +181,11 @@ # - Pure development using uv2nix to manage virtual environments devShells = forAllSystems ( system: - let + let pkgs = nixpkgs.legacyPackages.${system}; python = pkgs.python313; - in { + in + { # It is of course perfectly OK to keep using an impure virtualenv workflow and only use uv2nix to build packages. # This devShell simply adds Python and undoes the dependency leakage done by Nixpkgs Python infrastructure. impure = pkgs.mkShell { @@ -245,20 +246,7 @@ (old.src + "/src/simple_web_app/__init__.py") ]; }; - - # # Hatchling (our build system) has a dependency on the `editables` package when building editables. - # # - # # In normal Python flows this dependency is dynamically handled, and doesn't need to be explicitly declared. - # # This behaviour is documented in PEP-660. - # # - # # With Nix the dependency needs to be explicitly declared. - # nativeBuildInputs = - # old.nativeBuildInputs - # ++ final.resolveBuildSystem { - # editables = [ ]; - # }; }); - }) ] ); @@ -297,6 +285,7 @@ export REPO_ROOT=$(git rev-parse --show-toplevel) ''; }; - }); + } + ); }; } diff --git a/pyproject.toml b/pyproject.toml @@ -22,7 +22,7 @@ dependencies = [ dev = [ { include-group = "test" }, "ruff", - "watchfiles", + "watchfiles", # Watch non-*.py files with uvicorn ] test = [ "pytest", @@ -43,5 +43,5 @@ build-backend = "setuptools.build_meta" where = ["src"] [tool.setuptools.package-data] -simple_web_app = ["queries/**", "migrations/**", "templates/**", "static/**", "logging.json"] +simple_web_app = ["queries/**", "migrations/**", "templates/**", "static/**"]