Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poetry: fix build and update from 1.0.5 -> 1.0.9 #91222

Merged
merged 3 commits into from Jun 22, 2020

Conversation

mweinelt
Copy link
Member

Motivation for this change

Poetry failed to build.

  • Downgrade keyring, could also be substituted by using a patch, since it's a multiline statement in pyproject.tml, if that is what you prefer.
     keyring = [
         { version = "^18.0.1", python = "~2.7 || ~3.4" },
         { version = "^20.0.1", python = "^3.5" }
     ]
    
  • The clikit dependency now requires crashtest.
  • I tried building crashtest from GitHub in pyproject format, but that failed somewhere in poetry, so it's falling back to an imports check now.
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@jbaum98

Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

both crashtest and keyring have removed support for python2, I would just remove it from poetry altogether. Also, we are quite outside the version range of ~1/2 the dependencies, we should have tests. This is what I came up with:

{ lib, buildPythonPackage, fetchFromGitHub, isPy27, pythonOlder
, cachecontrol
, cachy
, cleo
, clikit
, html5lib
, httpretty
, importlib-metadata
, intreehooks
, jsonschema
, keyring
, lockfile
, pexpect
, pkginfo
, pygments
, pyparsing
, pyrsistent
, pytestCheckHook
, pytestcov
, pytest-mock
, requests
, requests-toolbelt
, shellingham
, tomlkit
}:

buildPythonPackage rec {
  pname = "poetry";
  version = "1.0.9";
  format = "pyproject";
  disabled = isPy27;

  src = fetchFromGitHub {
    owner = "python-poetry";
    repo = pname;
    rev = version;
    sha256 = "0gi1li55rim60hf1gdpgpx84zlkaj0wv12wbv7dib9malhfj3pnz";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
     --replace "pyrsistent = \"^0.14.2\"" "pyrsistent = \"^0.16.0\"" \
     --replace "requests-toolbelt = \"^0.8.0\"" "requests-toolbelt = \"^0.9.1\"" \
     --replace 'importlib-metadata = {version = "~1.1.3", python = "<3.8"}' \
       'importlib-metadata = {version = ">=1.3,<2", python = "<3.8"}' \
     --replace "tomlkit = \"^0.5.11\"" "tomlkit = \"^0.6.0\"" \
     --replace "cleo = \"^0.7.6\"" "cleo = \"^0.8.0\"" \
     --replace "version = \"^20.0.1\", python = \"^3.5\"" "version = \"^21.0.0\", python = \"^3.5\"" \
     --replace "clikit = \"^0.4.2\"" "clikit = \"^0.6.2\""
  '';

  nativeBuildInputs = [ intreehooks ];

  propagatedBuildInputs = [
    cachecontrol
    cachy
    cleo
    clikit
    html5lib
    jsonschema
    keyring
    lockfile
    pexpect
    pkginfo
    pyparsing
    pyrsistent
    requests
    requests-toolbelt
    shellingham
    tomlkit
  ] ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ];

  postInstall = ''
    mkdir -p "$out/share/bash-completion/completions"
    "$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
    mkdir -p "$out/share/zsh/vendor-completions"
    "$out/bin/poetry" completions zsh > "$out/share/zsh/vendor-completions/_poetry"
    mkdir -p "$out/share/fish/vendor_completions.d"
    "$out/bin/poetry" completions fish > "$out/share/fish/vendor_completions.d/poetry.fish"
  '';

  checkInputs = [ pytestCheckHook httpretty pytest-mock pygments pytestcov ];
  preCheck = "export HOME=$TMPDIR";
  disabledTests = [
    # touches network
    "git"
    "solver"
    "load"
    "vcs"
    "prereleases_if_they_are_compatible"
    # requires git history to work correctly
    "default_with_excluded_data"
  ];

  meta = with lib; {
    homepage = "https://python-poetry.org/";
    description = "Python dependency management and packaging made easy";
    license = licenses.mit;
    maintainers = with maintainers; [ jakewaksbaum ];
  };
}

pkgs/development/python-modules/poetry/default.nix Outdated Show resolved Hide resolved
pkgs/development/python-modules/crashtest/default.nix Outdated Show resolved Hide resolved
@mweinelt
Copy link
Member Author

Yeah, thanks for the recommendation and your work on the tests. I squashed them into the poetry commit.

Disables Python2 support and enables tests.

Co-Authored-By: Jonathan Ringer <jonringer117@gmail.com>
Copy link
Contributor

@jonringer jonringer left a comment

Choose a reason for hiding this comment

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

LGTM

Result of nixpkgs-review pr 91222 1

13 packages built:
- cmake-language-server
- python37Packages.aria2p
- python37Packages.cleo
- python37Packages.clikit
- python37Packages.crashtest
- python37Packages.poetry
- python37Packages.xdg
- python38Packages.aria2p
- python38Packages.cleo
- python38Packages.clikit
- python38Packages.crashtest
- python38Packages.poetry
- python38Packages.xdg

@jonringer jonringer merged commit 7fae3f8 into NixOS:master Jun 22, 2020
@mweinelt mweinelt deleted the poetry-fixes branch June 22, 2020 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants