Merge pull request #213914 from dotlambda/poetry-plugin-up-init
poetryPlugins.poetry-plugin-up: init at 0.2.1
This commit is contained in:
commit
8fe83a027e
|
@ -1,13 +1,13 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, python3
|
||||
, fetchFromGitHub
|
||||
, installShellFiles
|
||||
}:
|
||||
|
||||
let
|
||||
python = python3.override {
|
||||
packageOverrides = self: super: {
|
||||
poetry = self.callPackage ./unwrapped.nix { };
|
||||
|
||||
# version overrides required by poetry and its plugins
|
||||
dulwich = super.dulwich.overridePythonAttrs (old: rec {
|
||||
version = "0.20.50";
|
||||
src = self.fetchPypi {
|
||||
|
@ -18,118 +18,30 @@ let
|
|||
});
|
||||
};
|
||||
};
|
||||
in python.pkgs.buildPythonApplication rec {
|
||||
pname = "poetry";
|
||||
version = "1.3.2";
|
||||
format = "pyproject";
|
||||
|
||||
disabled = python.pkgs.pythonOlder "3.7";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "python-poetry";
|
||||
repo = pname;
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-12EiEGI9Vkb6EUY/W2KWeLigxWra1Be4ozvi8njBpEU=";
|
||||
plugins = with python.pkgs; {
|
||||
poetry-audit-plugin = callPackage ./plugins/poetry-audit-plugin.nix { };
|
||||
poetry-plugin-up = callPackage ./plugins/poetry-plugin-up.nix { };
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
];
|
||||
# selector is a function mapping pythonPackages to a list of plugins
|
||||
# e.g. poetry.withPlugins (ps: with ps; [ poetry-plugin-up ])
|
||||
withPlugins = selector: let
|
||||
selected = selector plugins;
|
||||
in python.pkgs.toPythonApplication (python.pkgs.poetry.overridePythonAttrs (old: {
|
||||
propagatedBuildInputs = old.propagatedBuildInputs ++ selected;
|
||||
|
||||
propagatedBuildInputs = with python.pkgs; [
|
||||
cachecontrol
|
||||
cleo
|
||||
crashtest
|
||||
dulwich
|
||||
filelock
|
||||
html5lib
|
||||
jsonschema
|
||||
keyring
|
||||
packaging
|
||||
pexpect
|
||||
pkginfo
|
||||
platformdirs
|
||||
poetry-core
|
||||
poetry-plugin-export
|
||||
requests
|
||||
requests-toolbelt
|
||||
shellingham
|
||||
tomlkit
|
||||
trove-classifiers
|
||||
virtualenv
|
||||
] ++ lib.optionals (stdenv.isDarwin) [
|
||||
xattr
|
||||
] ++ lib.optionals (pythonOlder "3.11") [
|
||||
tomli
|
||||
] ++ lib.optionals (pythonOlder "3.10") [
|
||||
importlib-metadata
|
||||
] ++ lib.optionals (pythonOlder "3.8") [
|
||||
backports-cached-property
|
||||
] ++ cachecontrol.optional-dependencies.filecache;
|
||||
# save some build time when adding plugins by disabling tests
|
||||
doCheck = selected == [ ];
|
||||
|
||||
postInstall = ''
|
||||
installShellCompletion --cmd poetry \
|
||||
--bash <($out/bin/poetry completions bash) \
|
||||
--fish <($out/bin/poetry completions fish) \
|
||||
--zsh <($out/bin/poetry completions zsh) \
|
||||
'';
|
||||
# Propagating dependencies leaks them through $PYTHONPATH which causes issues
|
||||
# when used in nix-shell.
|
||||
postFixup = ''
|
||||
rm $out/nix-support/propagated-build-inputs
|
||||
'';
|
||||
|
||||
# Propagating dependencies leaks them through $PYTHONPATH which causes issues
|
||||
# when used in nix-shell.
|
||||
postFixup = ''
|
||||
rm $out/nix-support/propagated-build-inputs
|
||||
'';
|
||||
|
||||
nativeCheckInputs = with python.pkgs; [
|
||||
cachy
|
||||
deepdiff
|
||||
flatdict
|
||||
pytestCheckHook
|
||||
httpretty
|
||||
pytest-mock
|
||||
pytest-xdist
|
||||
];
|
||||
|
||||
preCheck = (''
|
||||
export HOME=$TMPDIR
|
||||
'' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
|
||||
# https://github.com/python/cpython/issues/74570#issuecomment-1093748531
|
||||
export no_proxy='*';
|
||||
'');
|
||||
|
||||
postCheck = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
|
||||
unset no_proxy
|
||||
'';
|
||||
|
||||
disabledTests = [
|
||||
# touches network
|
||||
"git"
|
||||
"solver"
|
||||
"load"
|
||||
"vcs"
|
||||
"prereleases_if_they_are_compatible"
|
||||
"test_executor"
|
||||
# requires git history to work correctly
|
||||
"default_with_excluded_data"
|
||||
# toml ordering has changed
|
||||
"lock"
|
||||
# fs permission errors
|
||||
"test_builder_should_execute_build_scripts"
|
||||
] ++ lib.optionals (python.pythonAtLeast "3.10") [
|
||||
# RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended
|
||||
"test_info_setup_complex_pep517_error"
|
||||
];
|
||||
|
||||
# Allow for package to use pep420's native namespaces
|
||||
pythonNamespaces = [
|
||||
"poetry"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
changelog = "https://github.com/python-poetry/poetry/blob/${src.rev}/CHANGELOG.md";
|
||||
homepage = "https://python-poetry.org/";
|
||||
description = "Python dependency management and packaging made easy";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ jakewaksbaum dotlambda ];
|
||||
};
|
||||
}
|
||||
passthru = rec {
|
||||
inherit plugins withPlugins;
|
||||
};
|
||||
}));
|
||||
in withPlugins (ps: [ ])
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, pythonOlder
|
||||
, fetchFromGitHub
|
||||
, poetry-core
|
||||
, poetry
|
||||
, safety
|
||||
, pytestCheckHook
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "poetry-audit-plugin";
|
||||
version = "0.3.0";
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
|
||||
format = "pyproject";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "opeco17";
|
||||
repo = "poetry-audit-plugin";
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-49OnYz3EFiqOe+cLgfynjy14Ve4Ga6OUrLdM8HhZuKQ=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
poetry-core
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
poetry
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
safety
|
||||
];
|
||||
|
||||
pythonImportsCheck = [ "poetry_audit_plugin" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
poetry # for the executable
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
# requires networking
|
||||
doCheck = false;
|
||||
|
||||
meta = {
|
||||
description = "Poetry plugin for checking security vulnerabilities in dependencies";
|
||||
homepage = "https://github.com/opeco17/poetry-audit-plugin";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ dotlambda ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, buildPythonPackage
|
||||
, poetry-core
|
||||
, pytestCheckHook
|
||||
, pytest-mock
|
||||
, poetry
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "poetry-plugin-up";
|
||||
version = "0.2.1";
|
||||
format = "pyproject";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "MousaZeidBaker";
|
||||
repo = pname;
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-16p0emvgWa56Km8U5HualCSStbulqyINbC3Jez9Y1n0=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
poetry-core
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
pytest-mock
|
||||
poetry
|
||||
];
|
||||
|
||||
preCheck = ''
|
||||
export HOME=$TMPDIR
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Poetry plugin to simplify package updates";
|
||||
homepage = "https://github.com/MousaZeidBaker/poetry-plugin-up";
|
||||
changelog = "https://github.com/MousaZeidBaker/poetry-plugin-up/releases/tag/${version}";
|
||||
license = licenses.mit;
|
||||
maintainers = [ maintainers.k900 ];
|
||||
};
|
||||
}
|
149
pkgs/tools/package-management/poetry/unwrapped.nix
Normal file
149
pkgs/tools/package-management/poetry/unwrapped.nix
Normal file
|
@ -0,0 +1,149 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, buildPythonPackage
|
||||
, pythonOlder
|
||||
, fetchFromGitHub
|
||||
, installShellFiles
|
||||
, cachecontrol
|
||||
, cleo
|
||||
, crashtest
|
||||
, dulwich
|
||||
, filelock
|
||||
, html5lib
|
||||
, jsonschema
|
||||
, keyring
|
||||
, packaging
|
||||
, pexpect
|
||||
, pkginfo
|
||||
, platformdirs
|
||||
, poetry-core
|
||||
, poetry-plugin-export
|
||||
, requests
|
||||
, requests-toolbelt
|
||||
, shellingham
|
||||
, tomlkit
|
||||
, trove-classifiers
|
||||
, virtualenv
|
||||
, xattr
|
||||
, tomli
|
||||
, importlib-metadata
|
||||
, backports-cached-property
|
||||
, cachy
|
||||
, deepdiff
|
||||
, flatdict
|
||||
, pytestCheckHook
|
||||
, httpretty
|
||||
, pytest-mock
|
||||
, pytest-xdist
|
||||
, pythonAtLeast
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "poetry";
|
||||
version = "1.3.2";
|
||||
format = "pyproject";
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "python-poetry";
|
||||
repo = pname;
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-12EiEGI9Vkb6EUY/W2KWeLigxWra1Be4ozvi8njBpEU=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
cachecontrol
|
||||
cleo
|
||||
crashtest
|
||||
dulwich
|
||||
filelock
|
||||
html5lib
|
||||
jsonschema
|
||||
keyring
|
||||
packaging
|
||||
pexpect
|
||||
pkginfo
|
||||
platformdirs
|
||||
poetry-core
|
||||
poetry-plugin-export
|
||||
requests
|
||||
requests-toolbelt
|
||||
shellingham
|
||||
tomlkit
|
||||
trove-classifiers
|
||||
virtualenv
|
||||
] ++ lib.optionals (stdenv.isDarwin) [
|
||||
xattr
|
||||
] ++ lib.optionals (pythonOlder "3.11") [
|
||||
tomli
|
||||
] ++ lib.optionals (pythonOlder "3.10") [
|
||||
importlib-metadata
|
||||
] ++ lib.optionals (pythonOlder "3.8") [
|
||||
backports-cached-property
|
||||
] ++ cachecontrol.optional-dependencies.filecache;
|
||||
|
||||
postInstall = ''
|
||||
installShellCompletion --cmd poetry \
|
||||
--bash <($out/bin/poetry completions bash) \
|
||||
--fish <($out/bin/poetry completions fish) \
|
||||
--zsh <($out/bin/poetry completions zsh) \
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [
|
||||
cachy
|
||||
deepdiff
|
||||
flatdict
|
||||
pytestCheckHook
|
||||
httpretty
|
||||
pytest-mock
|
||||
pytest-xdist
|
||||
];
|
||||
|
||||
preCheck = (''
|
||||
export HOME=$TMPDIR
|
||||
'' + lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
|
||||
# https://github.com/python/cpython/issues/74570#issuecomment-1093748531
|
||||
export no_proxy='*';
|
||||
'');
|
||||
|
||||
postCheck = lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) ''
|
||||
unset no_proxy
|
||||
'';
|
||||
|
||||
disabledTests = [
|
||||
# touches network
|
||||
"git"
|
||||
"solver"
|
||||
"load"
|
||||
"vcs"
|
||||
"prereleases_if_they_are_compatible"
|
||||
"test_executor"
|
||||
# requires git history to work correctly
|
||||
"default_with_excluded_data"
|
||||
# toml ordering has changed
|
||||
"lock"
|
||||
# fs permission errors
|
||||
"test_builder_should_execute_build_scripts"
|
||||
] ++ lib.optionals (pythonAtLeast "3.10") [
|
||||
# RuntimeError: 'auto_spec' might be a typo; use unsafe=True if this is intended
|
||||
"test_info_setup_complex_pep517_error"
|
||||
];
|
||||
|
||||
# Allow for package to use pep420's native namespaces
|
||||
pythonNamespaces = [
|
||||
"poetry"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
changelog = "https://github.com/python-poetry/poetry/blob/${src.rev}/CHANGELOG.md";
|
||||
homepage = "https://python-poetry.org/";
|
||||
description = "Python dependency management and packaging made easy";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ jakewaksbaum dotlambda ];
|
||||
};
|
||||
}
|
|
@ -16574,6 +16574,8 @@ with pkgs;
|
|||
|
||||
poetry = callPackage ../tools/package-management/poetry { };
|
||||
|
||||
poetryPlugins = recurseIntoAttrs poetry.plugins;
|
||||
|
||||
poetry2nix = callPackage ../development/tools/poetry2nix/poetry2nix {
|
||||
inherit pkgs lib;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue