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

Add an additional dependency for home-assistant #41328

Merged
merged 2 commits into from Jun 5, 2018

Conversation

etu
Copy link
Contributor

@etu etu commented May 31, 2018

Motivation for this change

I've tried to set up my hue bridge with home-assistant but it failed. But then I've packaged this dep and now it works:

image

Things done
  • 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/)
  • Fits CONTRIBUTING.md.

cc @dotlambda @f-breidenstein

@etu etu requested a review from FRidh as a code owner May 31, 2018 19:51
@etu
Copy link
Contributor Author

etu commented May 31, 2018

@GrahamcOfBorg build python27Packages.voluptuous-serialize python36Packages.voluptuous-serialize

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python27Packages.voluptuous-serialize, python36Packages.voluptuous-serialize

Partial log (click to expand)

reading manifest file 'voluptuous_serialize.egg-info/SOURCES.txt'
writing manifest file 'voluptuous_serialize.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/qm3ynjnbkxjx3g7v8hg7xvr7z6isxxc5-python2.7-voluptuous-serialize-1.0.0
/nix/store/vnyzw2qyzr1pf7v71cqplhr3bnpfh6zg-python3.6-voluptuous-serialize-1.0.0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python27Packages.voluptuous-serialize, python36Packages.voluptuous-serialize

Partial log (click to expand)

reading manifest file 'voluptuous_serialize.egg-info/SOURCES.txt'
writing manifest file 'voluptuous_serialize.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/1pfq9n4g6q4vy3qdpj7f4dbzcf66bgyb-python2.7-voluptuous-serialize-1.0.0
/nix/store/sfch6xvhqym8wh0kbbxx2rzf0lmm7s3b-python3.6-voluptuous-serialize-1.0.0

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python36Packages.voluptuous-serialize

Partial log (click to expand)

/nix/store/vnyzw2qyzr1pf7v71cqplhr3bnpfh6zg-python3.6-voluptuous-serialize-1.0.0

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python36Packages.voluptuous-serialize

Partial log (click to expand)

/nix/store/sfch6xvhqym8wh0kbbxx2rzf0lmm7s3b-python3.6-voluptuous-serialize-1.0.0

@dotlambda
Copy link
Member

Ran 0 tests in 0.000s

Please specify an appropriate checkPhase, probably ${python.interpreter} -m unittest discover. You might have to use fetchFromGitHub.

Also, do you want to maintain this package?

@etu etu force-pushed the hass-add-hue-dependency branch 2 times, most recently from 24ff10b to a1bcaf3 Compare June 1, 2018 15:34
@etu
Copy link
Contributor Author

etu commented Jun 1, 2018

@dotlambda
I'm now marked as maintainer and fetch the source from github instead. And there's a tests directory present in the source that I get.

But I still get Ran 0 tests in 0.000s regardless if I add a checkPhase with ${python.interpreter} -m unittest discover or not...

So not sure what to test now...

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python36Packages.voluptuous-serialize

Partial log (click to expand)

writing top-level names to voluptuous_serialize.egg-info/top_level.txt
reading manifest file 'voluptuous_serialize.egg-info/SOURCES.txt'
writing manifest file 'voluptuous_serialize.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/985nimv9bd40bkn07381dcfpp7jwmip8-python3.6-voluptuous-serialize-2018-03-10

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python36Packages.voluptuous-serialize

Partial log (click to expand)

writing top-level names to voluptuous_serialize.egg-info/top_level.txt
reading manifest file 'voluptuous_serialize.egg-info/SOURCES.txt'
writing manifest file 'voluptuous_serialize.egg-info/SOURCES.txt'
running build_ext

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
/nix/store/xxh3iwl1nxf8cipr0cy1p0h7j4vavhd9-python3.6-voluptuous-serialize-2018-03-10

@etu
Copy link
Contributor Author

etu commented Jun 4, 2018

I've tried the following, but none of them run any tests:

