Merge pull request #332685 from NixOS/python-updates

[python-updates] Various updates, setuptools stabilization
This commit is contained in:
Martin Weinelt
2024-08-06 19:13:59 +02:00
committed by GitHub
58 changed files with 797 additions and 409 deletions
@@ -475,7 +475,6 @@ are used in [`buildPythonPackage`](#buildpythonpackage-function).
See [example usage](#using-pythonrelaxdepshook).
- `pythonRemoveBinBytecode` to remove bytecode from the `/bin` folder.
- `setuptoolsBuildHook` to build a wheel using `setuptools`.
- `setuptoolsCheckHook` to run tests with `python setup.py test`.
- `sphinxHook` to build documentation and manpages using Sphinx.
- `venvShellHook` to source a Python 3 `venv` at the `venvDir` location. A
`venv` is created if it does not yet exist. `postVenvCreation` can be used to
+6 -3
View File
@@ -21,6 +21,7 @@ let
in python3.pkgs.buildPythonApplication rec {
pname = "whipper";
version = "0.10.0";
pyproject = true;
src = fetchFromGitHub {
owner = "whipper-team";
@@ -38,14 +39,15 @@ in python3.pkgs.buildPythonApplication rec {
})
];
nativeBuildInputs = with python3.pkgs; [
nativeBuildInputs = [
installShellFiles
wrapGAppsNoGuiHook
gobject-introspection
];
setuptools-scm
build-system = with python3.pkgs; [
docutils
setuptoolsCheckHook
setuptools-scm
];
propagatedBuildInputs = with python3.pkgs; [
@@ -63,6 +65,7 @@ in python3.pkgs.buildPythonApplication rec {
nativeCheckInputs = with python3.pkgs; [
twisted
pytestCheckHook
] ++ bins;
makeWrapperArgs = [
+5
View File
@@ -138,6 +138,11 @@ python3.pkgs.buildPythonApplication {
disabledTests = [
"test_loop" # test tries to bind 127.0.0.1 causing permission error
"test_is_ip_address" # fails spuriously https://github.com/spesmilo/electrum/issues/7307
# electrum_ltc.lnutil.RemoteMisbehaving: received commitment_signed without pending changes
"test_reestablish_replay_messages_rev_then_sig"
"test_reestablish_replay_messages_sig_then_rev"
# stuck on hydra
"test_reestablish_with_old_state"
];
postCheck = ''
@@ -200,14 +200,7 @@ in {
};
} ./setuptools-build-hook.sh) {};
setuptoolsCheckHook = callPackage ({ makePythonHook, setuptools }:
makePythonHook {
name = "setuptools-check-hook";
propagatedBuildInputs = [ setuptools ];
substitutions = {
inherit pythonCheckInterpreter setuppy;
};
} ./setuptools-check-hook.sh) {};
setuptoolsCheckHook = throw "The setuptoolsCheckHook has been removed, since the test command has been removed in setuptools 72.0";
setuptoolsRustBuildHook = callPackage ({ makePythonHook, setuptools-rust }:
makePythonHook {
@@ -59,16 +59,4 @@ function pytestCheckPhase() {
if [ -z "${dontUsePytestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
echo "Using pytestCheckPhase"
preDistPhases+=" pytestCheckPhase"
# It's almost always the case that setuptoolsCheckPhase should not be ran
# when the pytestCheckHook is being ran
if [ -z "${useSetuptoolsCheck-}" ]; then
dontUseSetuptoolsCheck=1
# Remove command if already injected into preDistPhases
if [[ "$preDistPhases" =~ "setuptoolsCheckPhase" ]]; then
echo "Removing setuptoolsCheckPhase"
preDistPhases=${preDistPhases/setuptoolsCheckPhase/}
fi
fi
fi
@@ -1,18 +0,0 @@
# Setup hook for setuptools.
echo "Sourcing setuptools-check-hook"
setuptoolsCheckPhase() {
echo "Executing setuptoolsCheckPhase"
runHook preCheck
cp -f @setuppy@ nix_run_setup
@pythonCheckInterpreter@ nix_run_setup test
runHook postCheck
echo "Finished executing setuptoolsCheckPhase"
}
if [ -z "${dontUseSetuptoolsCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
echo "Using setuptoolsCheckPhase"
preDistPhases+=" setuptoolsCheckPhase"
fi
@@ -14,16 +14,4 @@ unittestCheckPhase() {
if [ -z "${dontUseUnittestCheck-}" ] && [ -z "${installCheckPhase-}" ]; then
echo "Using unittestCheckPhase"
preDistPhases+=" unittestCheckPhase"
# It's almost always the case that setuptoolsCheckPhase should not be ran
# when the unittestCheckHook is being ran
if [ -z "${useSetuptoolsCheck-}" ]; then
dontUseSetuptoolsCheck=1
# Remove command if already injected into preDistPhases
if [[ "$preDistPhases" =~ "setuptoolsCheckPhase" ]]; then
echo "Removing setuptoolsCheckPhase"
preDistPhases=${preDistPhases/setuptoolsCheckPhase/}
fi
fi
fi
@@ -22,7 +22,6 @@
, pythonRemoveTestsDirHook
, pythonRuntimeDepsCheckHook
, setuptoolsBuildHook
, setuptoolsCheckHook
, wheelUnpackHook
, eggUnpackHook
, eggBuildHook
@@ -313,13 +312,7 @@ let
# Python packages don't have a checkPhase, only an installCheckPhase
doCheck = false;
doInstallCheck = attrs.doCheck or true;
nativeInstallCheckInputs = [
] ++ optionals (format' == "setuptools") [
# Longer-term we should get rid of this and require
# users of this function to set the `installCheckPhase` or
# pass in a hook that sets it.
setuptoolsCheckHook
] ++ nativeCheckInputs;
nativeInstallCheckInputs = nativeCheckInputs;
installCheckInputs = checkInputs;
postFixup = optionalString (!dontWrapPythonPrograms) ''
@@ -19,7 +19,6 @@
, pythonRemoveBinBytecodeHook
, pythonRemoveTestsDirHook
, setuptoolsBuildHook
, setuptoolsCheckHook
, wheelUnpackHook
, eggUnpackHook
, eggBuildHook
@@ -210,13 +209,7 @@ let
# Python packages don't have a checkPhase, only an installCheckPhase
doCheck = false;
doInstallCheck = attrs.doCheck or true;
nativeInstallCheckInputs = [
] ++ lib.optionals (format == "setuptools") [
# Longer-term we should get rid of this and require
# users of this function to set the `installCheckPhase` or
# pass in a hook that sets it.
setuptoolsCheckHook
] ++ nativeCheckInputs;
nativeInstallCheckInputs = nativeCheckInputs;
installCheckInputs = checkInputs;
postFixup = lib.optionalString (!dontWrapPythonPrograms) ''
@@ -60,11 +60,6 @@ buildPythonPackage rec {
pythonImportsCheck = [ "aiohappyeyeballs" ];
disabledTestPaths = [
# https://github.com/bdraco/aiohappyeyeballs/issues/30
"tests/test_impl.py"
];
meta = with lib; {
description = "Happy Eyeballs for pre-resolved hosts";
homepage = "https://github.com/bdraco/aiohappyeyeballs";
@@ -11,7 +11,7 @@
buildPythonPackage rec {
pname = "aiohttp-fast-url-dispatcher";
version = "0.3.0";
version = "0.3.1";
pyproject = true;
disabled = pythonOlder "3.8";
@@ -20,7 +20,7 @@ buildPythonPackage rec {
owner = "bdraco";
repo = "aiohttp-fast-url-dispatcher";
rev = "refs/tags/v${version}";
hash = "sha256-DZTW9CazcUY3hyxr0MbVfM/yJzUzwN43c2n07Sloxa8=";
hash = "sha256-RBS17LhbaAOxFYGjmoEyrq2DCEHeZNpkITPDdCd7Jk0=";
};
postPatch = ''
@@ -30,6 +30,8 @@ buildPythonPackage rec {
nativeBuildInputs = [ poetry-core ];
pythonRelaxDeps = [ "aiohttp" ];
propagatedBuildInputs = [ aiohttp ];
nativeCheckInputs = [
@@ -42,7 +44,7 @@ buildPythonPackage rec {
meta = with lib; {
description = "Faster URL dispatcher for aiohttp";
homepage = "https://github.com/bdraco/aiohttp-fast-url-dispatcher";
changelog = "https://github.com/bdraco/aiohttp-fast-url-dispatcher/blob/${version}/CHANGELOG.md";
changelog = "https://github.com/bdraco/aiohttp-fast-url-dispatcher/blob/${src.rev}/CHANGELOG.md";
license = licenses.asl20;
maintainers = with maintainers; [ fab ];
};
@@ -11,14 +11,14 @@
buildPythonPackage rec {
pname = "aiohttp-fast-zlib";
version = "0.1.0";
version = "0.1.1";
pyproject = true;
src = fetchFromGitHub {
owner = "bdraco";
repo = "aiohttp-fast-zlib";
rev = "v${version}";
hash = "sha256-nR/0hVe5zAhLXu+kBOBH+whIjUV44c5yuNOj+Zl+eFo=";
hash = "sha256-uPmttfEiWmEtQrBZYwiSjLTMmXhZ0MmaAQJMXTSQj+U=";
};
postPatch = ''
@@ -11,6 +11,7 @@
cython,
setuptools,
# install_requires
aiohappyeyeballs,
attrs,
multidict,
async-timeout,
@@ -22,6 +23,7 @@
# tests_require
freezegun,
gunicorn,
proxy-py,
pytest-mock,
pytest7CheckHook,
python-on-whales,
@@ -31,7 +33,7 @@
buildPythonPackage rec {
pname = "aiohttp";
version = "3.9.5";
version = "3.10.0";
pyproject = true;
disabled = pythonOlder "3.8";
@@ -40,7 +42,7 @@ buildPythonPackage rec {
owner = "aio-libs";
repo = "aiohttp";
rev = "refs/tags/v${version}";
hash = "sha256-FRtirmwgU8v+ee3db7rOFsmy0rNW8A7+yRZC5d6uYNA=";
hash = "sha256-8B5WyG3XUAxjoY08PTbkNM11K/ytlvdplhf2VV+I+JU=";
};
patches = [
@@ -69,6 +71,7 @@ buildPythonPackage rec {
'';
dependencies = [
aiohappyeyeballs
attrs
multidict
async-timeout
@@ -85,20 +88,16 @@ buildPythonPackage rec {
'';
# NOTE: pytest-xdist cannot be added because it is flaky. See https://github.com/NixOS/nixpkgs/issues/230597 for more info.
nativeCheckInputs =
[
freezegun
gunicorn
pytest-mock
pytest7CheckHook
python-on-whales
re-assert
]
++ lib.optionals (!(stdenv.isDarwin && stdenv.isAarch64)) [
# Optional test dependency. Depends indirectly on pyopenssl, which is
# broken on aarch64-darwin.
trustme
];
nativeCheckInputs = [
freezegun
gunicorn
proxy-py
pytest-mock
pytest7CheckHook
python-on-whales
re-assert
trustme
];
disabledTests =
[
@@ -115,17 +114,15 @@ buildPythonPackage rec {
"test_close"
];
disabledTestPaths = [
"tests/test_proxy_functional.py" # FIXME package proxy.py
];
__darwinAllowLocalNetworking = true;
# aiohttp in current folder shadows installed version
preCheck =
''
# aiohttp in current folder shadows installed version
rm -r aiohttp
touch tests/data.unknown_mime_type # has to be modified after 1 Jan 1990
export HOME=$(mktemp -d)
''
+ lib.optionalString stdenv.isDarwin ''
# Work around "OSError: AF_UNIX path too long"
@@ -6,7 +6,6 @@
pythonOlder,
# build-system
setuptools,
setuptools-scm,
# dependencies
@@ -33,24 +32,21 @@
buildPythonPackage rec {
pname = "anyio";
version = "4.3.0";
version = "4.4.0";
pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "agronholm";
repo = pname;
repo = "anyio";
rev = "refs/tags/${version}";
hash = "sha256-y58DQiTD0ZKaBNf0cA3MFE+7F68Svrl+Idz6BZY7HWQ=";
hash = "sha256-Sz/wWOT59T7LOAq68fBujgkTaY9ydMsIoSxeP3fBaoY=";
};
nativeBuildInputs = [
setuptools
setuptools-scm
];
build-system = [ setuptools-scm ];
propagatedBuildInputs =
dependencies =
[
idna
sniffio
@@ -64,9 +60,6 @@ buildPythonPackage rec {
trio = [ trio ];
};
# trustme uses pyopenssl
doCheck = !(stdenv.isDarwin && stdenv.isAarch64);
nativeCheckInputs = [
exceptiongroup
hypothesis
@@ -85,7 +78,7 @@ buildPythonPackage rec {
"'not network'"
];
disabledTests = lib.optionals (stdenv.isx86_64 && stdenv.isDarwin) [
disabledTests = lib.optionals stdenv.isDarwin [
# PermissionError: [Errno 1] Operation not permitted: '/dev/console'
"test_is_block_device"
];
@@ -2,8 +2,8 @@
lib,
buildPythonPackage,
fetchFromGitHub,
python,
pythonOlder,
pytestCheckHook,
setuptools,
sqlite,
}:
@@ -26,12 +26,19 @@ buildPythonPackage rec {
buildInputs = [ sqlite ];
# Project uses custom test setup to exclude some tests by default, so using pytest
# requires more maintenance
# https://github.com/rogerbinns/apsw/issues/335
checkPhase = ''
${python.interpreter} setup.py test
'';
nativeCheckInputs = [ pytestCheckHook ];
pytestFlagsArray = [ "apsw/tests.py" ];
disabledTests = [
# we don't build the test extension
"testLoadExtension"
"testShell"
"testVFS"
"testVFSWithWAL"
# no lines in errout.txt
"testWriteUnraisable"
];
pythonImportsCheck = [ "apsw" ];
@@ -23,7 +23,7 @@
buildPythonPackage rec {
pname = "async-upnp-client";
version = "0.39.0";
version = "0.40.0";
pyproject = true;
disabled = pythonOlder "3.8";
@@ -32,7 +32,7 @@ buildPythonPackage rec {
owner = "StevenLooman";
repo = "async_upnp_client";
rev = "refs/tags/${version}";
hash = "sha256-2A46/j6DkZ7rz/B64aBAp0NvRG5TBuL4VwMVS50+fQs=";
hash = "sha256-KaX1TNP6IP2wAijR2y9cqI+Pyc+Ygk3LqKwu5Yrv5LM=";
};
pythonRelaxDeps = [ "defusedxml" ];
@@ -1,47 +1,38 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitLab,
pytestCheckHook,
pythonOlder,
hatchling,
sybil,
typing-extensions,
}:
buildPythonPackage rec {
pname = "atpublic";
version = "4.1.0";
format = "pyproject";
version = "5.0";
pyproject = true;
disabled = pythonOlder "3.6";
disabled = pythonOlder "3.8";
src = fetchPypi {
inherit pname version;
hash = "sha256-0cjNkxr3Rh9tGLxgYzg+hlTZ6e8Z1Y7m3AHoUVu/Vd8=";
src = fetchFromGitLab {
owner = "warsaw";
repo = "public";
rev = "refs/tags/${version}";
hash = "sha256-cqum+4hREu0jO9iFoUUzfzn597BoMAhG+aanwnh8hb8=";
};
nativeBuildInputs = [ hatchling ];
propagatedBuildInputs = lib.optionals (pythonOlder "3.8") [ typing-extensions ];
build-system = [ hatchling ];
nativeCheckInputs = [
pytestCheckHook
sybil
];
pytestFlagsArray = [
# TypeError: FixtureManager.getfixtureclosure() missing 1 required positional argument: 'ignore_args'
"--ignore=docs/using.rst"
];
postPatch = ''
sed -i '/cov=public/d' pyproject.toml
'';
pythonImportsCheck = [ "public" ];
meta = with lib; {
changelog = "https://gitlab.com/warsaw/public/-/blob/${version}/docs/NEWS.rst";
description = "Python decorator and function which populates a module's __all__ and globals";
homepage = "https://public.readthedocs.io/";
longDescription = ''
@@ -17,24 +17,25 @@
buildPythonPackage rec {
pname = "av";
version = "12.2.0";
version = "12.3.0";
pyproject = true;
disabled = pythonOlder "3.7";
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "mikeboers";
owner = "PyAV-Org";
repo = "PyAV";
rev = "refs/tags/v${version}";
hash = "sha256-yPVAtL71pL/ok3bli+r/IruCrmmhNyv98pr7z3m8sbo=";
hash = "sha256-ezeYv55UzNnnYDjrMz5YS5g2pV6U/Fxx3e2bCoPP3eI=";
};
nativeBuildInputs = [
build-system = [
cython
pkg-config
setuptools
];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ ffmpeg_6-headless ];
preCheck =
@@ -95,7 +96,7 @@ buildPythonPackage rec {
meta = with lib; {
description = "Pythonic bindings for FFmpeg/Libav";
mainProgram = "pyav";
homepage = "https://github.com/mikeboers/PyAV/";
homepage = "https://github.com/PyAV-Org/PyAV";
changelog = "https://github.com/PyAV-Org/PyAV/blob/v${version}/CHANGELOG.rst";
license = licenses.bsd2;
maintainers = [ ];
@@ -18,7 +18,7 @@
let
pname = "chacha20poly1305-reuseable";
version = "0.12.2";
version = "0.13.2";
in
buildPythonPackage {
@@ -31,7 +31,7 @@ buildPythonPackage {
owner = "bdraco";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-RESSkMWkmlmYarLOI8pX5mwgcr8xAigbp1mrAQP/QNU=";
hash = "sha256-i6bhqfYo+gFTf3dqOBSQqGN4WPqbUR05StdwZvrVckI=";
};
nativeBuildInputs = [
@@ -46,7 +46,7 @@ buildPythonPackage {
preCheck = ''
substituteInPlace pyproject.toml \
--replace "--cov=chacha20poly1305_reuseable --cov-report=term-missing:skip-covered" ""
--replace-fail "--cov=chacha20poly1305_reuseable --cov-report=term-missing:skip-covered" ""
'';
nativeCheckInputs = [ pytestCheckHook ];
@@ -79,7 +79,12 @@ buildPythonPackage rec {
# takes 30-180 mins to run entire test suite, not worth the CPU resources, slows down reviews
# with pytest-xdist, it still takes around 10 mins with 32 cores
# just run the csv tests, as this should give some indictation of correctness
pytestFlagsArray = [ "tests/test_csv.py" ];
pytestFlagsArray = [
# datasette/app.py:14: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
"-W"
"ignore::DeprecationWarning"
"tests/test_csv.py"
];
disabledTests = [
"facet"
@@ -17,9 +17,9 @@
dirty-equals,
flask,
passlib,
pyjwt,
pytest-asyncio,
pytestCheckHook,
python-jose,
sqlalchemy,
trio,
@@ -39,7 +39,7 @@
buildPythonPackage rec {
pname = "fastapi";
version = "0.111.0";
version = "0.112.0";
pyproject = true;
disabled = pythonOlder "3.7";
@@ -48,7 +48,7 @@ buildPythonPackage rec {
owner = "tiangolo";
repo = "fastapi";
rev = "refs/tags/${version}";
hash = "sha256-DQYjK1dZuL7cF6quyNkgdd/GYmWm7k6YlF7YEjObQlI=";
hash = "sha256-M09yte0BGC5w3AZSwDUr9qKUrotqVklO8mwyms9B95Y=";
};
build-system = [ pdm-backend ];
@@ -87,17 +87,23 @@ buildPythonPackage rec {
dirty-equals
flask
passlib
pyjwt
pytestCheckHook
pytest-asyncio
python-jose
trio
sqlalchemy
] ++ optional-dependencies.all ++ python-jose.optional-dependencies.cryptography;
] ++ optional-dependencies.all;
pytestFlagsArray = [
# ignoring deprecation warnings to avoid test failure from
# tests/test_tutorial/test_testing/test_tutorial001.py
"-W ignore::DeprecationWarning"
"-W ignore::pytest.PytestUnraisableExceptionWarning"
];
disabledTests = [
# Coverage test
"test_fastapi_cli"
];
disabledTestPaths = [
@@ -5,7 +5,6 @@
beziers,
glyphslib,
numpy,
setuptoolsCheckHook,
}:
buildPythonPackage rec {
@@ -25,12 +24,10 @@ buildPythonPackage rec {
];
# A unit test suite does exist, but it only contains a dummy test that
# doesn't test anything. It does import the module though so we still run it.
doCheck = true;
nativeCheckInputs = [
# Upstream apparently prefers the deprecated setuptools 'test' command.
setuptoolsCheckHook
];
# imports the library.
doCheck = false;
pythonImportsCheck = [ "glyphtools" ];
meta = with lib; {
description = "Python library for extracting information from font glyphs";
@@ -2,32 +2,32 @@
lib,
buildPythonPackage,
fetchPypi,
sure,
six,
setuptools,
# tests
freezegun,
mock,
pytestCheckHook,
sure,
}:
buildPythonPackage rec {
pname = "httpretty";
version = "1.1.4";
format = "setuptools";
# drop this for version > 0.9.7
# Flaky tests: https://github.com/gabrielfalcao/HTTPretty/pull/394
doCheck = lib.versionAtLeast version "0.9.8";
pyproject = true;
src = fetchPypi {
inherit pname version;
sha256 = "20de0e5dd5a18292d36d928cc3d6e52f8b2ac73daec40d41eb62dee154933b68";
};
propagatedBuildInputs = [ six ];
build-system = [ setuptools ];
nativeCheckInputs = [
sure
freezegun
mock
pytestCheckHook
sure
];
disabledTestPaths = [
@@ -23,7 +23,7 @@
buildPythonPackage rec {
pname = "hypothesis";
version = "6.103.0";
version = "6.108.5";
pyproject = true;
disabled = pythonOlder "3.7";
@@ -32,7 +32,7 @@ buildPythonPackage rec {
owner = "HypothesisWorks";
repo = "hypothesis";
rev = "hypothesis-python-${version}";
hash = "sha256-sll0GAI1nvBQvRqgpTkLpj7GQI988AftDQHV1zh2t1w=";
hash = "sha256-APZTI7AxbtLT+2mkxUapr1sPcq4ViMXy1J6g0I30s5A=";
};
# I tried to package sphinx-selective-exclude, but it throws
@@ -2,30 +2,29 @@
lib,
buildPythonPackage,
fetchPypi,
python,
pytest,
setuptools,
pytestCheckHook,
sortedcontainers,
}:
buildPythonPackage rec {
version = "3.1.0";
format = "setuptools";
pname = "intervaltree";
pyproject = true;
src = fetchPypi {
inherit pname version;
sha256 = "902b1b88936918f9b2a19e0e5eb7ccb430ae45cde4f39ea4b36932920d33952d";
};
buildInputs = [ pytest ];
build-system = [ setuptools ];
propagatedBuildInputs = [ sortedcontainers ];
dependencies = [ sortedcontainers ];
checkPhase = ''
runHook preCheck
rm build -rf
${python.interpreter} nix_run_setup test
runHook postCheck
nativeCheckInputs = [ pytestCheckHook ];
preCheck = ''
rm -rf build
'';
meta = with lib; {
@@ -2,12 +2,12 @@
lib,
fetchFromGitHub,
buildPythonPackage,
python,
pygobject3,
xvfb-run,
gobject-introspection,
gtk3,
pythonOlder,
pytest,
}:
buildPythonPackage rec {
@@ -26,6 +26,7 @@ buildPythonPackage rec {
nativeCheckInputs = [
gobject-introspection # for setup hook
gtk3
pytest
];
buildInputs = [ gtk3 ];
@@ -34,8 +35,7 @@ buildPythonPackage rec {
checkPhase = ''
runHook preCheck
${xvfb-run}/bin/xvfb-run -s '-screen 0 800x600x24' \
${python.interpreter} nix_run_setup test
${xvfb-run}/bin/xvfb-run -s '-screen 0 800x600x24' pytest
runHook postCheck
'';
@@ -91,6 +91,7 @@ buildPythonPackage rec {
disabledTests = [
# tests that require network access (like DNS lookups)
"test_truesendall_with_dump_from_recording"
"test_aiohttp"
"test_asyncio_record_replay"
"test_gethostbyname"
# httpx read failure
@@ -44,14 +44,14 @@
buildPythonPackage rec {
pname = "moto";
version = "5.0.9";
version = "5.0.12";
pyproject = true;
disabled = pythonOlder "3.6";
src = fetchPypi {
inherit pname version;
hash = "sha256-63Hxy6AccP/x8WCGrLJNbZrrMoMNZG2JifmKKa6uJLo=";
hash = "sha256-EL1DS/2jKWOf6VKUcMTCeTgGTBOZhAJOamJRPlCv9Cc=";
};
build-system = [ setuptools ];
@@ -159,6 +159,9 @@ buildPythonPackage rec {
# https://github.com/getmoto/moto/issues/7786
"tests/test_dynamodb/test_dynamodb_import_table.py"
# Infinite recursion with pycognito
"tests/test_cognitoidp/test_cognitoidp.py"
];
meta = with lib; {
@@ -55,6 +55,12 @@ buildPythonPackage rec {
pytestCheckHook
] ++ markdown-it-py.optional-dependencies.linkify;
disabledTests = [
# sphinx 7.4 compat
"test_gettext"
"test_gettext_additional_targets"
];
pythonImportsCheck = [ "myst_parser" ];
pythonRelaxDeps = [ "docutils" ];
@@ -17,14 +17,14 @@
buildPythonPackage rec {
pname = "pdm-backend";
version = "2.3.1";
format = "pyproject";
version = "2.3.3";
pyproject = true;
src = fetchFromGitHub {
owner = "pdm-project";
repo = "pdm-backend";
rev = "refs/tags/${version}";
hash = "sha256-I1bAjryLDXzlstIHK4cD6/HPJBGGskRUVp7B2PDwXhc=";
hash = "sha256-gM8Sx6nMiq84e3sLJn35shF2jy6Ce1qPlERi2XpS89k=";
};
env.PDM_BUILD_SCM_VERSION = version;
@@ -35,7 +35,7 @@
import ./generic.nix (
rec {
pname = "pillow";
version = "10.3.0";
version = "10.4.0";
format = "pyproject";
disabled = pythonOlder "3.8";
@@ -43,7 +43,7 @@ import ./generic.nix (
src = fetchPypi {
pname = "pillow";
inherit version;
hash = "sha256-nSRV+/RMkUhAx5PomqgtDhdjoUJToAB0NxmuWUaBSy0=";
hash = "sha256-Fmwc1NJDCbMNYfefSpEUt7IxPXRQkSJ3hV/139fNSgY=";
};
passthru.tests = {
@@ -76,6 +76,7 @@ buildPythonPackage rec {
"web_server"
# Location is not writable
"test_gen_csr"
"test_gen_public_key"
# Tests run into a timeout
"integration"
];
@@ -1,12 +1,13 @@
diff --git a/psycopg/psycopg/pq/_pq_ctypes.py b/psycopg/psycopg/pq/_pq_ctypes.py
index cfc68672..02929ab6 100644
index f3a7b143..1bf935fb 100644
--- a/psycopg/psycopg/pq/_pq_ctypes.py
+++ b/psycopg/psycopg/pq/_pq_ctypes.py
@@ -11,14 +11,10 @@ from ctypes import Structure, CFUNCTYPE, POINTER
@@ -13,14 +13,11 @@ from ctypes import Structure, CFUNCTYPE, POINTER
from ctypes import c_char, c_char_p, c_int, c_size_t, c_ubyte, c_uint, c_void_p
from typing import List, Optional, Tuple
from typing import Any, NoReturn
-from .misc import find_libpq_full_path
-from .misc import find_libpq_full_path, version_pretty
+from .misc import version_pretty
from ..errors import NotSupportedError
-libname = find_libpq_full_path()
@@ -18,7 +19,7 @@ index cfc68672..02929ab6 100644
class FILE(Structure):
@@ -28,12 +24,7 @@ class FILE(Structure):
@@ -30,12 +27,7 @@ class FILE(Structure):
FILE_ptr = POINTER(FILE)
if sys.platform == "linux":
@@ -33,10 +34,10 @@ index cfc68672..02929ab6 100644
fdopen = libc.fdopen
fdopen.argtypes = (c_int, c_char_p)
diff --git a/tests/fix_pq.py b/tests/fix_pq.py
index 917dfc91..505f2d65 100644
index 1cff7e18..218d90a0 100644
--- a/tests/fix_pq.py
+++ b/tests/fix_pq.py
@@ -47,18 +47,7 @@ def pytest_runtest_setup(item):
@@ -49,18 +49,7 @@ def pytest_runtest_setup(item):
@pytest.fixture
def libpq():
"""Return a ctypes wrapper to access the libpq."""
@@ -35,13 +35,13 @@
let
pname = "psycopg";
version = "3.1.19";
version = "3.2.1";
src = fetchFromGitHub {
owner = "psycopg";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-Fvg67sGWSNwChZTO5QdLSOKrbGfxzQZJqCjI5Jidcqo=";
hash = "sha256-jQMIgfMyQpd9bD3F1IhPff39BrFaBD6U7Exryna+Acw=";
};
patches = [
@@ -23,6 +23,8 @@ buildPythonPackage rec {
--replace 'library_dirs=library_dirs' 'library_dirs=[dir.decode("utf-8") for dir in library_dirs]' \
--replace 'include_dirs=include_dirs' 'include_dirs=[dir.decode("utf-8") for dir in include_dirs]' \
--replace 'runtime_library_dirs=runtime_lib_dirs' 'runtime_library_dirs=[dir.decode("utf-8") for dir in runtime_lib_dirs]'
substituteInPlace test/test-cdtext.py \
--replace-fail assertEquals assertEqual
'';
preConfigure = ''
@@ -12,6 +12,7 @@
pygobject3,
gtk3,
libayatana-appindicator,
pytest,
}:
buildPythonPackage rec {
@@ -54,12 +55,17 @@ buildPythonPackage rec {
libayatana-appindicator
];
nativeCheckInputs = [ xvfb-run ];
nativeCheckInputs = [
pytest
xvfb-run
];
checkPhase = ''
rm tests/icon_tests.py # test needs user input
runHook preCheck
xvfb-run -s '-screen 0 800x600x24' python setup.py test
xvfb-run -s '-screen 0 800x600x24' pytest tests/menu_descriptor_tests.py
runHook postCheck
'';
meta = with lib; {
@@ -7,7 +7,7 @@
pytest,
}:
buildPythonPackage rec {
buildPythonPackage {
pname = "pytest-fixture-config";
version = "1.7.1-unstable-2022-10-03";
pyproject = true;
@@ -19,7 +19,11 @@ buildPythonPackage rec {
hash = "sha256-huN3RzwtfVf4iMJ96VRP/ldOxTUlUMF1wJIdbcGXHn4=";
};
sourceRoot = "${src.name}/pytest-fixture-config";
patches = [ ./setuptools-72.0-compat.patch ];
postPatch = ''
cd pytest-fixture-config
'';
nativeBuildInputs = [
setuptools
@@ -0,0 +1,396 @@
diff --git a/common_setup.py b/common_setup.py
index 002952b..11ca9c9 100644
--- a/common_setup.py
+++ b/common_setup.py
@@ -1,45 +1,5 @@
# Common setup.py code shared between all the projects in this repository
-import sys
import os
-import logging
-
-from setuptools.command.test import test as TestCommand
-from setuptools.command.egg_info import egg_info as EggInfoCommand
-
-
-class PyTest(TestCommand):
- pytest_args = []
- src_dir = None
-
- def initialize_options(self):
- TestCommand.initialize_options(self)
-
- def finalize_options(self):
- TestCommand.finalize_options(self)
- self.test_args = []
- self.test_suite = True
-
- def run_tests(self):
- global pytest_args
- logging.basicConfig(format='%(asctime)s %(levelname)s %(name)s %(message)s', level='DEBUG')
-
- # import here, cause outside the eggs aren't loaded
- import pytest
-
- self.pytest_args.extend(['--junitxml', 'junit.xml'])
- errno = pytest.main(self.pytest_args)
- sys.exit(errno)
-
-
-class EggInfo(EggInfoCommand):
- """ Customisation of the package metadata creation. Changes are:
- - Save the test requirements into an extra called 'tests'
- """
- def run(self):
- if self.distribution.extras_require is None:
- self.distribution.extras_require = {}
- self.distribution.extras_require['tests'] = self.distribution.tests_require
- EggInfoCommand.run(self)
def common_setup(src_dir):
@@ -57,13 +17,6 @@ def common_setup(src_dir):
long_description = open(readme_file).read()
changelog = open(changelog_file).read()
- # Gather trailing arguments for pytest, this can't be done using setuptools' api
- if 'test' in sys.argv:
- PyTest.pytest_args = sys.argv[sys.argv.index('test') + 1:]
- if PyTest.pytest_args:
- sys.argv = sys.argv[:-len(PyTest.pytest_args)]
- PyTest.src_dir = src_dir
-
return dict(
# Version is shared between all the projects in this repo
version=open(version_file).read().strip(),
@@ -71,6 +24,5 @@ def common_setup(src_dir):
url='https://github.com/manahl/pytest-plugins',
license='MIT license',
platforms=['unix', 'linux'],
- cmdclass={'test': PyTest, 'egg_info': EggInfo},
include_package_data=True
)
diff --git a/pytest-devpi-server/setup.py b/pytest-devpi-server/setup.py
index 8891130..22b460f 100644
--- a/pytest-devpi-server/setup.py
+++ b/pytest-devpi-server/setup.py
@@ -27,8 +27,6 @@ install_requires = ['pytest-server-fixtures',
'ruamel.yaml>=0.15;python_version > "3.4"',
]
-tests_require = []
-
entry_points = {
'pytest11': [
'devpi_server = _pytest_devpi_server',
@@ -44,7 +42,6 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
packages=find_packages(exclude='tests'),
entry_points=entry_points,
))
diff --git a/pytest-fixture-config/setup.py b/pytest-fixture-config/setup.py
index 164ad33..15a9e16 100644
--- a/pytest-fixture-config/setup.py
+++ b/pytest-fixture-config/setup.py
@@ -20,8 +20,9 @@ classifiers = [
install_requires = ['pytest']
-tests_require = ['six',
- ]
+extras_require = {
+ 'test': ["six"]
+}
if __name__ == '__main__':
kwargs = common_setup('pytest_fixture_config')
@@ -32,7 +33,7 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
+ extras_require=extras_require,
py_modules=['pytest_fixture_config'],
))
setup(**kwargs)
diff --git a/pytest-git/setup.py b/pytest-git/setup.py
index 8f4a1d3..9c4557a 100644
--- a/pytest-git/setup.py
+++ b/pytest-git/setup.py
@@ -27,9 +27,6 @@ install_requires = ['pytest',
'gitpython',
]
-tests_require = [
- ]
-
entry_points = {
'pytest11': [
'git_repo = pytest_git',
@@ -46,7 +43,6 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
py_modules=['pytest_git'],
entry_points=entry_points,
))
diff --git a/pytest-listener/setup.py b/pytest-listener/setup.py
index 3ce8897..dcde454 100644
--- a/pytest-listener/setup.py
+++ b/pytest-listener/setup.py
@@ -23,8 +23,6 @@ install_requires = ['six',
'pytest-server-fixtures'
]
-tests_require = []
-
entry_points = {
'pytest11': [
'listener = pytest_listener',
@@ -40,7 +38,6 @@ if __name__ == '__main__':
author_email='drtimcouper@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
packages=find_packages(exclude='tests'),
entry_points=entry_points,
))
diff --git a/pytest-profiling/setup.py b/pytest-profiling/setup.py
index 612899a..fa412da 100644
--- a/pytest-profiling/setup.py
+++ b/pytest-profiling/setup.py
@@ -22,9 +22,9 @@ install_requires = ['six',
'gprof2dot',
]
-tests_require = [
- 'pytest-virtualenv',
- ]
+extras_require = {
+ 'tests': ['pytest-virtualenv']
+}
entry_points = {
'pytest11': [
@@ -41,7 +41,7 @@ if __name__ == '__main__':
author_email='ed@catmur.co.uk',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
+ extras_require=extras_require,
py_modules=['pytest_profiling'],
entry_points=entry_points,
))
diff --git a/pytest-pyramid-server/setup.py b/pytest-pyramid-server/setup.py
index f6fbea0..a02587a 100644
--- a/pytest-pyramid-server/setup.py
+++ b/pytest-pyramid-server/setup.py
@@ -26,9 +26,9 @@ install_requires = ['pytest-server-fixtures',
'six',
]
-tests_require = [
- 'pyramid-debugtoolbar',
- ]
+extras_require = {
+ 'tests': ['pyramid-debugtoolbar']
+}
entry_points = {
'pytest11': [
@@ -48,7 +48,7 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
+ extras_require=extras_require,
py_modules=['pytest_pyramid_server', 'pyramid_server_test'],
entry_points=entry_points,
))
diff --git a/pytest-qt-app/setup.py b/pytest-qt-app/setup.py
index 27f367a..3170aaf 100644
--- a/pytest-qt-app/setup.py
+++ b/pytest-qt-app/setup.py
@@ -22,8 +22,9 @@ install_requires = ['pytest',
'pytest-shutil',
]
-tests_require = ['pytest-cov'
- ]
+extras_require = {
+ 'tests': ['pytest-cov']
+}
entry_points = {
'pytest11': [
@@ -40,7 +41,7 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
+ extras_require=extras_require,
py_modules=['pytest_qt_app'],
entry_points=entry_points,
))
diff --git a/pytest-server-fixtures/setup.py b/pytest-server-fixtures/setup.py
index 065c1c2..88af64c 100644
--- a/pytest-server-fixtures/setup.py
+++ b/pytest-server-fixtures/setup.py
@@ -36,13 +36,12 @@ extras_require = {
's3': ["boto3"],
'docker': ["docker"],
'kubernetes': ["kubernetes"],
+ 'tests': [
+ 'mock; python_version<"3.3"',
+ 'psutil',
+ ],
}
-tests_require = [
- 'mock; python_version<"3.3"',
- 'psutil',
- ]
-
entry_points = {
'pytest11': [
'httpd_server = pytest_server_fixtures.httpd',
@@ -66,7 +65,6 @@ if __name__ == '__main__':
classifiers=classifiers,
install_requires=install_requires,
extras_require=extras_require,
- tests_require=tests_require,
packages=find_packages(exclude='tests'),
entry_points=entry_points,
))
diff --git a/pytest-shutil/setup.py b/pytest-shutil/setup.py
index 43ed91e..e1d9e56 100644
--- a/pytest-shutil/setup.py
+++ b/pytest-shutil/setup.py
@@ -27,8 +27,10 @@ install_requires = ['six',
'termcolor'
]
-tests_require = ['pytest',
- ]
+
+extras_require = {
+ 'tests': ["pytest"],
+}
entry_points = {
'pytest11': [
@@ -45,7 +47,7 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
+ extras_require=extras_require,
packages=find_packages(exclude='tests'),
entry_points=entry_points,
))
diff --git a/pytest-svn/setup.py b/pytest-svn/setup.py
index 470181f..9d4d272 100644
--- a/pytest-svn/setup.py
+++ b/pytest-svn/setup.py
@@ -21,9 +21,6 @@ install_requires = ['pytest',
'pytest-shutil',
]
-tests_require = [
- ]
-
entry_points = {
'pytest11': [
'svn_repo = pytest_svn',
@@ -40,7 +37,6 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
py_modules=['pytest_svn'],
entry_points=entry_points,
))
diff --git a/pytest-verbose-parametrize/setup.py b/pytest-verbose-parametrize/setup.py
index ae0a482..b6fa5e1 100644
--- a/pytest-verbose-parametrize/setup.py
+++ b/pytest-verbose-parametrize/setup.py
@@ -21,10 +21,11 @@ install_requires = ['pytest',
'six',
]
-tests_require = ['mock; python_version<"3.3"',
- 'pytest-virtualenv',
- 'coverage',
- ]
+extras_require = {
+ 'tests': ['mock; python_version<"3.3"',
+ 'pytest-virtualenv',
+ 'coverage']
+}
entry_points = {
'pytest11': [
@@ -41,7 +42,7 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
+ extras_require=extras_require,
py_modules=['pytest_verbose_parametrize'],
entry_points=entry_points,
))
diff --git a/pytest-virtualenv/setup.py b/pytest-virtualenv/setup.py
index 815b59c..55f97e3 100644
--- a/pytest-virtualenv/setup.py
+++ b/pytest-virtualenv/setup.py
@@ -25,9 +25,9 @@ install_requires = ['pytest-fixture-config',
'importlib-metadata',
]
-tests_require = [
- 'mock; python_version<"3.3"'
- ]
+extras_require = {
+ 'tests': ['mock; python_version<"3.3"']
+}
entry_points = {
'pytest11': [
@@ -44,7 +44,7 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
+ extras_require=extras_require,
py_modules=['pytest_virtualenv'],
entry_points=entry_points,
))
diff --git a/pytest-webdriver/setup.py b/pytest-webdriver/setup.py
index 280818a..afb618b 100644
--- a/pytest-webdriver/setup.py
+++ b/pytest-webdriver/setup.py
@@ -23,8 +23,10 @@ install_requires = ['py',
'selenium',
]
-tests_require = ['mock; python_version<"3.3"',
- ]
+
+extras_require = {
+ 'tests': ['mock; python_version,"3.3"'],
+}
entry_points = {
'pytest11': [
@@ -41,7 +43,7 @@ if __name__ == '__main__':
author_email='eeaston@gmail.com',
classifiers=classifiers,
install_requires=install_requires,
- tests_require=tests_require,
+ extras_require=extras_require,
py_modules=['pytest_webdriver'],
entry_points=entry_points,
))
@@ -12,12 +12,14 @@
setuptools,
}:
buildPythonPackage rec {
buildPythonPackage {
pname = "pytest-server-fixtures";
inherit (pytest-fixture-config) version src;
inherit (pytest-fixture-config) version src patches;
pyproject = true;
sourceRoot = "${src.name}/pytest-server-fixtures";
postPatch = ''
cd pytest-server-fixtures
'';
build-system = [ setuptools ];
@@ -21,22 +21,23 @@
pytestCheckHook,
}:
buildPythonPackage rec {
buildPythonPackage {
pname = "pytest-shutil";
inherit (pytest-fixture-config) version src;
pyproject = true;
sourceRoot = "${src.name}/pytest-shutil";
# imp was removed in Python 3.12
patches = [
(fetchpatch {
name = "stop-using-imp.patch";
url = "https://build.opensuse.org/public/source/openSUSE:Factory/python-pytest-shutil/stop-using-imp.patch?rev=10";
hash = "sha256-L8tXoQ9q8o6aP3TpJY/sUVVbUd/ebw0h6de6dBj1WNY=";
stripLen = 1;
hash = "sha256-ZsfOic6VmKIlK+HeAlUwiM4fXgw9wHo445dP9j5/h8Q=";
})
];
] ++ pytest-fixture-config.patches;
postPatch = ''
cd pytest-shutil
'';
build-system = [
setuptools
@@ -12,12 +12,14 @@
virtualenv,
}:
buildPythonPackage rec {
buildPythonPackage {
pname = "pytest-virtualenv";
inherit (pytest-fixture-config) version src;
inherit (pytest-fixture-config) version src patches;
pyproject = true;
sourceRoot = "${src.name}/pytest-virtualenv";
postPatch = ''
cd pytest-virtualenv
'';
build-system = [ setuptools ];
@@ -1,72 +0,0 @@
From de47b73520fd9b7e41272701d7fd4663357af046 Mon Sep 17 00:00:00 2001
From: Ran Benita <ran@unusedvar.com>
Date: Fri, 7 Jun 2024 09:49:29 +0300
Subject: [PATCH] unittest: fix assertion errors on unittest reruns
This fixes unittest test reruns when using plugins like
pytest-rerunfailures.
The `instance` property uses AttributeError to check if the instance
needs to be initialized, so `del` is the correct way to clear it, not
setting to `None`.
Regressed in 8.2.2.
---
changelog/12424.bugfix.rst | 1 +
src/_pytest/unittest.py | 2 +-
.../pytest_rerunfailures_integration.py | 11 +++++++++++
tox.ini | 2 +-
4 files changed, 14 insertions(+), 2 deletions(-)
create mode 100644 changelog/12424.bugfix.rst
create mode 100644 testing/plugins_integration/pytest_rerunfailures_integration.py
diff --git a/changelog/12424.bugfix.rst b/changelog/12424.bugfix.rst
new file mode 100644
index 00000000000..7ad1126858b
--- /dev/null
+++ b/changelog/12424.bugfix.rst
@@ -0,0 +1 @@
+Fix crash with `assert testcase is not None` assertion failure when re-running unittest tests using plugins like pytest-rerunfailures. Regressed in 8.2.2.
diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py
index 643443f08c6..ca82ac5c14a 100644
--- a/src/_pytest/unittest.py
+++ b/src/_pytest/unittest.py
@@ -222,7 +222,7 @@ def teardown(self) -> None:
self._explicit_tearDown()
self._explicit_tearDown = None
self._obj = None
- self._instance = None
+ del self._instance
super().teardown()
def startTest(self, testcase: "unittest.TestCase") -> None:
diff --git a/testing/plugins_integration/pytest_rerunfailures_integration.py b/testing/plugins_integration/pytest_rerunfailures_integration.py
new file mode 100644
index 00000000000..9a13a3279a9
--- /dev/null
+++ b/testing/plugins_integration/pytest_rerunfailures_integration.py
@@ -0,0 +1,11 @@
+import unittest
+
+
+class MyTestCase(unittest.TestCase):
+ first_time = True
+
+ def test_fail_the_first_time(self) -> None:
+ """Regression test for issue #12424."""
+ if self.first_time:
+ type(self).first_time = False
+ self.fail()
diff --git a/tox.ini b/tox.ini
index 0a3f0acf5b8..35b335a015d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -141,7 +141,7 @@ commands =
pytest --cov=. simple_integration.py
pytest --ds=django_settings simple_integration.py
pytest --html=simple.html simple_integration.py
- pytest --reruns 5 simple_integration.py
+ pytest --reruns 5 simple_integration.py pytest_rerunfailures_integration.py
pytest pytest_anyio_integration.py
pytest pytest_asyncio_integration.py
pytest pytest_mock_integration.py
@@ -29,20 +29,14 @@
buildPythonPackage rec {
pname = "pytest";
version = "8.2.2";
version = "8.3.2";
pyproject = true;
src = fetchPypi {
inherit pname version;
hash = "sha256-3ku4EE4gGTnM3GiLJ6iae+IHmyLivSsH+Aa2unEReXc=";
hash = "sha256-wTI0XRLOVRJCyHJp3oEkg/W8yHzbtHIuSEh7oZT5/c4=";
};
patches = [
# https://github.com/pytest-dev/pytest/issues/12424
# https://github.com/pytest-dev/pytest/pull/12436
./8.2.2-unittest-testcase-regression.patch
];
outputs = [
"out"
"testout"
@@ -4,17 +4,18 @@
fetchPypi,
docutils,
lockfile,
packaging,
pytestCheckHook,
testscenarios,
testtools,
twine,
setuptools,
pythonOlder,
}:
buildPythonPackage rec {
pname = "python-daemon";
version = "3.0.1";
format = "setuptools";
pyproject = true;
disabled = pythonOlder "3.7";
@@ -23,7 +24,14 @@ buildPythonPackage rec {
hash = "sha256-bFdFI3L36v9Ak0ocA60YJr9eeTVY6H/vSRMeZGS02uU=";
};
nativeBuildInputs = [ twine ];
postPatch = ''
sed -i "s/setuptools\.extern\.//g" version.py test_version.py
'';
nativeBuildInputs = [
setuptools
packaging
];
propagatedBuildInputs = [
docutils
@@ -6,13 +6,14 @@
hatch-fancy-pypi-readme,
hatch-vcs,
hatchling,
pydantic,
freezegun,
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "python-ulid";
version = "2.2.0";
version = "2.7.0";
pyproject = true;
disabled = pythonOlder "3.9";
@@ -21,19 +22,23 @@ buildPythonPackage rec {
owner = "mdomke";
repo = "python-ulid";
rev = "refs/tags/${version}";
hash = "sha256-d5jCPxWUOfw/OCtbA9Db9+s1D5DAdL+vbPR8zavgbbo=";
hash = "sha256-Z9rYqekhrYa8ab17AVmKyObvq4HTOij7+LMlvRSqUQM=";
};
nativeBuildInputs = [
build-system = [
hatch-fancy-pypi-readme
hatch-vcs
hatchling
];
optional-dependencies = {
pydantic = [ pydantic ];
};
nativeCheckInputs = [
freezegun
pytestCheckHook
];
] ++ optional-dependencies.pydantic;
pythonImportsCheck = [ "ulid" ];
@@ -0,0 +1,126 @@
From 2769cb607d4e696e2fe70802d4246ccc5abd64a8 Mon Sep 17 00:00:00 2001
From: Nate Prewitt <nate.prewitt@gmail.com>
Date: Wed, 29 May 2024 12:48:48 -0700
Subject: [PATCH 1/3] Consider cert settings when using default context
---
src/requests/adapters.py | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/requests/adapters.py b/src/requests/adapters.py
index 9a58b16025..991b7e21c9 100644
--- a/src/requests/adapters.py
+++ b/src/requests/adapters.py
@@ -87,6 +87,23 @@ def SOCKSProxyManager(*args, **kwargs):
_preloaded_ssl_context = None
+def _should_use_default_context(
+ verify: "bool | str | None",
+ client_cert: "typing.Tuple[str, str] | str | None",
+ poolmanager_kwargs: typing.Dict[str, typing.Any],
+) -> bool:
+ # Determine if we have and should use our default SSLContext
+ # to optimize performance on standard requests.
+ has_poolmanager_ssl_context = poolmanager_kwargs.get("ssl_context")
+ should_use_default_ssl_context = (
+ verify is True
+ and _preloaded_ssl_context is not None
+ and not has_poolmanager_ssl_context
+ and client_cert is None
+ )
+ return should_use_default_ssl_context
+
+
def _urllib3_request_context(
request: "PreparedRequest",
verify: "bool | str | None",
@@ -98,19 +115,12 @@ def _urllib3_request_context(
parsed_request_url = urlparse(request.url)
scheme = parsed_request_url.scheme.lower()
port = parsed_request_url.port
-
- # Determine if we have and should use our default SSLContext
- # to optimize performance on standard requests.
poolmanager_kwargs = getattr(poolmanager, "connection_pool_kw", {})
- has_poolmanager_ssl_context = poolmanager_kwargs.get("ssl_context")
- should_use_default_ssl_context = (
- _preloaded_ssl_context is not None and not has_poolmanager_ssl_context
- )
cert_reqs = "CERT_REQUIRED"
if verify is False:
cert_reqs = "CERT_NONE"
- elif verify is True and should_use_default_ssl_context:
+ elif _should_use_default_context(verify, client_cert, poolmanager_kwargs):
pool_kwargs["ssl_context"] = _preloaded_ssl_context
elif isinstance(verify, str):
if not os.path.isdir(verify):
From e341df3efa0323072fab5d16307e2a20295675b9 Mon Sep 17 00:00:00 2001
From: Nate Prewitt <nate.prewitt@gmail.com>
Date: Fri, 31 May 2024 11:41:48 -0700
Subject: [PATCH 2/3] Set default ca_cert bundle if verify is True
---
src/requests/adapters.py | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/requests/adapters.py b/src/requests/adapters.py
index 991b7e21c9..ba5a0ec4f0 100644
--- a/src/requests/adapters.py
+++ b/src/requests/adapters.py
@@ -118,15 +118,23 @@ def _urllib3_request_context(
poolmanager_kwargs = getattr(poolmanager, "connection_pool_kw", {})
cert_reqs = "CERT_REQUIRED"
+ cert_loc = None
if verify is False:
cert_reqs = "CERT_NONE"
elif _should_use_default_context(verify, client_cert, poolmanager_kwargs):
pool_kwargs["ssl_context"] = _preloaded_ssl_context
+ elif verify is True:
+ # Set default ca cert location if none provided
+ cert_loc = extract_zipped_paths(DEFAULT_CA_BUNDLE_PATH)
elif isinstance(verify, str):
- if not os.path.isdir(verify):
- pool_kwargs["ca_certs"] = verify
+ cert_loc = verify
+
+ if cert_loc is not None:
+ if not os.path.isdir(cert_loc):
+ pool_kwargs["ca_certs"] = cert_loc
else:
- pool_kwargs["ca_cert_dir"] = verify
+ pool_kwargs["ca_cert_dir"] = cert_loc
+
pool_kwargs["cert_reqs"] = cert_reqs
if client_cert is not None:
if isinstance(client_cert, tuple) and len(client_cert) == 2:
From da96a92e2eb6dfe7c74704267bcb8f9fd6fb92b0 Mon Sep 17 00:00:00 2001
From: Nate Prewitt <nate.prewitt@gmail.com>
Date: Fri, 31 May 2024 12:20:11 -0700
Subject: [PATCH 3/3] Correct comment to match actual behavior
---
src/requests/adapters.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/requests/adapters.py b/src/requests/adapters.py
index ba5a0ec4f0..54143f9e6b 100644
--- a/src/requests/adapters.py
+++ b/src/requests/adapters.py
@@ -334,10 +334,8 @@ def cert_verify(self, conn, url, verify, cert):
if url.lower().startswith("https") and verify:
conn.cert_reqs = "CERT_REQUIRED"
- # Only load the CA certificates if 'verify' is a string indicating the CA bundle to use.
- # Otherwise, if verify is a boolean, we don't load anything since
- # the connection will be using a context with the default certificates already loaded,
- # and this avoids a call to the slow load_verify_locations()
+ # Only load the CA certificates if `verify` is a
+ # string indicating the CA bundle to use.
if verify is not True:
# `verify` must be a str with a path then
cert_loc = verify
@@ -30,6 +30,12 @@ buildPythonPackage rec {
hash = "sha256-VTZUF3NOsYJVWQqf+euX6eHaho1MzWQCOZ6vaK8gp2A=";
};
patches = [
# https://github.com/psf/requests/issues/6730
# https://github.com/psf/requests/pull/6731
./ca-load-regression.patch
];
dependencies = [
brotlicffi
certifi
@@ -24,27 +24,22 @@
buildPythonPackage rec {
pname = "scikit-build";
version = "0.17.6";
format = "pyproject";
version = "0.18.0";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchPypi {
pname = "scikit_build";
inherit version;
hash = "sha256-tRpRo2s3xCZQmUtQR5EvWbIuMhCyPjIfKHYR+e9uXJ0=";
hash = "sha256-caE69GfRo4UQw0lHhuLttz6tU+qSK95uUZ3FNyqmUJY=";
};
patches = [
# https://github.com/scikit-build/scikit-build/pull/1032
# https://github.com/scikit-build/scikit-build/issues/1047
./python312-compatibility.patch
(fetchpatch2 {
# https://github.com/scikit-build/scikit-build/pull/1073
name = "skbuild-suppress-permissionerror.patch";
url = "https://github.com/scikit-build/scikit-build/commit/41183413e4f5ef29cf3d21e470a2cfa2305733f8.patch";
hash = "sha256-M5Sbt4CBuiAeGgN0D/toglVi1V2GlA9hPIOMzcqOwdo=";
name = "setuptools-70.2.0-compat.patch";
url = "https://github.com/scikit-build/scikit-build/commit/7005897053bc5c71d823c36bbd89bd43121670f1.patch";
hash = "sha256-YGNCS1AXnqHQMd40CDePVNAzLe5gQ/nJxASAZafsxK8=";
})
];
@@ -54,13 +49,13 @@ buildPythonPackage rec {
sed -i "/'error',/d" pyproject.toml
'';
nativeBuildInputs = [
build-system = [
hatch-fancy-pypi-readme
hatch-vcs
hatchling
];
propagatedBuildInputs = [
dependencies = [
distro
packaging
setuptools
@@ -1,40 +0,0 @@
diff --git a/skbuild/resources/cmake/FindPythonExtensions.cmake b/skbuild/resources/cmake/FindPythonExtensions.cmake
index 59b30c2..62298d5 100644
--- a/skbuild/resources/cmake/FindPythonExtensions.cmake
+++ b/skbuild/resources/cmake/FindPythonExtensions.cmake
@@ -254,19 +254,23 @@ endif()
include(targetLinkLibrariesWithDynamicLookup)
set(_command "
-import distutils.sysconfig
+import sys
+
+if sys.version_info >= (3,10):
+ import sysconfig
+else:
+ from distutils import sysconfig
import itertools
import os
import os.path
import site
-import sys
result = None
rel_result = None
candidate_lists = []
try:
- candidate_lists.append((distutils.sysconfig.get_python_lib(),))
+ candidate_lists.append((sysconfig.get_python_lib(),))
except AttributeError: pass
try:
@@ -293,7 +297,7 @@ sys.stdout.write(\";\".join((
sys.prefix,
result,
rel_result,
- distutils.sysconfig.get_config_var('EXT_SUFFIX')
+ sysconfig.get_config_var('EXT_SUFFIX')
)))
")
@@ -2,11 +2,11 @@
lib,
buildPythonPackage,
fetchPypi,
python,
isPy27,
enum34,
attrs,
pytz,
pytestCheckHook,
}:
buildPythonPackage rec {
@@ -24,10 +24,8 @@ buildPythonPackage rec {
nativeCheckInputs = [
attrs
pytz
pytestCheckHook
];
checkPhase = ''
${python.interpreter} setup.py test
'';
meta = with lib; {
description = "Simple serialization library based on ast.literal_eval";
@@ -10,14 +10,14 @@
buildPythonPackage rec {
pname = "setuptools";
version = "70.0.0";
version = "72.1.0";
format = "pyproject";
src = fetchFromGitHub {
owner = "pypa";
repo = "setuptools";
rev = "refs/tags/v${version}";
hash = "sha256-LXF3R9zfWylvihP2M8N94/IlgifwxUwKJFhtvcXEPB0=";
hash = "sha256-3Hm9HxJdSmyhHtDZeMF76HaR17vZwZWYYhS6Z0nA8rU=";
};
patches = [
@@ -1,8 +1,8 @@
diff --git a/setuptools/_distutils/cygwinccompiler.py b/setuptools/_distutils/cygwinccompiler.py
index 539f09d8f..a3d3020cb 100644
index 7b812fd05..c122a4318 100644
--- a/setuptools/_distutils/cygwinccompiler.py
+++ b/setuptools/_distutils/cygwinccompiler.py
@@ -99,14 +99,19 @@ class CygwinCCompiler(UnixCCompiler):
@@ -99,14 +99,18 @@ class CygwinCCompiler(UnixCCompiler):
self.cxx = os.environ.get('CXX', 'g++')
self.linker_dll = self.cc
@@ -10,19 +10,18 @@ index 539f09d8f..a3d3020cb 100644
shared_option = "-shared"
self.set_executables(
compiler='%s -mcygwin -O -Wall' % self.cc,
compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc,
+ compiler_so_cxx='%s -mcygwin -mdll -O -Wall' % self.cxx,
compiler_cxx='%s -mcygwin -O -Wall' % self.cxx,
linker_exe='%s -mcygwin' % self.cc,
compiler=f'{self.cc} -mcygwin -O -Wall',
compiler_so=f'{self.cc} -mcygwin -mdll -O -Wall',
+ compiler_so_cxx=f'{self.cxx} -mcygwin -mdll -O -Wall',
compiler_cxx=f'{self.cxx} -mcygwin -O -Wall',
linker_exe=f'{self.cc} -mcygwin',
linker_so=(f'{self.linker_dll} -mcygwin {shared_option}'),
+ linker_exe_cxx='%s -mcygwin' % self.cxx,
+ linker_so_cxx=('%s -mcygwin %s' %
+ (self.linker_dll_cxx, shared_option)),
+ linker_exe_cxx=f'{self.cxx} -mcygwin',
+ linker_so_cxx=(f'{self.cxx} -mcygwin {shared_option}'),
)
# Include the appropriate MSVC runtime library if Python was built
@@ -138,9 +143,12 @@ class CygwinCCompiler(UnixCCompiler):
@@ -138,9 +142,12 @@ class CygwinCCompiler(UnixCCompiler):
raise CompileError(msg)
else: # for other files use the C-compiler
try:
@@ -38,24 +37,24 @@ index 539f09d8f..a3d3020cb 100644
except DistutilsExecError as msg:
raise CompileError(msg)
@@ -276,9 +284,12 @@ class Mingw32CCompiler(CygwinCCompiler):
@@ -276,9 +283,12 @@ class Mingw32CCompiler(CygwinCCompiler):
self.set_executables(
compiler='%s -O -Wall' % self.cc,
compiler_so='%s -mdll -O -Wall' % self.cc,
+ compiler_so_cxx='%s -mdll -O -Wall' % self.cxx,
compiler_cxx='%s -O -Wall' % self.cxx,
linker_exe='%s' % self.cc,
compiler=f'{self.cc} -O -Wall',
compiler_so=f'{self.cc} -shared -O -Wall',
+ compiler_so_cxx=f'{self.cxx} -mdll -O -Wall',
compiler_cxx=f'{self.cxx} -O -Wall',
linker_exe=f'{self.cc}',
linker_so=f'{self.linker_dll} {shared_option}',
+ linker_exe_cxx='%s' % self.cxx,
+ linker_so_cxx='%s %s' % (self.linker_dll_cxx, shared_option)
+ linker_exe_cxx=f'{self.cxx}',
+ linker_so_cxx=f'{self.linker_dll_cxx} {shared_option}',
)
def runtime_library_dir_option(self, dir):
diff --git a/setuptools/_distutils/sysconfig.py b/setuptools/_distutils/sysconfig.py
index 1a38e9fa7..034ed6566 100644
index 7ebe67687..a995edf80 100644
--- a/setuptools/_distutils/sysconfig.py
+++ b/setuptools/_distutils/sysconfig.py
@@ -300,6 +300,7 @@ def customize_compiler(compiler): # noqa: C901
@@ -304,6 +304,7 @@ def customize_compiler(compiler): # noqa: C901
cflags,
ccshared,
ldshared,
@@ -63,7 +62,7 @@ index 1a38e9fa7..034ed6566 100644
shlib_suffix,
ar,
ar_flags,
@@ -309,11 +310,14 @@ def customize_compiler(compiler): # noqa: C901
@@ -313,11 +314,14 @@ def customize_compiler(compiler): # noqa: C901
'CFLAGS',
'CCSHARED',
'LDSHARED',
@@ -78,7 +77,7 @@ index 1a38e9fa7..034ed6566 100644
if 'CC' in os.environ:
newcc = os.environ['CC']
if 'LDSHARED' not in os.environ and ldshared.startswith(cc):
@@ -325,19 +329,27 @@ def customize_compiler(compiler): # noqa: C901
@@ -329,19 +333,27 @@ def customize_compiler(compiler): # noqa: C901
cxx = os.environ['CXX']
if 'LDSHARED' in os.environ:
ldshared = os.environ['LDSHARED']
@@ -107,7 +106,7 @@ index 1a38e9fa7..034ed6566 100644
if 'AR' in os.environ:
ar = os.environ['AR']
if 'ARFLAGS' in os.environ:
@@ -346,13 +358,17 @@ def customize_compiler(compiler): # noqa: C901
@@ -350,13 +362,17 @@ def customize_compiler(compiler): # noqa: C901
archiver = ar + ' ' + ar_flags
cc_cmd = cc + ' ' + cflags
@@ -127,7 +126,7 @@ index 1a38e9fa7..034ed6566 100644
)
diff --git a/setuptools/_distutils/unixccompiler.py b/setuptools/_distutils/unixccompiler.py
index 0248bde87..9508e6cff 100644
index 7e68596b2..7214dbd20 100644
--- a/setuptools/_distutils/unixccompiler.py
+++ b/setuptools/_distutils/unixccompiler.py
@@ -118,9 +118,12 @@ class UnixCCompiler(CCompiler):
@@ -144,7 +143,7 @@ index 0248bde87..9508e6cff 100644
'archiver': ["ar", "-cr"],
'ranlib': None,
}
@@ -184,8 +187,13 @@ class UnixCCompiler(CCompiler):
@@ -187,8 +190,13 @@ class UnixCCompiler(CCompiler):
def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
compiler_so = compiler_fixup(self.compiler_so, cc_args + extra_postargs)
@@ -159,7 +158,7 @@ index 0248bde87..9508e6cff 100644
except DistutilsExecError as msg:
raise CompileError(msg)
@@ -253,7 +261,8 @@ class UnixCCompiler(CCompiler):
@@ -256,7 +264,8 @@ class UnixCCompiler(CCompiler):
# building an executable or linker_so (with shared options)
# when building a shared library.
building_exe = target_desc == CCompiler.EXECUTABLE
@@ -1,12 +1,9 @@
diff --git a/setup.cfg b/setup.cfg
index f23714b6..8aaeb330 100644
index 38922089a..a743a2467 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
@@ -1,3 +1,3 @@
[egg_info]
tag_build = .post
-tag_date = 1
+tag_date = 0
[aliases]
clean_egg_info = egg_info -Db ''
@@ -36,18 +36,21 @@
buildPythonPackage rec {
pname = "sqlalchemy";
version = "1.4.52";
version = "1.4.53";
pyproject = true;
src = fetchFromGitHub {
owner = "sqlalchemy";
repo = "sqlalchemy";
rev = "rel_${lib.replaceStrings [ "." ] [ "_" ] version}";
hash = "sha256-3JiPDOI6KDQwtBtISvHi3d+Rdm0pz1d9cnZu3+f4jYE=";
hash = "sha256-CpFvL0W/X7/4N/FpufAdud5o11LHBuox8m+8EailqXg=";
};
postPatch = ''
sed -i '/tag_build = dev/d' setup.cfg
substituteInPlace pyproject.toml \
--replace-fail "setuptools>=44,<69.3" "setuptools"
'';
nativeBuildInputs = [ setuptools ];
@@ -41,8 +41,8 @@
buildPythonPackage rec {
pname = "sqlalchemy";
version = "2.0.31";
format = "pyproject";
version = "2.0.32";
pyproject = true;
disabled = pythonOlder "3.7";
@@ -50,11 +50,14 @@ buildPythonPackage rec {
owner = "sqlalchemy";
repo = "sqlalchemy";
rev = "refs/tags/rel_${lib.replaceStrings [ "." ] [ "_" ] version}";
hash = "sha256-+bF7pdz8bxkR+mbrOI773qLoZVzBHpzKOENWPEuVFt8=";
hash = "sha256-B0T4GsTIis2ZZykRnNOFfhyfW4qU/waXeP0BS5+G1IM=";
};
postPatch = ''
sed -i '/tag_build = dev/d' setup.cfg
substituteInPlace pyproject.toml \
--replace-fail "setuptools>=61.0,<69.3" "setuptools"
'';
nativeBuildInputs = [ setuptools ] ++ lib.optionals (!isPyPy) [ cython ];
@@ -63,6 +63,8 @@ buildPythonPackage rec {
"ignore::DeprecationWarning"
"-W"
"ignore::trio.TrioDeprecationWarning"
"-W"
"ignore::ResourceWarning" # FIXME remove once test suite is fully compatible with anyio 4.4.0
];
pythonImportsCheck = [ "starlette" ];
@@ -28,7 +28,11 @@ buildPythonPackage rec {
'';
build-system = [ setuptools ];
dependencies = [ six ];
dependencies = [
mock
six
];
nativeCheckInputs = [
pytestCheckHook
@@ -15,7 +15,6 @@
ApplicationServices,
# tests
aiohttp,
psutil,
pyopenssl,
pytestCheckHook,
@@ -48,7 +47,6 @@ buildPythonPackage rec {
];
nativeCheckInputs = [
aiohttp
pyopenssl
pytestCheckHook
psutil