Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions pkgs/development/python-modules/bootstrapped-pip/default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{ lib, stdenv, python, makeWrapper, unzip
, pipInstallHook
, setuptoolsBuildHook
, wheel, pip, setuptools
, wheel, pip, setuptools, flit
}:

stdenv.mkDerivation rec {
pname = "pip";
inherit (pip) version;
name = "${python.libPrefix}-bootstrapped-${pname}-${version}";

srcs = [ wheel.src pip.src setuptools.src ];
srcs = [ wheel.src pip.src setuptools.src flit.src ];
sourceRoot = ".";

dontUseSetuptoolsBuild = true;
Expand Down Expand Up @@ -38,18 +38,19 @@ stdenv.mkDerivation rec {
mv pip* pip
mv setuptools* setuptools
mv wheel* wheel
mv flit* flit
# Set up PYTHONPATH. The above folders need to be on PYTHONPATH
# $out is where we are installing to and takes precedence
export PYTHONPATH="$out/${python.sitePackages}:$(pwd)/pip/src:$(pwd)/setuptools:$(pwd)/setuptools/pkg_resources:$(pwd)/wheel:$PYTHONPATH"
export PYTHONPATH="$out/${python.sitePackages}:$(pwd)/pip/src:$(pwd)/setuptools:$(pwd)/setuptools/pkg_resources:$(pwd)/wheel:$(pwd)/flit/flit_core:$PYTHONPATH"

echo "Building setuptools wheel..."
pushd setuptools
rm pyproject.toml
echo "Building wheel wheel..."
pushd wheel
${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
popd

echo "Building wheel wheel..."
pushd wheel
echo "Building setuptools wheel..."
pushd setuptools
rm pyproject.toml
${python.pythonForBuild.interpreter} -m pip install --no-build-isolation --no-index --prefix=$out --ignore-installed --no-dependencies --no-cache .
popd

Expand All @@ -64,5 +65,6 @@ stdenv.mkDerivation rec {
description = "Version of pip used for bootstrapping";
license = lib.unique (pip.meta.license ++ setuptools.meta.license ++ wheel.meta.license);
homepage = pip.meta.homepage;
maintainers = lib.teams.python.members;
};
}
10 changes: 10 additions & 0 deletions pkgs/development/python-modules/click/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
, buildPythonPackage
, pythonOlder
, fetchPypi
, fetchpatch
, importlib-metadata
, pytestCheckHook

Expand All @@ -23,6 +24,15 @@ buildPythonPackage rec {
hash = "sha256-doLcivswKXABZ0V16gDRgU2AjWo2r0Fagr1IHTe6e44=";
};

patches = [
(fetchpatch {
# pytest 7.3.0 compat
name = "click-pytest-7.3.0-compat.patch";
url = "https://github.com/pallets/click/commit/0f5fbb7e4d893945b4c07cfe4f81cd82fb2900ed.patch";
hash = "sha256-Xgkrn81K9Qzz1T3lfGHCm6rIl/omG+DhmCa6jj7cauw=";
})
];

propagatedBuildInputs = lib.optionals (pythonOlder "3.8") [
importlib-metadata
];
Expand Down
27 changes: 24 additions & 3 deletions pkgs/development/python-modules/flit-core/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
, buildPythonPackage
, callPackage
, flit
, python
}:

buildPythonPackage rec {
# This package uses a bootstrapping process, to escape cyclic
# dependency chains. See
# https://flit.pypa.io/en/latest/bootstrap.html

buildPythonPackage {
pname = "flit-core";
inherit (flit) version;
format = "pyproject";
format = "other";

outputs = [
"out"
Expand All @@ -20,11 +25,27 @@ buildPythonPackage rec {
cd flit_core
'';

buildPhase = ''
runHook preBuild
${python.interpreter} -m flit_core.wheel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need forBuild here?

Suggested change
${python.interpreter} -m flit_core.wheel
${python.pythonForBuild.interpreter} -m flit_core.wheel

runHook postBuild
'';

installPhase = ''
runHook preInstall
${python.interpreter} bootstrap_install.py --installdir $out/${python.sitePackages} dist/*.whl
runHook postInstall
'';

postInstall = ''
mkdir $testsout
cp -R ../tests $testsout/tests
mv ../tests $testsout/tests
'';

pythonImportsCheck = [
"flit_core"
];

# check in passthru.tests.pytest to escape infinite recursion with setuptools-scm
doCheck = false;

Expand Down
1 change: 1 addition & 0 deletions pkgs/development/python-modules/flit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ buildPythonPackage rec {
repo = "flit";
rev = version;
hash = "sha256-iXf9K/xI4u+dDV0Zf6S08nbws4NqycrTEW0B8/qCjQc=";
name = "${pname}-${version}-source";
Comment on lines 27 to +28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried it locally and that does not change the hash which is really surprising to me because I always thought it did. Only the store path changed.

};

nativeBuildInputs = [
Expand Down
44 changes: 36 additions & 8 deletions pkgs/development/python-modules/installer/default.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,64 @@
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, pytestCheckHook

# bootstrap
, flit-core
, python

# tests
, installer
, mock
, pytestCheckHook
}:

buildPythonPackage rec {
pname = "installer";
version = "0.7.0";
format = "pyproject";
format = "other";

src = fetchFromGitHub {
owner = "pradyunsg";
repo = pname;
rev = version;
repo = "installer";
rev = "refs/tags/${version}";
hash = "sha256-thHghU+1Alpay5r9Dc3v7ATRFfYKV8l9qR0nbGOOX/A=";
};

nativeBuildInputs = [ flit-core ];
nativeBuildInputs = [
flit-core
];

dontBuild = true;

installPhase = ''
runHook preInstall
ls -lah
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ls -lah

mkdir -p $out/${python.sitePackages}
cp -a src/installer* $out/${python.sitePackages}
${python.interpreter} -m compileall $out/${python.sitePackages}
runHook postInstall
'';

pythonImportsCheck = [
"installer"
];

doCheck = false;

nativeCheckInputs = [
pytestCheckHook
mock
pytestCheckHook
];

passthru.tests = {
pytest = installer.overridePythonAttrs (oldAttrs: { doCheck = true; });
};

meta = with lib; {
changelog = "https://github.com/pypa/installer/blob/${src.rev}/docs/changelog.md";
homepage = "https://github.com/pradyunsg/installer";
description = "A low-level library for installing a Python package from a wheel distribution";
license = licenses.mit;
maintainers = with maintainers; [ cpcloud fridh ];
maintainers = teams.python.members;
};
}
5 changes: 3 additions & 2 deletions pkgs/development/python-modules/pip/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

buildPythonPackage rec {
pname = "pip";
version = "23.0.1";
version = "23.1.2";
format = "other";

src = fetchFromGitHub {
owner = "pypa";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-BSonlwKmegrlrQTTIL0avPi61/TY2M0f7kOZpSzPRQk=";
hash = "sha256-bnvpSV6KSY+c3w7FSgTTgBXjBp2/RYbpCBC8DvzYPwY=";
name = "${pname}-${version}-source";
};

Expand Down Expand Up @@ -49,5 +49,6 @@ buildPythonPackage rec {
homepage = "https://pip.pypa.io/";
changelog = "https://pip.pypa.io/en/stable/news/#v${lib.replaceStrings [ "." ] [ "-" ] version}";
priority = 10;
maintainers = lib.teams.python.members;
};
}
27 changes: 24 additions & 3 deletions pkgs/development/python-modules/pyproject-hooks/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{ lib
, buildPythonPackage
, fetchPypi

# build
, flit-core
, installer
, python

# tests
, pytestCheckHook
, pythonOlder
, setuptools
Expand All @@ -12,25 +18,40 @@
buildPythonPackage rec {
pname = "pyproject-hooks";
version = "1.0.0";
format = "pyproject";
format = "other";

disabled = pythonOlder "3.7";

src = fetchPypi rec {
src = fetchPypi {
pname = "pyproject_hooks";
inherit version;
hash = "sha256-8nGymLl/WVXVP7ErcsH7GUjCLBprcLMVxUztrKAmTvU=";
};

nativeBuildInputs = [
flit-core
installer
];

propagatedBuildInputs = [
] ++ lib.optionals (pythonOlder "3.11") [
Comment on lines 36 to 37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
propagatedBuildInputs = [
] ++ lib.optionals (pythonOlder "3.11") [
propagatedBuildInputs = lib.optionals (pythonOlder "3.11") [

nit

tomli
];

buildPhase = ''
runHook preBuild
${python.interpreter} -m flit_core.wheel
runHook postBuild
'';

installPhase = ''
runHook preInstall
${python.interpreter} -m installer --prefix "$out" dist/*.whl
runHook postInstall
'';

doCheck = false;

nativeCheckInputs = [
pytestCheckHook
setuptools
Expand All @@ -52,6 +73,6 @@ buildPythonPackage rec {
homepage = "https://github.com/pypa/pyproject-hooks";
changelog = "https://github.com/pypa/pyproject-hooks/blob/v${version}/docs/changelog.rst";
license = licenses.mit;
maintainers = with maintainers; [ hexa ];
maintainers = teams.python.members;
};
}
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/pytest/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

buildPythonPackage rec {
pname = "pytest";
version = "7.2.1";
version = "7.3.1";
format = "pyproject";

src = fetchPypi {
inherit pname version;
hash = "sha256-1F4JUvNyckGRi4/Q83b1/2swHMB3fG+aVWk1yS2KfUI=";
hash = "sha256-Q0r6/Xix147Qrd8WCtK3ejDTXUvfivI0/mIZGdntFeM=";
};

outputs = [
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/setuptools/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

let
pname = "setuptools";
version = "67.4.0";
version = "67.7.2";

# Create an sdist of setuptools
sdist = stdenv.mkDerivation rec {
Expand All @@ -20,7 +20,7 @@ let
owner = "pypa";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-QDHycUFA2VRUE9alan8rF0efZTNV3Jt0CskjkCc+in0=";
hash = "sha256-O67HK7hFp4WCqZh15xRtieEcfAcyeZhBqgI8WnZyuzs=";
name = "${pname}-${version}-source";
};

Expand Down
42 changes: 33 additions & 9 deletions pkgs/development/python-modules/tomli/default.nix
Original file line number Diff line number Diff line change
@@ -1,34 +1,58 @@
{ lib
, buildPythonPackage
, callPackage
, fetchFromGitHub

# bootstrap
, flit-core
, installer
, python

# tests
, unittestCheckHook

# important downstream dependencies
, flit
# important downstream dependencies
, black
, flit
, mypy
, setuptools-scm
}:

buildPythonPackage rec {
pname = "tomli";
version = "2.0.1";
format = "pyproject";
format = "other";

src = fetchFromGitHub {
owner = "hukkin";
repo = pname;
rev = version;
repo = "tomli";
rev = "refs/tags/${version}";
hash = "sha256-v0ZMrHIIaGeORwD4JiBeLthmnKZODK5odZVL0SY4etA=";
};

nativeBuildInputs = [ flit-core ];
nativeBuildInputs = [
flit-core
installer
];

buildPhase = ''
runHook preBuild
${python.interpreter} -m flit_core.wheel
runHook postBuild
'';

installPhase = ''
runHook preInstall
${python.interpreter} -m installer --prefix "$out" dist/*.whl
runHook postInstall
'';

nativeCheckInputs = [ unittestCheckHook ];
pythonImportsCheck = [
"tomli"
];

pythonImportsCheck = [ "tomli" ];
nativeCheckInputs = [
unittestCheckHook
];

passthru.tests = {
# test downstream dependencies
Expand Down
Loading