Skip to content

python: switch to upstream Poetry package#480

Draft
ryantm wants to merge 1 commit intomainfrom
drop-custom-poetry-fork
Draft

python: switch to upstream Poetry package#480
ryantm wants to merge 1 commit intomainfrom
drop-custom-poetry-fork

Conversation

@ryantm
Copy link
Copy Markdown
Collaborator

@ryantm ryantm commented Apr 15, 2026

Why

The Python modules were still pinned to the old Replit Poetry fork and prebuilt bundle tarballs even though upstream Poetry has caught up on the resolver and installer improvements we originally needed.

What changed

  • replaced the custom bundled Poetry derivations with a thin wrapper around upstream nixpkgs poetry
  • build Poetry against the module's selected Python version with pkgs.poetry.override { python3 = python; } so installs land in the matching .pythonlibs/lib/pythonX.Y/site-packages
  • kept the existing low-vCPU installer parallelism guard in the wrapper
  • removed the old Replit-only Poetry env vars and deleted the obsolete bundle files/docs
  • updated python-base to use the same upstream per-Python Poetry package

Test plan

  • nix shell nixpkgs#nixpkgs-fmt -c nixpkgs-fmt pkgs/poetry/default.nix pkgs/modules/python/default.nix pkgs/modules/python-base/default.nix
  • nix build --impure --no-link --print-out-paths --expr 'let flake = builtins.getFlake (toString /home/developer/replit/nixmodules); pkgs = import flake.inputs.nixpkgs { system = "x86_64-linux"; overlays = [ flake.overlays.default flake.inputs.prybar.overlays.default flake.inputs.java-language-server.overlays.default flake.inputs.nil.overlays.default flake.inputs.fenix.overlays.default flake.inputs.replit-rtld-loader.overlays.default ]; config.allowUnfreePredicate = pkg: true; }; in pkgs.callPackage /home/developer/replit/nixmodules/pkgs/poetry { python = pkgs.python312; }'
  • nix eval --impure --json --expr 'let flake = builtins.getFlake (toString /home/developer/replit/nixmodules); pkgs = import flake.inputs.nixpkgs { system = "x86_64-linux"; overlays = [ flake.overlays.default flake.inputs.prybar.overlays.default flake.inputs.java-language-server.overlays.default flake.inputs.nil.overlays.default flake.inputs.fenix.overlays.default flake.inputs.replit-rtld-loader.overlays.default ]; config.allowUnfreePredicate = pkg: true; }; mod = import /home/developer/replit/nixmodules/pkgs/modules/python { python = pkgs.python312; pypkgs = pkgs.python312Packages; }; cfg = mod { pkgs-unstable = pkgs; lib = pkgs.lib; }; in { poetryCache = cfg.replit.env.POETRY_CACHE_DIR; poetryCreatesVenv = cfg.replit.env.POETRY_VIRTUALENVS_CREATE; poetryPackage = builtins.elemAt cfg.replit.packages 2; }'
  • nix eval --impure --json --expr 'let flake = builtins.getFlake (toString /home/developer/replit/nixmodules); pkgs = import flake.inputs.nixpkgs { system = "x86_64-linux"; overlays = [ flake.overlays.default flake.inputs.prybar.overlays.default flake.inputs.java-language-server.overlays.default flake.inputs.nil.overlays.default flake.inputs.fenix.overlays.default flake.inputs.replit-rtld-loader.overlays.default ]; config.allowUnfreePredicate = pkg: true; }; mod = import /home/developer/replit/nixmodules/pkgs/modules/python-base { python = pkgs.python313; pypkgs = pkgs.python313Packages; }; cfg = mod { pkgs-unstable = pkgs; pkgs-23_05 = pkgs; lib = pkgs.lib; }; in { poetryPackage = builtins.elemAt cfg.replit.packages 2; pythonUserbase = cfg.replit.env.PYTHONUSERBASE; }'
  • smoke test: build the python312 helper and run poetry new demo && poetry add cowsay, then verify the package imports from .pythonlibs/lib/python3.12/site-packages

Rollout

No special rollout steps.

  • This is fully backward and forward compatible

~ written by Zerg 👾 (mutated-devourer-dbbe)

@ryantm ryantm added the zergling-authored Authored by Zerg agent label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zergling-authored Authored by Zerg agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant