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

pythonPackages.connexion #52580

Merged
merged 4 commits into from Sep 10, 2019
Merged

pythonPackages.connexion #52580

merged 4 commits into from Sep 10, 2019

Conversation

elohmeier
Copy link
Contributor

@elohmeier elohmeier commented Dec 20, 2018

Motivation for this change

add the connexion library and dependencies to build nice Flask-API's with Nix

Things done

added clickclick, openapi-spec-validator, connexion

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@worldofpeace worldofpeace left a comment

Choose a reason for hiding this comment

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

I'm seeing you've disabled tests in all of these packages because they aren't distributed from PyPI.

Usually in that case I'd recommend not fetching from PyPI and instead using the github source with fetchFromGitHub.

Also any dependencies needed for tests should be in checkInputs.

@elohmeier
Copy link
Contributor Author

@worldofpeace thanks for your feedback! I've switched the packages to fetch from GitHub. In some cases the tests fail, so I've disabled them - but they can be executed now. I've also updated the wrong link and added another optional dependency for connexion.

@elohmeier
Copy link
Contributor Author

@worldofpeace thanks for your helpful feedback! I really appreciate it =)
Thanks for the tip with pytest -k, that worked out. I've updated the packages.

@elohmeier
Copy link
Contributor Author

@worldofpeace thanks for your feedback =)

@worldofpeace
Copy link
Contributor

@elohmeier I'm seeing that they're some deps that are already in propagatedBuildInputs that are needed for testing that aren't in checkInputs in connexion.

I'm not sure if that was on purpose, but they should be declared as checkInputs if we need them for tests.

Also I think we're missing decorator.

#52580 (comment)
I've modified that part as you suggested. However there are a lot of unit tests failing if I'm trying to build it for Python 2.7 or Python 3.6. Should we disable the tests for that versions?

Can you paste the logs somewhere after this round of review?
Perhaps we're missing something.

@elohmeier
Copy link
Contributor Author

elohmeier commented Jan 30, 2019

@worldofpeace thanks again for your review! I've been able to make the package build and test successfully now for py27, py35, py36 and py37. There was a problem using the wrong locale for Python <3.7 (seems to be the same as nix-community/pypi2nix#52, took the fix from there). I've also added the missing dependecies (adding another package).
There is still a problem though, the authors of connexion need aiohttp<3.5.2. I've locally switched to 3.5.1, but nixpkgs has a more recent version on master which makes the tests fail. Do you have a suggestion on how to handle that?
Your feedback is much appreciated :-)

@worldofpeace
Copy link
Contributor

There is still a problem though, the authors of connexion need aiohttp<3.5.2. I've locally switched to 3.5.1, but nixpkgs has a more recent version on master which makes the tests fail. Do you have a suggestion on how to handle that?
Your feedback is much appreciated :-)

Looks like they pinned it because the newer version broke their build spec-first/connexion#844.
Might want to bug them to fix that soon.

We could skip the aiohttp tests and hope it isn't broken because of it or we could pin the version within the expression.

And you could do that like

let

  aiohttp_3_5_1 = aiohttp.overridePythonAttrs (oldAttrs: {
    version = "3.5.1";

    src = fetchPypi {
      inherit (oldAttrs) pname;
      inherit version;
      sha256 = ...;
    };
  });

in

@worldofpeace
Copy link
Contributor

Actually you can't override it because its dependents already have aiohttp in their propagatedBuildInputs and we simply can't have that ever because it will conflict.

@mmahut
Copy link
Member

mmahut commented Aug 18, 2019

Are there any updates on this pull request, please?

@elohmeier
Copy link
Contributor Author

@worldofpeace Thanks for your feedback, I've updated my changes accordingly. I've also updated to the latest package versions.

@lheckemann lheckemann added this to the 20.03 milestone Sep 10, 2019
@worldofpeace
Copy link
Contributor

worldofpeace commented Sep 10, 2019

@elohmeier, we've actually undergone an API change for python packaging since this change was authored.

We have a setup hook for running pytest

so wherever a package uses pytest you should migrate like this

checkInputs = [
  pytestCheckHook # you should drop pytest from checkInputs as well
];

disabledTests = [
  "some_disabled_test_case" # uses -k internally etc.
];

@elohmeier
Copy link
Contributor Author

@worldofpeace Thanks for the review and info, I've switched to the new API where possible.
I've also introduced a patch to deal with the aiohttp problem from upstream, which led to no regression in the enabled tests.

@worldofpeace
Copy link
Contributor

@worldofpeace Thanks for the review and info, I've switched to the new API where possible.
I've also introduced a patch to deal with the aiohttp problem from upstream, which led to no regression in the enabled tests.

Great, I'm going to build everything locally. Pretty sure we should be good to merge 👍

@worldofpeace worldofpeace merged commit d13ac65 into NixOS:master Sep 10, 2019
@worldofpeace
Copy link
Contributor

Thanks @elohmeier

@elohmeier elohmeier deleted the connexion branch September 10, 2019 16:28
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

5 participants