diff --git a/pkgs/development/python-modules/voluptuous-serialize/default.nix b/pkgs/development/python-modules/voluptuous-serialize/default.nix
index f899e869758..7954ab15155 100644
--- a/pkgs/development/python-modules/voluptuous-serialize/default.nix
+++ b/pkgs/development/python-modules/voluptuous-serialize/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPythonPackage, fetchFromGitHub, voluptuous }:
+{ stdenv, buildPythonPackage, fetchFromGitHub, voluptuous, pytest, python }:
 
 buildPythonPackage rec  {
   pname = "voluptuous-serialize";
@@ -15,6 +15,20 @@ buildPythonPackage rec  {
     voluptuous
   ];
 
+  checkInputs = [
+    pytest
+  ];
+
+  checkPhase = ''
+    ${python.interpreter} -m unittest discover -s ./tests -p ./tests/test_lib.py
+    ${python.interpreter} -m unittest discover -p tests/test_lib.py
+    ${python.interpreter} -m unittest discover
+    ${python.interpreter} -m unittest tests/test_lib.py
+    ${python.interpreter} tests/test_lib.py
+    ${python.interpreter} -m unittest
+  '';
+
   meta = with stdenv.lib; {
     homepage = https://github.com/balloob/voluptuous-serialize;
     license = licenses.asl20;

So I have no idea what more to try...

@dotlambda
Copy link
Member

Looking at https://github.com/balloob/voluptuous-serialize/blob/master/requirements_test.txt, it seems like the pytest should be used. I've force-pushed an appropriate change and I disabled Python 2 support because the tests fail.

@etu
Copy link
Contributor Author

etu commented Jun 5, 2018

@dotlambda My python knowledge is quite limited to writing basic python because I've never done any bigger projects with it.

But this looks fine to me :)

@etu
Copy link
Contributor Author

etu commented Jun 5, 2018

@GrahamcOfBorg build python36Packages.voluptuous-serialize

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: python36Packages.voluptuous-serialize

Partial log (click to expand)

running install tests
============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
rootdir: /build/source, inifile: setup.cfg
collected 10 items

tests/test_lib.py ..........                                             [100%]

========================== 10 passed in 0.20 seconds ===========================
/nix/store/1dy7j2anaxdnj9mcjahlvvpqcpd2js1p-python3.6-voluptuous-serialize-2018-03-10

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: python36Packages.voluptuous-serialize

Partial log (click to expand)

running install tests
============================= test session starts ==============================
platform linux -- Python 3.6.5, pytest-3.5.1, py-1.5.3, pluggy-0.6.0
rootdir: /build/source, inifile: setup.cfg
collected 10 items

tests/test_lib.py ..........                                             [100%]

========================== 10 passed in 0.03 seconds ===========================
/nix/store/5jhx2f95p9yaja316bq1dl8h09yl8149-python3.6-voluptuous-serialize-2018-03-10

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: home-assistant, python36Packages.voluptuous-serialize

Partial log (click to expand)

copying path '/nix/store/m9im1nikgxhlrk8r1g6wi8mckfxgdbvd-python3.6-aiohttp-cors-0.7.0' from 'https://cache.nixos.org'...
copying path '/nix/store/9m0qfkv3nimwh0xk5db7iffh8npqip0h-python3.6-cffi-1.11.5-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/bfgkdsm00jilz3ql28x3pv3af5l0m321-python3.6-cryptography-2.2.2-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/7rclm08dlbnk0a2lcc6av1dyjjc2f0pi-python3.6-pyOpenSSL-17.5.0-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/zchnwj07h9qmdnzvcx1fljz3dd2mvl9k-python3.6-urllib3-1.22' from 'https://cache.nixos.org'...
copying path '/nix/store/pryv8bpp2snyjn83fc1rmixsn3xmqjcm-python3.6-requests-2.18.4-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/icl1izf00jai7c396ljv5rzccgqmpk07-python3.6-astral-1.6.1' from 'https://cache.nixos.org'...
copying path '/nix/store/f9428bliihy1q3lcv3j9fix6r6li8ny0-homeassistant-0.69.1' from 'https://cache.nixos.org'...
/nix/store/f9428bliihy1q3lcv3j9fix6r6li8ny0-homeassistant-0.69.1
/nix/store/1dy7j2anaxdnj9mcjahlvvpqcpd2js1p-python3.6-voluptuous-serialize-2018-03-10

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: home-assistant, python36Packages.voluptuous-serialize

Partial log (click to expand)

copying path '/nix/store/7mxqxm2cz7vcljz9fxgr4kbhyvd9wd9n-python3.6-aiohttp-3.1.3' from 'https://cache.nixos.org'...
copying path '/nix/store/20g2pnvj5h8ifr5k80br2xlcczn06npv-python3.6-cryptography-2.2.2-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/jwhbd1l667mmk8pbz9dr9nbhdlkzncb4-python3.6-pyOpenSSL-17.5.0-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/r4s106pyik2cv5zsvy1g42syv0ac6hbr-python3.6-urllib3-1.22' from 'https://cache.nixos.org'...
copying path '/nix/store/fkz89n27372cg25qfdv9cr6fspnafp9i-python3.6-requests-2.18.4-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/11khsqlg7hqh0kycyfz8f89wkjx156f7-python3.6-astral-1.6.1' from 'https://cache.nixos.org'...
copying path '/nix/store/4nzjfjdx86awc4xwigqf5bwsknlkngpp-python3.6-aiohttp-cors-0.7.0' from 'https://cache.nixos.org'...
copying path '/nix/store/yhjzm49icsc7xamv1zk8l24zb4c39hpp-homeassistant-0.69.1' from 'https://cache.nixos.org'...
/nix/store/yhjzm49icsc7xamv1zk8l24zb4c39hpp-homeassistant-0.69.1
/nix/store/5jhx2f95p9yaja316bq1dl8h09yl8149-python3.6-voluptuous-serialize-2018-03-10

@dotlambda dotlambda merged commit e37c936 into NixOS:master Jun 5, 2018
@dotlambda
Copy link
Member

@etu I just checked and I think I shouldn't have merged this. Did you read the first line of component-packages.nix?

@dotlambda
Copy link
Member

dotlambda commented Jun 5, 2018

As you can see in https://github.com/home-assistant/home-assistant/blob/dev/requirements_all.txt#L1336, this is not a dependency of the hue components but of config.config_entries. Are you using the latter component?

@etu
Copy link
Contributor Author

etu commented Jun 5, 2018

@dotlambda I have seen changes in component-packages.nix that have looked like manual edits before, I don't know how it would been generated.

Hmm, that might be the case that it's not specifically a hue dependency, I just know that it showed up in my logs when trying to use hue so I assumed it to be needed by hue.

Then I guess it should be a dep for home-assistant overall instead of hue to be able to use the config entries thingy?

@etu etu deleted the hass-add-hue-dependency branch June 5, 2018 07:42
@dotlambda
Copy link
Member

It's always generated by parse-requirements.py, as stated in the first line.

I've no idea what config_entries is. Do you?

@etu
Copy link
Contributor Author

etu commented Jun 5, 2018

No idea, but in the hass-config page there's a page named Integrations where it had discovered Hue. But when I pressed that button, nothing did happen because of this missing dependency. That's why I thought it was Hue related.

So this dependency is needed by something, but it should probably be put somewhere else.

@dotlambda
Copy link
Member

I think it's loaded by https://github.com/home-assistant/home-assistant/blob/0.69.1/homeassistant/config_entries.py, so let's just add this as a dependency for Home Assistant directly. That's what I did in 47a08c1.

@etu
Copy link
Contributor Author

etu commented Jun 5, 2018

Thanks, looks good 😄

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

3 participants