Skip to content

Commit

Permalink
python3Packages.psycopg2-binary: init at 2.9.9
Browse files Browse the repository at this point in the history
Pscycopg2-binary is normally used in Python development to avoid having to build psycopg2 from source.
In nixpkgs we always want ot build from source whenever possible, but it can still be useful to provide a psycopg2-binary package.

This "fake" package exists to satisfy a dependency on psycopg2-binary, but still use the build from psycopg2.

cc @misuzu nix-community/pyproject.nix#143
  • Loading branch information
adisbladis committed Aug 27, 2024
1 parent e2f166c commit 8635489
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
37 changes: 37 additions & 0 deletions pkgs/development/python-modules/psycopg2-binary/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{ buildPythonPackage, psycopg2, hatchling }:

# Pscycopg2-binary is normally used in Python development to avoid having to build psycopg2 from source.
# In nixpkgs we always want ot build from source whenever possible, but it can still be useful to provide a psycopg2-binary package.
#
# This "fake" package exists to satisfy a dependency on psycopg2-binary, but still use the build from psycopg2.

buildPythonPackage {
pname = "pscycopg2-binary";
inherit (psycopg2) version;

pyproject = true;

dependencies = [ psycopg2 ];
optional-dependencies = psycopg2.optional-dependencies or { };

# Make a minimal pyproject.toml that can be built
unpackPhase = ''
cat > pyproject.toml << EOF
[project]
name = "psycopg2-binary"
version = "${psycopg2.version}"
dependencies = [ "psycopg2" ]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
EOF
mkdir psycopg2_binary
touch psycopg2_binary/__init__.py
'';

build-system = [ hatchling ];

inherit (psycopg2) meta;
}
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10944,6 +10944,8 @@ self: super: with self; {

psycopg2cffi = callPackage ../development/python-modules/psycopg2cffi { };

psycopg2-binary = callPackage ../development/python-modules/psycopg2-binary { };

psygnal = callPackage ../development/python-modules/psygnal { };

ptable = callPackage ../development/python-modules/ptable { };
Expand Down

0 comments on commit 8635489

Please sign in to comment.