Reproducible python environment with Nix flake and Direnv

This page summarizes the projects mentioned and recommended in the original post on /r/Python

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • nixpkgs

    Nix Packages collection & NixOS

  • Turning python environment into Nix is actually quite hard. A lot of python packages are missing from Nixpkgs so a pure Nix solution is practically a no-go.

  • mach-nix

    Create highly reproducible python environments

  • { description = "Flake to manage python workspace"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/master"; flake-utils.url = "github:numtide/flake-utils"; mach-nix.url = "github:DavHau/mach-nix?ref=3.3.0"; }; outputs = { self, nixpkgs, flake-utils, mach-nix }: flake-utils.lib.eachDefaultSystem (system: let python = "python39"; # <--- change here pkgs = nixpkgs.legacyPackages.${system}; # https://github.com/DavHau/mach-nix/issues/153#issuecomment-717690154 mach-nix-wrapper = import mach-nix { inherit pkgs python; }; requirements = builtins.readFile ./requirements.txt; pythonBuild = mach-nix-wrapper.mkPython { inherit requirements; }; in { devShell = pkgs.mkShell { buildInputs = [ # dev packages (pkgs.${python}.withPackages (ps: with ps; [ pip black pyflakes isort ])) # <--- change here pkgs.nodePackages.pyright pkgs.glpk # app packages pythonBuild ]; }; }); }

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts