From 4e7e2e818a6549facba1a2d4d18d1f02ff3128d2 Mon Sep 17 00:00:00 2001 From: Justin Spears Date: Mon, 16 Nov 2026 23:10:11 +0000 Subject: [PATCH 1/6] Add reproducible Python lint and unit checks Assisted-by: Replit --- flake.lock | 142 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 64 ++++++++++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8f49e8e --- /dev/null +++ b/flake.lock @@ -0,0 +1,142 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729742964, + "narHash": "sha256-B4mzTcQ0FZHdpeWcpDYPERtyjJd/NIuaQ9+BV1h+MpA=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "e04df33f62cdcf93d73e9a04142464753a16db67", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1767313136, + "narHash": "sha256-16KkgfdYqjaeRGBaYsNrhPRRENs0qzkQVUooNHtoy2w=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ac62194c3917d5f474c1a844b6fd6da2db95077d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1743690424, + "narHash": "sha256-cX98bUuKuihOaRp8dNV1Mq7u6/CQZWTPth2IJPATBXc=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "ce2369db77f45688172384bbeb962bc6c2ea6f94", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730120726, + "narHash": "sha256-LqHYIxMrl/1p3/kvm2ir925tZ8DkI0KA10djk8wecSk=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "9ef337e492a5555d8e17a51c911ff1f02635be15", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e8d7c49 --- /dev/null +++ b/flake.nix @@ -0,0 +1,64 @@ +{ + description = "Reproducible checks for the Object Storage Python client"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + poetry2nix.url = "github:nix-community/poetry2nix"; + poetry2nix.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { nixpkgs, poetry2nix, ... }: + let + pkgs = import nixpkgs { system = "x86_64-linux"; }; + inherit (pkgs) lib; + dependencies = lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.unions [ ./pyproject.toml ./poetry.lock ]; + }; + poetry = poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }; + python = poetry.mkPoetryEnv { + projectDir = dependencies; + python = pkgs.python310; + preferWheels = true; + groups = [ "main" ]; + checkGroups = [ ]; + extraPackages = ps: [ ps.ruff ps.pytest ps.pytest-cov ]; + overrides = poetry.defaultPoetryOverrides.extend (_final: prev: { + fetchFromPypi = args: (prev.fetchFromPypi args).overrideAttrs (old: + let + parts = lib.splitString "-" args.file; + pythonTag = builtins.elemAt parts (builtins.length parts - 3); + in + { + # PyPI's wheel redirect uses the Python tag, not a literal "wheel". + predictedURL = builtins.replaceStrings + [ "/wheel/" ] [ "/${pythonTag}/" ] old.predictedURL; + }); + }); + }; + source = lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.unions [ ./src ./tests ./pyproject.toml ]; + }; + in + { + checks.x86_64-linux = { + lint = pkgs.runCommand "object-storage-lint" { nativeBuildInputs = [ python ]; } '' + cp -r ${source} source + chmod -R u+w source + cd source + ruff check src tests + touch "$out" + ''; + unit = pkgs.runCommand "object-storage-unit" { nativeBuildInputs = [ python ]; } '' + cp -r ${source} source + chmod -R u+w source + cd source + export PYTHONPATH="$PWD/src" + pytest --cov-report term-missing --cov=./src ./tests/unit + mkdir -p "$out" + cp .coverage "$out/" + ''; + }; + }; +} From 7ae4f5e9db969a52220ea7998b7ec6bd52b49dc3 Mon Sep 17 00:00:00 2001 From: Justin Spears Date: Tue, 17 Nov 2026 00:08:11 +0000 Subject: [PATCH 2/6] Verify unchanged check inputs, sample 2 Assisted-by: Replit From 5a3ad9fe3f1959fc1ac08b17e06b51303a81ec5e Mon Sep 17 00:00:00 2001 From: Justin Spears Date: Tue, 17 Nov 2026 00:11:02 +0000 Subject: [PATCH 3/6] Verify unchanged check inputs, sample 3 Assisted-by: Replit From ee61609dbdbabea99e035c71664b42c45d392580 Mon Sep 17 00:00:00 2001 From: Justin Spears Date: Tue, 17 Nov 2026 00:15:37 +0000 Subject: [PATCH 4/6] Verify test source invalidation, sample 1 Assisted-by: Replit --- tests/unit/replit/object_storage/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/replit/object_storage/test_client.py b/tests/unit/replit/object_storage/test_client.py index f2712c0..7592b0b 100644 --- a/tests/unit/replit/object_storage/test_client.py +++ b/tests/unit/replit/object_storage/test_client.py @@ -27,7 +27,7 @@ def requests_get(): def test_get_default_bucket_success(): result = Client().exists("object-name") - assert result + assert result is True @patch.object(requests, "get") From 01c44e9318d8d51efaaeff97490589f681b5b7ea Mon Sep 17 00:00:00 2001 From: Justin Spears Date: Tue, 17 Nov 2026 00:35:18 +0000 Subject: [PATCH 5/6] Verify test failure propagation Assisted-by: Replit --- tests/unit/replit/object_storage/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/replit/object_storage/test_client.py b/tests/unit/replit/object_storage/test_client.py index 7592b0b..9c1016f 100644 --- a/tests/unit/replit/object_storage/test_client.py +++ b/tests/unit/replit/object_storage/test_client.py @@ -27,7 +27,7 @@ def requests_get(): def test_get_default_bucket_success(): result = Client().exists("object-name") - assert result is True + assert result is False @patch.object(requests, "get") From 3a966c3510ab5e044bb586f9d5d0d3169bc01eae Mon Sep 17 00:00:00 2001 From: Justin Spears Date: Tue, 17 Nov 2026 00:35:50 +0000 Subject: [PATCH 6/6] Restore final check inputs after validation Assisted-by: Replit --- tests/unit/replit/object_storage/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/replit/object_storage/test_client.py b/tests/unit/replit/object_storage/test_client.py index 9c1016f..f2712c0 100644 --- a/tests/unit/replit/object_storage/test_client.py +++ b/tests/unit/replit/object_storage/test_client.py @@ -27,7 +27,7 @@ def requests_get(): def test_get_default_bucket_success(): result = Client().exists("object-name") - assert result is False + assert result @patch.object(requests, "get")