2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
black,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
hatchling,
|
|
|
|
pytest,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
ruff,
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytest-examples";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.0.12";
|
|
|
|
pyproject = true;
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pydantic";
|
|
|
|
repo = "pytest-examples";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-hTLTL3w4OEv8Pkzc/h9qDMnlhe6P+Q6XUImLVDsDKvk=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# ruff binary is used directly, the ruff Python package is not needed
|
|
|
|
substituteInPlace pytest_examples/lint.py \
|
2024-07-27 06:49:29 +00:00
|
|
|
--replace-fail "'ruff'" "'${lib.getExe ruff}'"
|
2023-07-15 17:15:38 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonRemoveDeps = [ "ruff" ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
build-system = [
|
2023-07-15 17:15:38 +00:00
|
|
|
hatchling
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [ pytest ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
dependencies = [ black ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "pytest_examples" ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
meta = {
|
2023-07-15 17:15:38 +00:00
|
|
|
description = "Pytest plugin for testing examples in docstrings and markdown files";
|
|
|
|
homepage = "https://github.com/pydantic/pytest-examples";
|
|
|
|
changelog = "https://github.com/pydantic/pytest-examples/releases/tag/v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ fab ];
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
}
|